let users know when changes have occurred while tabs lack focus
This commit is contained in:
parent
6075849ed7
commit
1ae212af44
@ -11,10 +11,12 @@ define([
|
|||||||
'/common/cryptpad-common.js',
|
'/common/cryptpad-common.js',
|
||||||
'/code/modes.js',
|
'/code/modes.js',
|
||||||
'/code/themes.js',
|
'/code/themes.js',
|
||||||
|
'/common/visible.js',
|
||||||
|
'/common/notify.js',
|
||||||
'/bower_components/file-saver/FileSaver.min.js',
|
'/bower_components/file-saver/FileSaver.min.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js',
|
'/bower_components/jquery/dist/jquery.min.js',
|
||||||
'/customize/pad.js'
|
'/customize/pad.js'
|
||||||
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Modes, Themes) {
|
], function (Config, /*RTCode,*/ Messages, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, Modes, Themes, Visible, Notify) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
var saveAs = window.saveAs;
|
var saveAs = window.saveAs;
|
||||||
var module = window.APP = {};
|
var module = window.APP = {};
|
||||||
@ -332,6 +334,12 @@ define([
|
|||||||
|
|
||||||
editor.setValue(newDoc);
|
editor.setValue(newDoc);
|
||||||
|
|
||||||
|
if (Visible.isSupported()) {
|
||||||
|
Visible.onChange(function (yes) {
|
||||||
|
if (yes) { unnotify(); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
initializing = false;
|
initializing = false;
|
||||||
};
|
};
|
||||||
@ -363,6 +371,20 @@ define([
|
|||||||
return cursor;
|
return cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 = config.onRemote = function (info) {
|
var onRemote = config.onRemote = function (info) {
|
||||||
if (initializing) { return; }
|
if (initializing) { return; }
|
||||||
|
|
||||||
@ -404,6 +426,8 @@ define([
|
|||||||
console.error("shjson2 !== shjson");
|
console.error("shjson2 !== shjson");
|
||||||
module.patchText(shjson2);
|
module.patchText(shjson2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notify();
|
||||||
};
|
};
|
||||||
|
|
||||||
var onAbort = config.onAbort = function (info) {
|
var onAbort = config.onAbort = function (info) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user