mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 18:10:27 +00:00
df7416d16b
These improvements rely on the new JSON operators to be useful. Those improvements were originally in #6522 but now there's an updated version in #6666. Managing things is simpler if I merge these changes now
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/*\
|
|
title: $:/plugins/tiddlywiki/dynannotate/startup.js
|
|
type: application/javascript
|
|
module-type: startup
|
|
|
|
Startup the dyannotate background daemon to track the selection
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
// Export name and synchronous status
|
|
exports.name = "dyannotate-startup";
|
|
exports.platforms = ["browser"];
|
|
exports.after = ["render"];
|
|
exports.synchronous = true;
|
|
|
|
var CONFIG_SELECTION_TRACKER_TITLE = "$:/config/Dynannotate/SelectionTracker/Enable",
|
|
CONFIG_LEGACY_SELECTION_TRACKER_TITLE = "$:/config/Dynannotate/LegacySelectionTracker/Enable";
|
|
|
|
var SelectionTracker = require("$:/plugins/tiddlywiki/dynannotate/selection-tracker.js").SelectionTracker,
|
|
LegacySelectionTracker = require("$:/plugins/tiddlywiki/dynannotate/legacy-selection-tracker.js").LegacySelectionTracker;
|
|
|
|
exports.startup = function() {
|
|
$tw.dynannotate = {};
|
|
if($tw.wiki.getTiddlerText(CONFIG_SELECTION_TRACKER_TITLE,"yes") === "yes") {
|
|
$tw.dynannotate.selectionTracker = new SelectionTracker($tw.wiki);
|
|
}
|
|
if($tw.wiki.getTiddlerText(CONFIG_LEGACY_SELECTION_TRACKER_TITLE,"yes") === "yes") {
|
|
$tw.dynannotate.legacySelectionTracker = new LegacySelectionTracker($tw.wiki,{
|
|
allowBlankSelectionPopup: true
|
|
});
|
|
}
|
|
};
|
|
|
|
})();
|
|
|