jshint compliance
This commit is contained in:
parent
1864dac84f
commit
a0c420af8e
@ -11,3 +11,5 @@ NetFluxWebsocketServer.js
|
|||||||
WebRTCSrv.js
|
WebRTCSrv.js
|
||||||
www/common/media-tag.js
|
www/common/media-tag.js
|
||||||
www/scratch
|
www/scratch
|
||||||
|
|
||||||
|
www/common/toolbar.js
|
||||||
|
|||||||
@ -37,7 +37,7 @@ define([
|
|||||||
secret.keys = secret.key;
|
secret.keys = secret.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
var onConnectError = function (info) {
|
var onConnectError = function () {
|
||||||
Cryptpad.errorLoadingScreen(Messages.websocketError);
|
Cryptpad.errorLoadingScreen(Messages.websocketError);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +50,6 @@ define([
|
|||||||
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
|
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
|
||||||
var parsedHash = Cryptpad.parsePadUrl(window.location.href);
|
var parsedHash = Cryptpad.parsePadUrl(window.location.href);
|
||||||
var defaultName = Cryptpad.getDefaultName(parsedHash);
|
var defaultName = Cryptpad.getDefaultName(parsedHash);
|
||||||
var initialState = Messages.codeInitialState;
|
|
||||||
|
|
||||||
var isHistoryMode = false;
|
var isHistoryMode = false;
|
||||||
|
|
||||||
@ -172,10 +171,10 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var isDefaultTitle = function () {
|
/* var isDefaultTitle = function () {
|
||||||
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
||||||
return Cryptpad.isDefaultName(parsed, document.title);
|
return Cryptpad.isDefaultName(parsed, document.title);
|
||||||
};
|
};*/
|
||||||
|
|
||||||
var initializing = true;
|
var initializing = true;
|
||||||
|
|
||||||
@ -226,7 +225,7 @@ define([
|
|||||||
uid: Cryptpad.getUid(),
|
uid: Cryptpad.getUid(),
|
||||||
};
|
};
|
||||||
addToUserData(myData);
|
addToUserData(myData);
|
||||||
Cryptpad.setAttribute('username', myUserName, function (err, data) {
|
Cryptpad.setAttribute('username', myUserName, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log("Couldn't set username");
|
console.log("Couldn't set username");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@ -378,7 +377,7 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onInit = config.onInit = function (info) {
|
config.onInit = function (info) {
|
||||||
userList = info.userList;
|
userList = info.userList;
|
||||||
|
|
||||||
var configTb = {
|
var configTb = {
|
||||||
@ -407,12 +406,9 @@ define([
|
|||||||
toolbar = module.toolbar = Toolbar.create(configTb);
|
toolbar = module.toolbar = Toolbar.create(configTb);
|
||||||
|
|
||||||
var $rightside = $bar.find('.' + Toolbar.constants.rightside);
|
var $rightside = $bar.find('.' + Toolbar.constants.rightside);
|
||||||
var $userBlock = $bar.find('.' + Toolbar.constants.username);
|
module.$userNameButton = $($bar.find('.' + Toolbar.constants.changeUsername));
|
||||||
var $usernameButton = module.$userNameButton = $($bar.find('.' + Toolbar.constants.changeUsername));
|
|
||||||
|
|
||||||
var editHash;
|
var editHash;
|
||||||
var viewHash = Cryptpad.getViewHashFromKeys(info.channel, secret.keys);
|
|
||||||
|
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
||||||
}
|
}
|
||||||
@ -475,7 +471,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add a forget button */
|
/* add a forget button */
|
||||||
var forgetCb = function (err, title) {
|
var forgetCb = function (err) {
|
||||||
if (err) { return; }
|
if (err) { return; }
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
};
|
};
|
||||||
@ -502,9 +498,7 @@ define([
|
|||||||
isSelect: true,
|
isSelect: true,
|
||||||
};
|
};
|
||||||
var $block = module.$language = Cryptpad.createDropdown(dropdownConfig);
|
var $block = module.$language = Cryptpad.createDropdown(dropdownConfig);
|
||||||
var $button = $block.find('.buttonTitle');
|
$block.find('a').click(function () {
|
||||||
|
|
||||||
$block.find('a').click(function (e) {
|
|
||||||
setMode($(this).attr('data-value'), $block);
|
setMode($(this).attr('data-value'), $block);
|
||||||
onLocal();
|
onLocal();
|
||||||
});
|
});
|
||||||
@ -537,11 +531,10 @@ define([
|
|||||||
initialValue: lastTheme
|
initialValue: lastTheme
|
||||||
};
|
};
|
||||||
var $block = module.$theme = Cryptpad.createDropdown(dropdownConfig);
|
var $block = module.$theme = Cryptpad.createDropdown(dropdownConfig);
|
||||||
var $button = $block.find('.buttonTitle');
|
|
||||||
|
|
||||||
setTheme(lastTheme, $block);
|
setTheme(lastTheme, $block);
|
||||||
|
|
||||||
$block.find('a').click(function (e) {
|
$block.find('a').click(function () {
|
||||||
var theme = $(this).attr('data-value');
|
var theme = $(this).attr('data-value');
|
||||||
setTheme(theme, $block);
|
setTheme(theme, $block);
|
||||||
localStorage.setItem(themeKey, theme);
|
localStorage.setItem(themeKey, theme);
|
||||||
@ -579,7 +572,7 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onReady = config.onReady = function (info) {
|
config.onReady = function (info) {
|
||||||
module.users = info.userList.users;
|
module.users = info.userList.users;
|
||||||
if (module.realtime !== info.realtime) {
|
if (module.realtime !== info.realtime) {
|
||||||
var realtime = module.realtime = info.realtime;
|
var realtime = module.realtime = info.realtime;
|
||||||
@ -693,7 +686,7 @@ define([
|
|||||||
return cursor;
|
return cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
var onRemote = config.onRemote = function () {
|
config.onRemote = function () {
|
||||||
if (initializing) { return; }
|
if (initializing) { return; }
|
||||||
if (isHistoryMode) { return; }
|
if (isHistoryMode) { return; }
|
||||||
var scroll = editor.getScrollInfo();
|
var scroll = editor.getScrollInfo();
|
||||||
@ -748,14 +741,14 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onAbort = config.onAbort = function (info) {
|
config.onAbort = function () {
|
||||||
// inform of network disconnect
|
// inform of network disconnect
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
toolbar.failed();
|
toolbar.failed();
|
||||||
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
|
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onConnectionChange = config.onConnectionChange = function (info) {
|
config.onConnectionChange = function (info) {
|
||||||
setEditable(info.state);
|
setEditable(info.state);
|
||||||
toolbar.failed();
|
toolbar.failed();
|
||||||
if (info.state) {
|
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);
|
editor.on('change', onLocal);
|
||||||
|
|
||||||
@ -779,7 +772,7 @@ define([
|
|||||||
var interval = 100;
|
var interval = 100;
|
||||||
|
|
||||||
var second = function (CM) {
|
var second = function (CM) {
|
||||||
Cryptpad.ready(function (err, env) {
|
Cryptpad.ready(function () {
|
||||||
andThen(CM);
|
andThen(CM);
|
||||||
Cryptpad.reportAppUsage();
|
Cryptpad.reportAppUsage();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -370,7 +370,7 @@ define([
|
|||||||
return "Loading share button";
|
return "Loading share button";
|
||||||
};
|
};
|
||||||
|
|
||||||
var createFileShare = function (toolbar, config) {
|
var createFileShare = function () {
|
||||||
if (!window.location.hash) {
|
if (!window.location.hash) {
|
||||||
throw new Error("Unable to display the share button: hash required in the URL");
|
throw new Error("Unable to display the share button: hash required in the URL");
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ define([
|
|||||||
return $titleContainer;
|
return $titleContainer;
|
||||||
};
|
};
|
||||||
|
|
||||||
var createLinkToMain = function (toolbar, config) {
|
var createLinkToMain = function (toolbar) {
|
||||||
var $linkContainer = $('<span>', {
|
var $linkContainer = $('<span>', {
|
||||||
'class': "cryptpad-link"
|
'class': "cryptpad-link"
|
||||||
}).appendTo(toolbar.$top);
|
}).appendTo(toolbar.$top);
|
||||||
@ -605,13 +605,12 @@ define([
|
|||||||
return $spin;
|
return $spin;
|
||||||
};
|
};
|
||||||
|
|
||||||
var createState = function (toolbar, config) {
|
var createState = function (toolbar) {
|
||||||
return toolbar.$userAdmin.find('.'+STATE_CLS).text(Messages.synchronizing).show();
|
return toolbar.$userAdmin.find('.'+STATE_CLS).text(Messages.synchronizing).show();
|
||||||
};
|
};
|
||||||
|
|
||||||
var createLimit = function (toolbar, config) {
|
var createLimit = function (toolbar) {
|
||||||
if (!Config.enablePinning) { return; }
|
if (!Config.enablePinning) { return; }
|
||||||
var usage;
|
|
||||||
var $limitIcon = $('<span>', {'class': 'fa fa-exclamation-triangle'});
|
var $limitIcon = $('<span>', {'class': 'fa fa-exclamation-triangle'});
|
||||||
var $limit = toolbar.$userAdmin.find('.'+LIMIT_CLS).attr({
|
var $limit = toolbar.$userAdmin.find('.'+LIMIT_CLS).attr({
|
||||||
'title': Messages.pinLimitReached
|
'title': Messages.pinLimitReached
|
||||||
@ -628,7 +627,7 @@ define([
|
|||||||
return $limit;
|
return $limit;
|
||||||
};
|
};
|
||||||
|
|
||||||
var createNewPad = function (toolbar, config) {
|
var createNewPad = function (toolbar) {
|
||||||
var $newPad = toolbar.$userAdmin.find('.'+NEWPAD_CLS).show();
|
var $newPad = toolbar.$userAdmin.find('.'+NEWPAD_CLS).show();
|
||||||
|
|
||||||
var pads_options = [];
|
var pads_options = [];
|
||||||
@ -676,7 +675,6 @@ define([
|
|||||||
Cryptpad.createUserAdminMenu(userMenuCfg);
|
Cryptpad.createUserAdminMenu(userMenuCfg);
|
||||||
|
|
||||||
var $userButton = $userAdmin.find('a.' + USERBUTTON_CLS);
|
var $userButton = $userAdmin.find('a.' + USERBUTTON_CLS);
|
||||||
var renameAlertOpened;
|
|
||||||
$userButton.click(function (e) {
|
$userButton.click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -688,7 +686,7 @@ define([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Cryptpad.onDisplayNameChanged(function (newName) {
|
Cryptpad.onDisplayNameChanged(function () {
|
||||||
Cryptpad.findCancelButton().click();
|
Cryptpad.findCancelButton().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -697,7 +695,7 @@ define([
|
|||||||
|
|
||||||
// Events
|
// Events
|
||||||
var initClickEvents = function (toolbar, config) {
|
var initClickEvents = function (toolbar, config) {
|
||||||
var removeDropdowns = function (e) {
|
var removeDropdowns = function () {
|
||||||
toolbar.$toolbar.find('.cryptpad-dropdown').hide();
|
toolbar.$toolbar.find('.cryptpad-dropdown').hide();
|
||||||
};
|
};
|
||||||
var cancelEditTitle = function (e) {
|
var cancelEditTitle = function (e) {
|
||||||
@ -720,7 +718,7 @@ define([
|
|||||||
// Click in iframes
|
// Click in iframes
|
||||||
try {
|
try {
|
||||||
if (w.$ && w.$('iframe').length) {
|
if (w.$ && w.$('iframe').length) {
|
||||||
var innerIfrw = config.ifrw.$('iframe').each(function (i, el) {
|
config.ifrw.$('iframe').each(function (i, el) {
|
||||||
$(el.contentWindow).on('click', removeDropdowns);
|
$(el.contentWindow).on('click', removeDropdowns);
|
||||||
$(el.contentWindow).on('click', cancelEditTitle);
|
$(el.contentWindow).on('click', cancelEditTitle);
|
||||||
});
|
});
|
||||||
@ -821,7 +819,7 @@ define([
|
|||||||
|
|
||||||
// Main
|
// Main
|
||||||
|
|
||||||
var create = Bar.create = function (cfg) {
|
Bar.create = function (cfg) {
|
||||||
var config = cfg || {};
|
var config = cfg || {};
|
||||||
Cryptpad = config.common;
|
Cryptpad = config.common;
|
||||||
Messages = Cryptpad.Messages;
|
Messages = Cryptpad.Messages;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user