|
|
@ -31,7 +31,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var secret = Cryptpad.getSecrets();
|
|
|
|
var secret = Cryptpad.getSecrets();
|
|
|
|
|
|
|
|
|
|
|
|
var module = window.APP = {
|
|
|
|
var APP = window.APP = {
|
|
|
|
TextPatcher: TextPatcher,
|
|
|
|
TextPatcher: TextPatcher,
|
|
|
|
Slide: Slide,
|
|
|
|
Slide: Slide,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -53,22 +53,22 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var unnotify = function () {
|
|
|
|
var unnotify = function () {
|
|
|
|
if (!(module.tabNofification &&
|
|
|
|
if (!(APP.tabNofification &&
|
|
|
|
typeof(module.tabNofification.cancel) === 'function')) { return; }
|
|
|
|
typeof(APP.tabNofification.cancel) === 'function')) { return; }
|
|
|
|
module.tabNofification.cancel();
|
|
|
|
APP.tabNofification.cancel();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var notify = function () {
|
|
|
|
var notify = function () {
|
|
|
|
if (!(Visible.isSupported() && !Visible.currently())) { return; }
|
|
|
|
if (!(Visible.isSupported() && !Visible.currently())) { return; }
|
|
|
|
unnotify();
|
|
|
|
unnotify();
|
|
|
|
module.tabNofification = Notify.tab(document.title, 1000, 10);
|
|
|
|
APP.tabNofification = Notify.tab(document.title, 1000, 10);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var $modal = $('#modal');
|
|
|
|
var $modal = $('#modal');
|
|
|
|
var $content = $('#content');
|
|
|
|
var $content = $('#content');
|
|
|
|
Slide.setModal($modal, $content);
|
|
|
|
Slide.setModal($modal, $content);
|
|
|
|
|
|
|
|
|
|
|
|
var config = module.config = {
|
|
|
|
var config = APP.config = {
|
|
|
|
initialState: '',
|
|
|
|
initialState: '',
|
|
|
|
websocketURL: Config.websocketURL,
|
|
|
|
websocketURL: Config.websocketURL,
|
|
|
|
channel: secret.channel,
|
|
|
|
channel: secret.channel,
|
|
|
@ -83,7 +83,7 @@ define([
|
|
|
|
var onLocal = config.onLocal = function () {
|
|
|
|
var onLocal = config.onLocal = function () {
|
|
|
|
if (initializing) { return; }
|
|
|
|
if (initializing) { return; }
|
|
|
|
var content = canonicalize($textarea.val());
|
|
|
|
var content = canonicalize($textarea.val());
|
|
|
|
module.patchText(content);
|
|
|
|
APP.patchText(content);
|
|
|
|
Slide.update(content);
|
|
|
|
Slide.update(content);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -230,7 +230,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var onRemote = config.onRemote = function (info) {
|
|
|
|
var onRemote = config.onRemote = function (info) {
|
|
|
|
if (initializing) { return; }
|
|
|
|
if (initializing) { return; }
|
|
|
|
var userDoc = module.realtime.getUserDoc();
|
|
|
|
var userDoc = APP.realtime.getUserDoc();
|
|
|
|
var content = canonicalize($textarea.val());
|
|
|
|
var content = canonicalize($textarea.val());
|
|
|
|
|
|
|
|
|
|
|
|
var op = TextPatcher.diff(content, userDoc);
|
|
|
|
var op = TextPatcher.diff(content, userDoc);
|
|
|
@ -250,8 +250,8 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onReady = config.onReady = function (info) {
|
|
|
|
var onReady = config.onReady = function (info) {
|
|
|
|
var realtime = module.realtime = info.realtime;
|
|
|
|
var realtime = APP.realtime = info.realtime;
|
|
|
|
module.patchText = TextPatcher.create({
|
|
|
|
APP.patchText = TextPatcher.create({
|
|
|
|
realtime: realtime
|
|
|
|
realtime: realtime
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|