diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index a4b7f4a4e..e2ac21361 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -197,8 +197,12 @@ SaverHandler.prototype.isDirty = function() { Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes */ SaverHandler.prototype.updateDirtyStatus = function() { + var self = this; if($tw.browser) { $tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty()); + $tw.utils.each($tw.windows,function(win) { + $tw.utils.toggleClass(win.document.body,"tc-dirty",self.isDirty()); + }); } }; diff --git a/core/modules/startup/windows.js b/core/modules/startup/windows.js index 5c867f74d..75786d026 100644 --- a/core/modules/startup/windows.js +++ b/core/modules/startup/windows.js @@ -19,7 +19,7 @@ exports.after = ["startup"]; exports.synchronous = true; // Global to keep track of open windows (hashmap by title) -var windows = {}; +$tw.windows = {}; exports.startup = function() { // Handle open window message @@ -44,7 +44,7 @@ exports.startup = function() { catch(e) { return; } - windows[title] = srcWindow; + $tw.windows[title] = srcWindow; // Check for reopening the same window if(srcWindow.haveInitialisedWindow) { return; @@ -54,7 +54,7 @@ exports.startup = function() { srcDocument.close(); srcDocument.title = windowTitle; srcWindow.addEventListener("beforeunload",function(event) { - delete windows[title]; + delete $tw.windows[title]; $tw.wiki.removeEventListener("change",refreshHandler); },false); // Set up the styles @@ -90,7 +90,7 @@ exports.startup = function() { }); // Close open windows when unloading main window $tw.addUnloadTask(function() { - $tw.utils.each(windows,function(win) { + $tw.utils.each($tw.windows,function(win) { win.close(); }); });