|
|
|
@ -12,7 +12,7 @@ define([
|
|
|
|
|
'/common/notify.js',
|
|
|
|
|
'/bower_components/file-saver/FileSaver.min.js',
|
|
|
|
|
'/bower_components/jquery/dist/jquery.min.js',
|
|
|
|
|
], function (Config, Messages, TextPatcher, Listmap, Crypto, Cryptpad, Hyperjson, Renderer, Toolbar) {
|
|
|
|
|
], function (Config, Messages, TextPatcher, Listmap, Crypto, Cryptpad, Hyperjson, Renderer, Toolbar, Visible, Notify) {
|
|
|
|
|
var $ = window.jQuery;
|
|
|
|
|
|
|
|
|
|
var unlockHTML = '<i class="fa fa-unlock" aria-hidden="true"></i>';
|
|
|
|
@ -187,6 +187,9 @@ define([
|
|
|
|
|
|
|
|
|
|
/* Any time the realtime object changes, call this function */
|
|
|
|
|
var change = function (o, n, path, throttle) {
|
|
|
|
|
if (!Cryptpad.isArray(path)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (path && path.join) {
|
|
|
|
|
console.log("Change from [%s] to [%s] at [%s]",
|
|
|
|
|
o, n, path.join(', '));
|
|
|
|
@ -210,6 +213,7 @@ define([
|
|
|
|
|
|
|
|
|
|
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
|
|
|
|
|
*/
|
|
|
|
|
notify();
|
|
|
|
|
|
|
|
|
|
if (throttle) {
|
|
|
|
|
if (APP.throttled) { window.clearTimeout(APP.throttled); }
|
|
|
|
@ -391,6 +395,20 @@ define([
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var unnotify = function () {
|
|
|
|
|
if (APP.tabNotification &&
|
|
|
|
|
typeof(APP.tabNotification.cancel) === 'function') {
|
|
|
|
|
APP.tabNotification.cancel();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var notify = function () {
|
|
|
|
|
if (Visible.isSupported() && !Visible.currently()) {
|
|
|
|
|
unnotify();
|
|
|
|
|
APP.tabNotification = Notify.tab(1000, 10);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var userData = APP.userData = {}; // List of pretty names for all users (mapped with their ID)
|
|
|
|
|
var userList; // List of users still connected to the channel (server IDs)
|
|
|
|
|
var addToUserData = function(data) {
|
|
|
|
@ -575,6 +593,7 @@ define([
|
|
|
|
|
.on('change', ['info'], function (o, n, p) {
|
|
|
|
|
if (p[1] === 'title') {
|
|
|
|
|
updateTitle(n);
|
|
|
|
|
notify();
|
|
|
|
|
} else if (p[1] === "userData") {
|
|
|
|
|
addToUserData(APP.proxy.info.userData);
|
|
|
|
|
} else if (p[1] === 'description') {
|
|
|
|
@ -591,6 +610,7 @@ define([
|
|
|
|
|
el.selectionStart = selects[0];
|
|
|
|
|
el.selectionEnd = selects[1];
|
|
|
|
|
}
|
|
|
|
|
notify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("change: (%s, %s, [%s])", o, n, p.join(', '));
|
|
|
|
@ -600,6 +620,13 @@ define([
|
|
|
|
|
|
|
|
|
|
addToUserData(APP.proxy.info.userData);
|
|
|
|
|
|
|
|
|
|
if (Visible.isSupported()) {
|
|
|
|
|
Visible.onChange(function (yes) {
|
|
|
|
|
if (yes) { unnotify(); }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLastName(function (err, lastName) {
|
|
|
|
|
APP.ready = true;
|
|
|
|
|
|
|
|
|
|