inform users of changes in /pad/ too
This commit is contained in:
@@ -12,12 +12,15 @@ define([
|
|||||||
'json.sortify',
|
'json.sortify',
|
||||||
'/bower_components/textpatcher/TextPatcher.amd.js',
|
'/bower_components/textpatcher/TextPatcher.amd.js',
|
||||||
'/common/cryptpad-common.js',
|
'/common/cryptpad-common.js',
|
||||||
|
'/common/visible.js',
|
||||||
|
'/common/notify.js',
|
||||||
'/bower_components/file-saver/FileSaver.min.js',
|
'/bower_components/file-saver/FileSaver.min.js',
|
||||||
'/bower_components/diff-dom/diffDOM.js',
|
'/bower_components/diff-dom/diffDOM.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js',
|
'/bower_components/jquery/dist/jquery.min.js',
|
||||||
'/customize/pad.js'
|
'/customize/pad.js'
|
||||||
], function (Config, Messages, Crypto, realtimeInput, Hyperjson,
|
], function (Config, Messages, Crypto, realtimeInput, Hyperjson,
|
||||||
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher, Cryptpad) {
|
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher, Cryptpad,
|
||||||
|
Visible, Notify) {
|
||||||
|
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
var saveAs = window.saveAs;
|
var saveAs = window.saveAs;
|
||||||
@@ -314,6 +317,20 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var unnotify = function () {
|
||||||
|
if (module.tabNotification &&
|
||||||
|
typeof(module.tabNotification.cancel) === 'function') {
|
||||||
|
module.tabNotification.cancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var notify = function () {
|
||||||
|
if (Visible.isSupported() && !Visible.currently()) {
|
||||||
|
unnotify();
|
||||||
|
module.tabNotification = Notify.tab(document.title, 1000, 10);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var onRemote = realtimeOptions.onRemote = function (info) {
|
var onRemote = realtimeOptions.onRemote = function (info) {
|
||||||
if (initializing) { return; }
|
if (initializing) { return; }
|
||||||
|
|
||||||
@@ -356,6 +373,7 @@ define([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
notify();
|
||||||
};
|
};
|
||||||
|
|
||||||
var getHTML = function (Dom) {
|
var getHTML = function (Dom) {
|
||||||
@@ -470,6 +488,12 @@ define([
|
|||||||
var shjson = info.realtime.getUserDoc();
|
var shjson = info.realtime.getUserDoc();
|
||||||
applyHjson(shjson);
|
applyHjson(shjson);
|
||||||
|
|
||||||
|
if (Visible.isSupported()) {
|
||||||
|
Visible.onChange(function (yes) {
|
||||||
|
if (yes) { unnotify(); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Unlocking editor");
|
console.log("Unlocking editor");
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
initializing = false;
|
initializing = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user