diff --git a/core/modules/syncer.js b/core/modules/syncer.js index 4916a2b09..e3539f90b 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -33,6 +33,7 @@ function Syncer(options) { var self = this; this.wiki = options.wiki; this.syncadaptor = options.syncadaptor; + this.disableUI = !!options.disableUI; this.titleIsLoggedIn = options.titleIsLoggedIn || this.titleIsLoggedIn; this.titleUserName = options.titleUserName || this.titleUserName; this.titleSyncFilter = options.titleSyncFilter || this.titleSyncFilter; @@ -57,7 +58,7 @@ function Syncer(options) { self.syncToServer(changes); }); // Browser event handlers - if($tw.browser) { + if($tw.browser && !this.disableUI) { // Set up our beforeunload handler $tw.addUnloadTask(function(event) { var confirmationMessage; @@ -79,9 +80,11 @@ function Syncer(options) { }); } // Listen out for lazyLoad events - this.wiki.addEventListener("lazyLoad",function(title) { - self.handleLazyLoadEvent(title); - }); + if(!this.disableUI) { + this.wiki.addEventListener("lazyLoad",function(title) { + self.handleLazyLoadEvent(title); + }); + } // Get the login status this.getStatus(function(err,isLoggedIn) { // Do a sync from the server @@ -134,7 +137,7 @@ Syncer.prototype.isDirty = function() { Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes */ Syncer.prototype.updateDirtyStatus = function() { - if($tw.browser) { + if($tw.browser && !this.disableUI) { $tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty()); } }; diff --git a/plugins/tiddlywiki/savetrail/savetrail.js b/plugins/tiddlywiki/savetrail/savetrail.js index c8247e0aa..69ef752a7 100644 --- a/plugins/tiddlywiki/savetrail/savetrail.js +++ b/plugins/tiddlywiki/savetrail/savetrail.js @@ -31,7 +31,8 @@ exports.startup = function() { wiki: $tw.wiki, syncadaptor: $tw.savetrail.syncadaptor, titleSyncFilter: SYNC_DRAFTS_FILTER_TIDDLER_TITLE, - logging: false + logging: false, + disableUI: true }); // Add hooks for trapping user actions $tw.hooks.addHook("th-saving-tiddler",function(tiddler) { @@ -126,7 +127,7 @@ function saveTiddlerFile(tiddler,options) { options = options || {}; var reason = options.reason || "changed", illegalFilenameCharacters = /<|>|\:|\"|\/|\\|\||\?|\*|\^|\s/g, - fixedTitle = tiddler.fields.title.replace(illegalFilenameCharacters,"_"), + fixedTitle = $tw.utils.transliterate(tiddler.fields.title).replace(illegalFilenameCharacters,"_"), formattedDate = $tw.utils.stringifyDate(new Date()), filename = fixedTitle + "." + formattedDate + "." + reason + ".json", fields = new Object();