|
|
|
@ -37,7 +37,7 @@ define([ |
|
|
|
secret.keys = secret.key; |
|
|
|
} |
|
|
|
|
|
|
|
var onConnectError = function (info) { |
|
|
|
var onConnectError = function () { |
|
|
|
Cryptpad.errorLoadingScreen(Messages.websocketError); |
|
|
|
}; |
|
|
|
|
|
|
|
@ -50,7 +50,6 @@ define([ |
|
|
|
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox'); |
|
|
|
var parsedHash = Cryptpad.parsePadUrl(window.location.href); |
|
|
|
var defaultName = Cryptpad.getDefaultName(parsedHash); |
|
|
|
var initialState = Messages.codeInitialState; |
|
|
|
|
|
|
|
var isHistoryMode = false; |
|
|
|
|
|
|
|
@ -172,10 +171,10 @@ define([ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var isDefaultTitle = function () { |
|
|
|
/* var isDefaultTitle = function () { |
|
|
|
var parsed = Cryptpad.parsePadUrl(window.location.href); |
|
|
|
return Cryptpad.isDefaultName(parsed, document.title); |
|
|
|
}; |
|
|
|
};*/ |
|
|
|
|
|
|
|
var initializing = true; |
|
|
|
|
|
|
|
@ -226,7 +225,7 @@ define([ |
|
|
|
uid: Cryptpad.getUid(), |
|
|
|
}; |
|
|
|
addToUserData(myData); |
|
|
|
Cryptpad.setAttribute('username', myUserName, function (err, data) { |
|
|
|
Cryptpad.setAttribute('username', myUserName, function (err) { |
|
|
|
if (err) { |
|
|
|
console.log("Couldn't set username"); |
|
|
|
console.error(err); |
|
|
|
@ -378,7 +377,7 @@ define([ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var onInit = config.onInit = function (info) { |
|
|
|
config.onInit = function (info) { |
|
|
|
userList = info.userList; |
|
|
|
|
|
|
|
var configTb = { |
|
|
|
@ -407,12 +406,9 @@ define([ |
|
|
|
toolbar = module.toolbar = Toolbar.create(configTb); |
|
|
|
|
|
|
|
var $rightside = $bar.find('.' + Toolbar.constants.rightside); |
|
|
|
var $userBlock = $bar.find('.' + Toolbar.constants.username); |
|
|
|
var $usernameButton = module.$userNameButton = $($bar.find('.' + Toolbar.constants.changeUsername)); |
|
|
|
module.$userNameButton = $($bar.find('.' + Toolbar.constants.changeUsername)); |
|
|
|
|
|
|
|
var editHash; |
|
|
|
var viewHash = Cryptpad.getViewHashFromKeys(info.channel, secret.keys); |
|
|
|
|
|
|
|
if (!readOnly) { |
|
|
|
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys); |
|
|
|
} |
|
|
|
@ -475,7 +471,7 @@ define([ |
|
|
|
} |
|
|
|
|
|
|
|
/* add a forget button */ |
|
|
|
var forgetCb = function (err, title) { |
|
|
|
var forgetCb = function (err) { |
|
|
|
if (err) { return; } |
|
|
|
setEditable(false); |
|
|
|
}; |
|
|
|
@ -502,9 +498,7 @@ define([ |
|
|
|
isSelect: true, |
|
|
|
}; |
|
|
|
var $block = module.$language = Cryptpad.createDropdown(dropdownConfig); |
|
|
|
var $button = $block.find('.buttonTitle'); |
|
|
|
|
|
|
|
$block.find('a').click(function (e) { |
|
|
|
$block.find('a').click(function () { |
|
|
|
setMode($(this).attr('data-value'), $block); |
|
|
|
onLocal(); |
|
|
|
}); |
|
|
|
@ -537,11 +531,10 @@ define([ |
|
|
|
initialValue: lastTheme |
|
|
|
}; |
|
|
|
var $block = module.$theme = Cryptpad.createDropdown(dropdownConfig); |
|
|
|
var $button = $block.find('.buttonTitle'); |
|
|
|
|
|
|
|
setTheme(lastTheme, $block); |
|
|
|
|
|
|
|
$block.find('a').click(function (e) { |
|
|
|
$block.find('a').click(function () { |
|
|
|
var theme = $(this).attr('data-value'); |
|
|
|
setTheme(theme, $block); |
|
|
|
localStorage.setItem(themeKey, theme); |
|
|
|
@ -579,7 +572,7 @@ define([ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var onReady = config.onReady = function (info) { |
|
|
|
config.onReady = function (info) { |
|
|
|
module.users = info.userList.users; |
|
|
|
if (module.realtime !== info.realtime) { |
|
|
|
var realtime = module.realtime = info.realtime; |
|
|
|
@ -693,7 +686,7 @@ define([ |
|
|
|
return cursor; |
|
|
|
}; |
|
|
|
|
|
|
|
var onRemote = config.onRemote = function () { |
|
|
|
config.onRemote = function () { |
|
|
|
if (initializing) { return; } |
|
|
|
if (isHistoryMode) { return; } |
|
|
|
var scroll = editor.getScrollInfo(); |
|
|
|
@ -748,14 +741,14 @@ define([ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var onAbort = config.onAbort = function (info) { |
|
|
|
config.onAbort = function () { |
|
|
|
// inform of network disconnect
|
|
|
|
setEditable(false); |
|
|
|
toolbar.failed(); |
|
|
|
Cryptpad.alert(Messages.common_connectionLost, undefined, true); |
|
|
|
}; |
|
|
|
|
|
|
|
var onConnectionChange = config.onConnectionChange = function (info) { |
|
|
|
config.onConnectionChange = function (info) { |
|
|
|
setEditable(info.state); |
|
|
|
toolbar.failed(); |
|
|
|
if (info.state) { |
|
|
|
@ -767,9 +760,9 @@ define([ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var onError = config.onError = onConnectError; |
|
|
|
config.onError = onConnectError; |
|
|
|
|
|
|
|
var realtime = module.realtime = Realtime.start(config); |
|
|
|
module.realtime = Realtime.start(config); |
|
|
|
|
|
|
|
editor.on('change', onLocal); |
|
|
|
|
|
|
|
@ -779,7 +772,7 @@ define([ |
|
|
|
var interval = 100; |
|
|
|
|
|
|
|
var second = function (CM) { |
|
|
|
Cryptpad.ready(function (err, env) { |
|
|
|
Cryptpad.ready(function () { |
|
|
|
andThen(CM); |
|
|
|
Cryptpad.reportAppUsage(); |
|
|
|
}); |
|
|
|
|