From 9dfe3ccaac69d8c9558d60b231c7810243bc35db Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Thu, 9 Feb 2017 12:48:06 +0100 Subject: [PATCH 1/5] Change 'jot it down' to 'write it down' in the front page --- customize.dist/index.html | 4 ++-- customize.dist/src/fragments/index.html | 4 ++-- customize.dist/translations/messages.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/customize.dist/index.html b/customize.dist/index.html index ceb2872a1..edb128920 100644 --- a/customize.dist/index.html +++ b/customize.dist/index.html @@ -115,8 +115,8 @@
-

-

+

+

User account diff --git a/customize.dist/src/fragments/index.html b/customize.dist/src/fragments/index.html index 2eb5ca6df..7cfcd0e13 100644 --- a/customize.dist/src/fragments/index.html +++ b/customize.dist/src/fragments/index.html @@ -48,8 +48,8 @@
-

-

+

+

User account diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 4f53c1a00..6d2faab1f 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -298,8 +298,8 @@ define(function () { out.main_howitworks = 'How It Works'; out.main_zeroKnowledge = 'Zero Knowledge'; out.main_zeroKnowledge_p = "You don't have to trust that we won't look at your pads, with CryptPad's revolutionary Zero Knowledge Technology we can't. Learn more about how we protect your Privacy and Security."; - out.main_jotItDown = 'Jot it down'; - out.main_jotItDown_p = "The greatest projects come from the smallest ideas. Take down the moments of inspiration and unexpected ideas because you never know which one might be a breakthrough."; + out.main_writeItDown = 'Write it down'; + out.main_writeItDown_p = "The greatest projects come from the smallest ideas. Take down the moments of inspiration and unexpected ideas because you never know which one might be a breakthrough."; out.main_share = 'Share the link, share the pad'; out.main_share_p = "Grow your ideas together: conduct efficient meetings, collaborate on TODO lists and make quick presentations with all your friends and all your devices."; out.main_organize = 'Get organized'; From fc3995054d4bd91b0a38556534a75c9ddea76b02 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 9 Feb 2017 12:56:05 +0100 Subject: [PATCH 2/5] Do not expose the store methods until it is ready --- customize.dist/fsStore.js | 211 +++++++++++++++++--------------------- 1 file changed, 94 insertions(+), 117 deletions(-) diff --git a/customize.dist/fsStore.js b/customize.dist/fsStore.js index bbf3d34e6..0eb620f0c 100644 --- a/customize.dist/fsStore.js +++ b/customize.dist/fsStore.js @@ -16,133 +16,116 @@ define([ */ var Store = {}; - var storeObj; - var ready = false; - var filesOp; - var exp = {}; + var store; - var safeSet = function (key, val) { - storeObj[key] = val; - }; + var initStore = function (filesOp, storeObj, exp) { + var ret = {}; - // Store uses nodebacks... - Store.set = function (key, val, cb) { - safeSet(key, val); - cb(); - }; + var safeSet = function (key, val) { + storeObj[key] = val; + }; - // implement in alternative store - Store.setBatch = function (map, cb) { - Object.keys(map).forEach(function (key) { - safeSet(key, map[key]); - }); - cb(void 0, map); - }; + // Store uses nodebacks... + ret.set = function (key, val, cb) { + safeSet(key, val); + cb(); + }; - Store.setDrive = function (key, val, cb) { - storeObj.drive[key] = val; - cb(); - }; + // implement in alternative store + ret.setBatch = function (map, cb) { + Object.keys(map).forEach(function (key) { + safeSet(key, map[key]); + }); + cb(void 0, map); + }; - var safeGet = window.safeGet = function (key) { - return storeObj[key]; - }; + ret.setDrive = function (key, val, cb) { + storeObj.drive[key] = val; + cb(); + }; - Store.get = function (key, cb) { - cb(void 0, safeGet(key)); - }; + var safeGet = function (key) { + return storeObj[key]; + }; - // implement in alternative store - Store.getBatch = function (keys, cb) { - var res = {}; - keys.forEach(function (key) { - res[key] = safeGet(key); - }); - cb(void 0, res); - }; + ret.get = function (key, cb) { + cb(void 0, safeGet(key)); + }; - Store.getDrive = function (key, cb) { - cb(void 0, storeObj.drive[key]); - }; + // implement in alternative store + ret.getBatch = function (keys, cb) { + var res = {}; + keys.forEach(function (key) { + res[key] = safeGet(key); + }); + cb(void 0, res); + }; - var safeRemove = function (key) { - delete storeObj[key]; - }; + ret.getDrive = function (key, cb) { + cb(void 0, storeObj.drive[key]); + }; - Store.remove = function (key, cb) { - safeRemove(key); - cb(); - }; + var safeRemove = function (key) { + delete storeObj[key]; + }; - // implement in alternative store - Store.removeBatch = function (keys, cb) { - keys.forEach(function (key) { + ret.remove = function (key, cb) { safeRemove(key); - }); - cb(); - }; + cb(); + }; - Store.keys = function (cb) { - cb(void 0, Object.keys(storeObj)); - }; + // implement in alternative store + ret.removeBatch = function (keys, cb) { + keys.forEach(function (key) { + safeRemove(key); + }); + cb(); + }; - Store.addPad = function (href, path, name) { - filesOp.addPad(href, path, name); - }; + ret.keys = function (cb) { + cb(void 0, Object.keys(storeObj)); + }; - Store.forgetPad = function (href, cb) { - filesOp.forgetPad(href); - cb(); - }; + ret.addPad = function (href, path, name) { + filesOp.addPad(href, path, name); + }; - Store.addTemplate = function (href) { - filesOp.addTemplate(href); - }; + ret.forgetPad = function (href, cb) { + filesOp.forgetPad(href); + cb(); + }; - Store.listTemplates = function () { - return filesOp.listTemplates(); - }; + ret.addTemplate = function (href) { + filesOp.addTemplate(href); + }; - Store.getProxy = function () { - return exp; - }; + ret.listTemplates = function () { + return filesOp.listTemplates(); + }; - Store.getLoginName = function () { - return storeObj.login_name; - }; + ret.getProxy = function () { + return exp; + }; - var changeHandlers = Store.changeHandlers = []; + ret.getLoginName = function () { + return storeObj.login_name; + }; - Store.change = function (f) { - if (typeof(f) !== 'function') { - throw new Error('[Store.change] callback must be a function'); - } - changeHandlers.push(f); - - if (changeHandlers.length === 1) { - // start listening for changes -/* TODO: listen for changes in the proxy - window.addEventListener('storage', function (e) { - changeHandlers.forEach(function (f) { - f({ - key: e.key, - oldValue: e.oldValue, - newValue: e.newValue, - }); - }); - }); -*/ - } + var changeHandlers = ret.changeHandlers = []; + + ret.change = function (f) {}; + + return ret; }; - var onReady = function (f, proxy, storageKey) { - filesOp = FO.init(proxy.drive, { + var onReady = function (f, proxy, storageKey, exp) { + var fo = FO.init(proxy.drive, { storageKey: storageKey }); - storeObj = proxy; - ready = true; + //storeObj = proxy; + store = initStore(fo, proxy, exp); if (typeof(f) === 'function') { - f(void 0, Store); + f(void 0, store); } }; @@ -167,6 +150,8 @@ define([ logLevel: 1, }; + var exp = {}; + window.addEventListener('storage', function (e) { var key = e.key; if (e.key !== Cryptpad.userHashKey) { return; } @@ -175,8 +160,6 @@ define([ if (!o && n) { window.location.reload(); } else if (o && !n) { - //window.location.reload(); - //window.location.href = '/'; $(window).on('keyup', function (e) { if (e.keyCode === 27) { Cryptpad.removeLoadingScreen(); @@ -192,6 +175,7 @@ define([ }); var rt = window.rt = Listmap.create(listmapConfig); + exp.proxy = rt.proxy; rt.proxy.on('create', function (info) { exp.info = info; @@ -199,7 +183,7 @@ define([ localStorage.FS_hash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys); } }).on('ready', function () { - if (ready) { return; } + if (store) { return; } // the store is already ready, it is a reconnection if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; } var drive = rt.proxy.drive; // Creating a new anon drive: import anon pads from localStorage @@ -207,36 +191,29 @@ define([ var oldStore = Cryptpad.getStore(true); Cryptpad.getRecentPads(function (err, s) { drive[Cryptpad.storageKey] = s; - onReady(f, rt.proxy, Cryptpad.storageKey); + onReady(f, rt.proxy, Cryptpad.storageKey, exp); }, true); return; } - onReady(f, rt.proxy, Cryptpad.storageKey); + // Return the existing drive + onReady(f, rt.proxy, Cryptpad.storageKey, exp); }) .on('disconnect', function (info) { - //setEditable(false); + // We only manage errors during the loadin screen here. Other websocket errors are handled by the apps if (info.error) { - //Cryptpad.alert(Messages.websocketError); if (typeof Cryptpad.storeError === "function") { Cryptpad.storeError(); } return; } - //Cryptpad.alert(Messages.common_connectionLost); }); }; Store.ready = function (f, Cryptpad) { - /*if (Cryptpad.parsePadUrl(window.location.href).type === "file") { - if (typeof(f) === 'function') { - f(void 0, Cryptpad.getStore(true)); - } - return; - }*/ - if (ready) { + if (store) { // Store.ready probably called twice, store already ready if (typeof(f) === 'function') { - f(void 0, Store); + f(void 0, store); } } else { init(f, Cryptpad); From 342cb44cf79c8191189f88496c80e7fcc2c9230c Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 9 Feb 2017 12:58:08 +0100 Subject: [PATCH 3/5] Ability to migrate a anon drive directly from the drive --- www/drive/main.js | 52 +++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/www/drive/main.js b/www/drive/main.js index 6cbad00ec..83fc6eb26 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -9,8 +9,9 @@ define([ '/common/cryptpad-common.js', '/common/fileObject.js', '/common/toolbar.js', - '/customize/application_config.js' -], function (Config, Listmap, Crypto, TextPatcher, Messages, JSONSortify, Cryptpad, FO, Toolbar, AppConfig) { + '/customize/application_config.js', + '/common/cryptget.js' +], function (Config, Listmap, Crypto, TextPatcher, Messages, JSONSortify, Cryptpad, FO, Toolbar, AppConfig, Get) { var module = window.MODULE = {}; var $ = window.jQuery; @@ -1854,6 +1855,31 @@ define([ }); }; + // TODO: move that function and use a more generic API + var migrateAnonDrive = function (proxy, cb) { + if (sessionStorage.migrateAnonDrive) { + // Make sure we have an FS_hash and we don't use it, otherwise just stop the migration and cb + if (!localStorage.FS_hash || !APP.loggedIn) { + delete sessionStorage.migrateAnonDrive; + if (typeof(cb) === "function") { cb(); } + } + // Get the content of FS_hash and then merge the objects, remove the migration key and cb + var todo = function (err, doc) { + if (err) { logError("Cannot migrate recent pads", err); return; } + var parsed; + try { parsed = JSON.parse(doc); } catch (e) { logError("Cannot parsed recent pads", e); } + if (parsed) { + $.extend(true, proxy, parsed); + } + delete sessionStorage.migrateAnonDrive; + if (typeof(cb) === "function") { cb(); } + }; + Get.get(localStorage.FS_hash, todo); + } else { + if (typeof(cb) === "function") { cb(); } + } + }; + // don't initialize until the store is ready. Cryptpad.ready(function () { APP.$bar = $iframe.find('#toolbar'); @@ -1950,23 +1976,13 @@ define([ }; var onReady = function () { module.files = proxy; - if (JSON.stringify(proxy) === '{}') { - var store = Cryptpad.getStore(true); - var drive = proxy.drive = {}; - store.get(Cryptpad.storageKey, function (err, s) { - drive[FILES_DATA] = s; - initLocalStorage(); - init(proxy); - APP.userList.onChange(); - Cryptpad.removeLoadingScreen(); - }); - return; - } if (!proxy.drive || typeof(proxy.drive) !== 'object') { proxy.drive = {}; } - initLocalStorage(); - init(proxy); - APP.userList.onChange(); - Cryptpad.removeLoadingScreen(); + migrateAnonDrive(proxy, function () { + initLocalStorage(); + init(proxy); + APP.userList.onChange(); + Cryptpad.removeLoadingScreen(); + }); }; var onDisconnect = function (info) { setEditable(false); From f8366e0cfc6b1d1a60f7c4901910c43e500b75dc Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 9 Feb 2017 15:23:09 +0100 Subject: [PATCH 4/5] Remove support for legacy store and add a way to import legacy pads --- customize.dist/application_config.js | 3 - customize.dist/fsStore.js | 11 +- www/common/cryptpad-common.js | 204 +++++++++++---------------- 3 files changed, 85 insertions(+), 133 deletions(-) diff --git a/customize.dist/application_config.js b/customize.dist/application_config.js index e391134eb..f1cbcb090 100644 --- a/customize.dist/application_config.js +++ b/customize.dist/application_config.js @@ -12,8 +12,5 @@ define(function() { */ config.notificationTimeout = 5000; - config.USE_FS_STORE = true; - config.USE_HOMEPAGE_TABLE = false; - return config; }); diff --git a/customize.dist/fsStore.js b/customize.dist/fsStore.js index 0eb620f0c..34c77616d 100644 --- a/customize.dist/fsStore.js +++ b/customize.dist/fsStore.js @@ -188,18 +188,17 @@ define([ var drive = rt.proxy.drive; // Creating a new anon drive: import anon pads from localStorage if (!drive[Cryptpad.storageKey] || !Cryptpad.isArray(drive[Cryptpad.storageKey])) { - var oldStore = Cryptpad.getStore(true); - Cryptpad.getRecentPads(function (err, s) { - drive[Cryptpad.storageKey] = s; + Cryptpad.getLegacyPads(function (err, data) { + drive[Cryptpad.storageKey] = data; onReady(f, rt.proxy, Cryptpad.storageKey, exp); - }, true); + }); return; } - // Return the existing drive + // Drive already exist: return the existing drive, don't load data from legacy store onReady(f, rt.proxy, Cryptpad.storageKey, exp); }) .on('disconnect', function (info) { - // We only manage errors during the loadin screen here. Other websocket errors are handled by the apps + // We only manage errors during the loading screen here. Other websocket errors are handled by the apps if (info.error) { if (typeof Cryptpad.storeError === "function") { Cryptpad.storeError(); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index ff2943c16..bc41fc4e5 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1,7 +1,7 @@ define([ '/api/config?cb=' + Math.random().toString(16).slice(2), '/customize/messages.js', - '/customize/store.js', + '/customize/fsStore.js', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/alertifyjs/dist/js/alertify.js', '/bower_components/spin.js/spin.min.js', @@ -10,7 +10,7 @@ define([ '/customize/application_config.js', '/bower_components/jquery/dist/jquery.min.js', -], function (Config, Messages, Store, Crypto, Alertify, Spinner, Clipboard, FS, AppConfig) { +], function (Config, Messages, Store, Crypto, Alertify, Spinner, Clipboard, AppConfig) { /* This file exposes functionality which is specific to Cryptpad, but not to any particular pad type. This includes functions for committing metadata about pads to your local storage for future use and improved usability. @@ -19,18 +19,11 @@ define([ */ var $ = window.jQuery; - // When set to true, USE_FS_STORE becomes the default store, but the localStorage store is - // still loaded for migration purpose. When false, the localStorage is used. - var USE_FS_STORE = AppConfig.USE_FS_STORE; - - var storeToUse = USE_FS_STORE ? FS : Store; - var common = window.Cryptpad = { Messages: Messages, Alertify: Alertify, }; var store; - var fsStore; var find = common.find = function (map, path) { return (map && path.reduce(function (p, n) { @@ -38,15 +31,14 @@ define([ }, map)); }; - var getStore = common.getStore = function (legacy) { - if ((!USE_FS_STORE || legacy) && store) { return store; } - if (USE_FS_STORE && !legacy && fsStore) { return fsStore; } + var getStore = common.getStore = function () { + if (store) { return store; } throw new Error("Store is not ready!"); }; var getNetwork = common.getNetwork = function () { - if (USE_FS_STORE && fsStore) { - if (fsStore.getProxy() && fsStore.getProxy().info) { - return fsStore.getProxy().info.network; + if (store) { + if (store.getProxy() && store.getProxy().info) { + return store.getProxy().info.network; } } return; @@ -131,7 +123,6 @@ define([ }; var isLoggedIn = common.isLoggedIn = function () { - //return typeof getStore().getLoginName() === "string"; return typeof getUserHash() === "string"; }; @@ -373,6 +364,23 @@ define([ }); }; + // Get the pads from localStorage to migrate them to the object store + var getLegacyPads = common.getLegacyPads = function (cb) { + require(['/customize/store.js'], function(Legacy) { + Legacy.ready(function (err, legacy) { + if (err) { cb(err, null); return; } + Legacy.get(storageKey, function (err2, recentPads) { + if (err2) { cb(err2, null); return; } + if (isArray(recentPads)) { + cb(void 0, migrateRecentPads(recentPads)); + return; + } + cb(void 0, []); + }); + }); + }); + }; + var getHash = common.getHash = function () { return window.location.hash.slice(1); }; @@ -446,13 +454,13 @@ define([ }; // STORAGE - var setPadAttribute = common.setPadAttribute = function (attr, value, cb, legacy) { - getStore(legacy).setDrive([getHash(), attr].join('.'), value, function (err, data) { + var setPadAttribute = common.setPadAttribute = function (attr, value, cb) { + getStore().setDrive([getHash(), attr].join('.'), value, function (err, data) { cb(err, data); }); }; - var setAttribute = common.setAttribute = function (attr, value, cb, legacy) { - getStore(legacy).set(["cryptpad", attr].join('.'), value, function (err, data) { + var setAttribute = common.setAttribute = function (attr, value, cb) { + getStore().set(["cryptpad", attr].join('.'), value, function (err, data) { cb(err, data); }); }; @@ -461,13 +469,13 @@ define([ }; // STORAGE - var getPadAttribute = common.getPadAttribute = function (attr, cb, legacy) { - getStore(legacy).getDrive([getHash(), attr].join('.'), function (err, data) { + var getPadAttribute = common.getPadAttribute = function (attr, cb) { + getStore().getDrive([getHash(), attr].join('.'), function (err, data) { cb(err, data); }); }; - var getAttribute = common.getAttribute = function (attr, cb, legacy) { - getStore(legacy).get(["cryptpad", attr].join('.'), function (err, data) { + var getAttribute = common.getAttribute = function (attr, cb) { + getStore().get(["cryptpad", attr].join('.'), function (err, data) { cb(err, data); }); }; @@ -493,12 +501,8 @@ define([ // STORAGE /* fetch and migrate your pad history from localStorage */ - var getRecentPads = common.getRecentPads = function (cb, legacy) { - var sstore = getStore(legacy); - if (legacy) { - sstore.getDrive = sstore.get; - } - sstore.getDrive(storageKey, function (err, recentPads) { + var getRecentPads = common.getRecentPads = function (cb) { + getStore().getDrive(storageKey, function (err, recentPads) { if (isArray(recentPads)) { cb(void 0, migrateRecentPads(recentPads)); return; @@ -509,21 +513,14 @@ define([ // STORAGE /* commit a list of pads to localStorage */ - var setRecentPads = common.setRecentPads = function (pads, cb, legacy) { - var sstore = getStore(legacy); - if (legacy) { - sstore.setDrive = sstore.set; - } - sstore.setDrive(storageKey, pads, function (err, data) { + var setRecentPads = common.setRecentPads = function (pads, cb) { + getStore().setDrive(storageKey, pads, function (err, data) { cb(err, data); }); }; // STORAGE - var forgetFSPad = function (href, cb) { - getStore().forgetPad(href, cb); - }; - var forgetPad = common.forgetPad = function (href, cb, legacy) { + var forgetPad = common.forgetPad = function (href, cb) { var parsed = parsePadUrl(href); var callback = function (err, data) { @@ -532,7 +529,7 @@ define([ return; } - getStore(legacy).keys(function (err, keys) { + getStore().keys(function (err, keys) { if (err) { cb(err); return; @@ -545,35 +542,14 @@ define([ cb(); return; } - getStore(legacy).removeBatch(toRemove, function (err, data) { + getStore().removeBatch(toRemove, function (err, data) { cb(err, data); }); }); }; - if (USE_FS_STORE && !legacy) { - // TODO implement forgetPad in store.js - forgetFSPad(href, callback); - return; - } - - getRecentPads(function (err, recentPads) { - setRecentPads(recentPads.filter(function (pad) { - var p = parsePadUrl(pad.href); - // find duplicates - if (parsed.hash === p.hash && parsed.type === p.type) { - console.log("Found a duplicate"); - return; - } - return true; - }), callback, legacy); - }, legacy); - - - - if (typeof(getStore(legacy).forgetPad) === "function") { - // TODO implement forgetPad in store.js - getStore(legacy).forgetPad(href, callback); + if (typeof(getStore().forgetPad) === "function") { + getStore().forgetPad(href, callback); } }; @@ -626,7 +602,7 @@ define([ if (!contains) { var data = makePad(href, name); renamed.push(data); - if (USE_FS_STORE && typeof(getStore().addPad) === "function") { + if (typeof(getStore().addPad) === "function") { getStore().addPad(href, common.initialPath, common.initialName || name); } } @@ -701,58 +677,47 @@ define([ f(void 0, env); }; - var todo = function () { - storeToUse.ready(function (err, store) { - common.store = env.store = store; - if (USE_FS_STORE) { - fsStore = store; - } + Store.ready(function (err, storeObj) { + store = common.store = env.store = storeObj; + + $(function() { + // Race condition : if document.body is undefined when alertify.js is loaded, Alertify + // won't work. We have to reset it now to make sure it uses a correct "body" + Alertify.reset(); + + // Load the new pad when the hash has changed + var oldHash = document.location.hash.slice(1); + window.onhashchange = function () { + var newHash = document.location.hash.slice(1); + var parsedOld = parseHash(oldHash); + var parsedNew = parseHash(newHash); + if (parsedOld && parsedNew && ( + parsedOld.channel !== parsedNew.channel + || parsedOld.mode !== parsedNew.mode + || parsedOld.key !== parsedNew.key)) { + document.location.reload(); + return; + } + if (parsedNew) { + oldHash = newHash; + } + }; - $(function() { - // Race condition : if document.body is undefined when alertify.js is loaded, Alertify - // won't work. We have to reset it now to make sure it uses a correct "body" - Alertify.reset(); - - // Load the new pad when the hash has changed - var oldHash = document.location.hash.slice(1); - window.onhashchange = function () { - var newHash = document.location.hash.slice(1); - var parsedOld = parseHash(oldHash); - var parsedNew = parseHash(newHash); - if (parsedOld && parsedNew && ( - parsedOld.channel !== parsedNew.channel - || parsedOld.mode !== parsedNew.mode - || parsedOld.key !== parsedNew.key)) { - document.location.reload(); - return; - } - if (parsedNew) { - oldHash = newHash; - } - }; - - // Everything's ready, continue... - if($('#pad-iframe').length) { - var $iframe = $('#pad-iframe'); - var iframe = $iframe[0]; - var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; - if (iframeDoc.readyState === 'complete') { - cb(); - return; - } - $iframe.load(cb); + // Everything's ready, continue... + if($('#pad-iframe').length) { + var $iframe = $('#pad-iframe'); + var iframe = $iframe[0]; + var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; + if (iframeDoc.readyState === 'complete') { + cb(); return; } - cb(); - }); - }, common); - }; - // If we use the fs store, make sure the localStorage or iframe store is ready - if (USE_FS_STORE) { - Store.ready(todo); - return; - } - todo(); + $iframe.load(cb); + return; + } + cb(); + }); + }, common); }; var errorHandlers = []; @@ -1263,15 +1228,6 @@ define([ }; }; - // All code which is called implicitly is found below - Store.ready(function (err, Store) { - if (err) { - console.error(err); - return; - } - store = Store; - }); - $(function () { Messages._applyTranslation(); }); From d54262c8df275b0483fc9a1c9462856ce4330906 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 9 Feb 2017 15:34:14 +0100 Subject: [PATCH 5/5] Use the same disconnecter error translation key for all the apps --- customize.dist/translations/messages.de.js | 2 -- customize.dist/translations/messages.es.js | 2 -- customize.dist/translations/messages.fr.js | 2 -- customize.dist/translations/messages.js | 2 -- customize.dist/translations/messages.pl.js | 2 -- customize.dist/translations/messages.pt-br.js | 2 -- www/code/main.js | 4 ++-- www/pad/main.js | 4 ++-- www/slide/main.js | 4 ++-- 9 files changed, 6 insertions(+), 18 deletions(-) diff --git a/customize.dist/translations/messages.de.js b/customize.dist/translations/messages.de.js index 8b1139836..5915b4684 100644 --- a/customize.dist/translations/messages.de.js +++ b/customize.dist/translations/messages.de.js @@ -103,8 +103,6 @@ out.notifyRenamed = "{0} heißt nun {1}"; out.notifyLeft = "{0} hat die gemeinsame Sitzung verlassen"; - out.disconnectAlert = 'Netzwerkverbindung verloren!'; - out.tryIt = 'Probier\'s aus!'; out.recentPads = 'Deine letzten Pads (diese Liste ist nur in deinem Browser gespeichert))'; diff --git a/customize.dist/translations/messages.es.js b/customize.dist/translations/messages.es.js index e6f8460bb..be6f87b29 100644 --- a/customize.dist/translations/messages.es.js +++ b/customize.dist/translations/messages.es.js @@ -100,8 +100,6 @@ define(function () { out.notifyRenamed = "{0} ahora se conoce como {1}"; out.notifyLeft = "{0} ha dejado la sesión de colaboración"; - out.disconnectAlert = '¡Conexión a la red perdida!'; - out.tryIt = '¡PROBARLO!'; out.recentPads = 'Tus documentos recientes (almacenadas solo en el navegador)'; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 1bc60132e..cdd927e7f 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -118,8 +118,6 @@ define(function () { out.notifyRenamed = "{0} a changé son nom en {1}"; out.notifyLeft = "{0} a quitté la session collaborative"; - out.disconnectAlert = 'Perte de la connexion au réseau !'; - out.okButton = 'OK (Entrée)'; out.cancel = "Annuler"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index ee09575e7..ee121edb3 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -122,8 +122,6 @@ define(function () { out.notifyRenamed = "{0} is now known as {1}"; out.notifyLeft = "{0} has left the collaborative session"; - out.disconnectAlert = 'Network connection lost!'; - out.okButton = 'OK (enter)'; out.cancel = "Cancel"; diff --git a/customize.dist/translations/messages.pl.js b/customize.dist/translations/messages.pl.js index 65e0c2abf..de4a20a38 100644 --- a/customize.dist/translations/messages.pl.js +++ b/customize.dist/translations/messages.pl.js @@ -102,8 +102,6 @@ define(function () { out.notifyRenamed = "{0} jest teraz znany jako {1}"; out.notifyLeft = "{0} opuścił sesję współpracy"; - out.disconnectAlert = 'Utracono połączenie sieciowe!'; - out.tryIt = 'Wypróbuj!'; out.recentPads = 'Ostatnio otwarte dokumenty (przechowywane jedynie w twojej przeglądarce)'; diff --git a/customize.dist/translations/messages.pt-br.js b/customize.dist/translations/messages.pt-br.js index a2aaec567..ba737b62f 100644 --- a/customize.dist/translations/messages.pt-br.js +++ b/customize.dist/translations/messages.pt-br.js @@ -110,8 +110,6 @@ define(function () { out.notifyRenamed = "{0} agora é conhecido como {1}"; out.notifyLeft = "{0} deixou essa sessão colaborativa"; - out.disconnectAlert = 'Conexão de rede perdida!'; - out.tryIt = 'Experimente!'; out.recentPads = 'Seu bloco de nota recente (armazenado em seu navegador)'; diff --git a/www/code/main.js b/www/code/main.js index ba1208a2d..92c63560c 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -699,7 +699,7 @@ define([ // inform of network disconnect setEditable(false); toolbar.failed(); - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); }; var onConnectionChange = config.onConnectionChange = function (info) { @@ -710,7 +710,7 @@ define([ toolbar.reconnecting(info.myId); Cryptpad.findOKButton().click(); } else { - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); } }; diff --git a/www/pad/main.js b/www/pad/main.js index 34a587afa..4ad0c207e 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -739,7 +739,7 @@ define([ setEditable(false); // TODO inform them that the session was torn down toolbar.failed(); - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); }; var onConnectionChange = realtimeOptions.onConnectionChange = function (info) { @@ -750,7 +750,7 @@ define([ toolbar.reconnecting(info.myId); Cryptpad.findOKButton().click(); } else { - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); } }; diff --git a/www/slide/main.js b/www/slide/main.js index 226e0249e..7c75a42ce 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -782,7 +782,7 @@ define([ // inform of network disconnect setEditable(false); toolbar.failed(); - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); }; var onConnectionChange = config.onConnectionChange = function (info) { @@ -793,7 +793,7 @@ define([ toolbar.reconnecting(info.myId); Cryptpad.findOKButton().click(); } else { - Cryptpad.alert(Messages.disconnectAlert); + Cryptpad.alert(Messages.common_connectionLost); } };