From dc7e49f89dcc9c4b53f51038144cc83e2e8f5919 Mon Sep 17 00:00:00 2001 From: muxator Date: Tue, 16 Apr 2019 00:34:29 +0200 Subject: [PATCH] Remove trailing whitespaces Hoping to minimize future diffs. Not touching vendorized libraries. --- src/node/hooks/express.js | 6 +- src/node/hooks/express/socketio.js | 4 +- src/node/hooks/express/static.js | 6 +- src/node/hooks/express/swagger.js | 8 +-- src/node/utils/Abiword.js | 22 +++---- src/node/utils/ExportHtml.js | 10 ++-- src/node/utils/customError.js | 4 +- src/static/js/AttributePool.js | 4 +- src/static/js/Changeset.js | 84 +++++++++++++-------------- src/static/js/admin/plugins.js | 16 ++--- src/static/js/admin/settings.js | 2 +- src/static/js/broadcast.js | 30 +++++----- src/static/js/broadcast_revisions.js | 2 +- src/static/js/broadcast_slider.js | 32 +++++----- src/static/js/changesettracker.js | 6 +- src/static/js/chat.js | 18 +++--- src/static/js/colorutils.js | 2 +- src/static/js/contentcollector.js | 14 ++--- src/static/js/domline.js | 6 +- src/static/js/l10n.js | 4 +- src/static/js/linestylefilter.js | 12 ++-- src/static/js/pad_connectionstatus.js | 8 +-- src/static/js/pad_cookie.js | 4 +- src/static/js/pad_editor.js | 4 +- src/static/js/pad_utils.js | 8 +-- src/static/js/skiplist.js | 4 +- src/static/js/timeslider.js | 8 +-- src/static/js/undomodule.js | 2 +- 28 files changed, 165 insertions(+), 165 deletions(-) diff --git a/src/node/hooks/express.js b/src/node/hooks/express.js index e7b373805..ccdc3d668 100644 --- a/src/node/hooks/express.js +++ b/src/node/hooks/express.js @@ -13,7 +13,7 @@ exports.createServer = function () { console.log("Report bugs at https://github.com/ether/etherpad-lite/issues") serverName = `Etherpad ${settings.getGitCommit()} (http://etherpad.org)`; - + console.log(`Your Etherpad version is ${settings.getEpVersion()} (${settings.getGitCommit()})`); exports.restartServer(); @@ -45,7 +45,7 @@ exports.restartServer = function () { console.log("SSL -- enabled"); console.log(`SSL -- server key file: ${settings.ssl.key}`); console.log(`SSL -- Certificate Authority's certificate file: ${settings.ssl.cert}`); - + var options = { key: fs.readFileSync( settings.ssl.key ), cert: fs.readFileSync( settings.ssl.cert ) @@ -57,7 +57,7 @@ exports.restartServer = function () { options.ca.push(fs.readFileSync(caFileName)); } } - + var https = require('https'); server = https.createServer(options, app); diff --git a/src/node/hooks/express/socketio.js b/src/node/hooks/express/socketio.js index 23622f3af..de94e9fbb 100644 --- a/src/node/hooks/express/socketio.js +++ b/src/node/hooks/express/socketio.js @@ -8,7 +8,7 @@ var padMessageHandler = require("../../handler/PadMessageHandler"); var cookieParser = require('cookie-parser'); var sessionModule = require('express-session'); - + exports.expressCreateServer = function (hook_name, args, cb) { //init socket.io and redirect all requests to the MessageHandler // there shouldn't be a browser that isn't compatible to all @@ -57,7 +57,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { // no longer available, details available at: // http://stackoverflow.com/questions/23981741/minify-socket-io-socket-io-js-with-1-0 // if(settings.minify) io.enable('browser client minification'); - + //Initalize the Socket.IO Router socketIORouter.setSocketIO(io); socketIORouter.addComponent("pad", padMessageHandler); diff --git a/src/node/hooks/express/static.js b/src/node/hooks/express/static.js index ef41865e3..4c17fbe3b 100644 --- a/src/node/hooks/express/static.js +++ b/src/node/hooks/express/static.js @@ -40,9 +40,9 @@ exports.expressCreateServer = function (hook_name, args, cb) { var clientParts = _(plugins.parts) .filter(function(part){ return _(part).has('client_hooks') }); - + var clientPlugins = {}; - + _(clientParts).chain() .map(function(part){ return part.plugin }) .uniq() @@ -50,7 +50,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { clientPlugins[name] = _(plugins.plugins[name]).clone(); delete clientPlugins[name]['package']; }); - + res.header("Content-Type","application/json; charset=utf-8"); res.write(JSON.stringify({"plugins": clientPlugins, "parts": clientParts})); res.end(); diff --git a/src/node/hooks/express/swagger.js b/src/node/hooks/express/swagger.js index f606eb882..f3f07cd01 100644 --- a/src/node/hooks/express/swagger.js +++ b/src/node/hooks/express/swagger.js @@ -113,7 +113,7 @@ var API = { "response": {"groupIDs":{"type":"List", "items":{"type":"string"}}} }, }, - + // Author "author": { "create" : { @@ -298,7 +298,7 @@ function capitalise(string){ for (var resource in API) { for (var func in API[resource]) { - + // The base response model var responseModel = { "properties": { @@ -350,7 +350,7 @@ function newSwagger() { exports.expressCreateServer = function (hook_name, args, cb) { for (var version in apiHandler.version) { - + var swagger = newSwagger(); var basePath = "/rest/" + version; @@ -437,7 +437,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { }; swagger.configureSwaggerPaths("", "/api" , ""); - + swagger.configure("http://" + settings.ip + ":" + settings.port + basePath, version); } }; diff --git a/src/node/utils/Abiword.js b/src/node/utils/Abiword.js index 2aae5a8ac..eed844e73 100644 --- a/src/node/utils/Abiword.js +++ b/src/node/utils/Abiword.js @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + var spawn = require('child_process').spawn; var async = require("async"); var settings = require("./Settings"); @@ -34,7 +34,7 @@ if(os.type().indexOf("Windows") > -1) { //span an abiword process to perform the conversion var abiword = spawn(settings.abiword, ["--to=" + task.destFile, task.srcFile]); - + //delegate the processing of stdout to another function abiword.stdout.on('data', function (data) { @@ -43,7 +43,7 @@ if(os.type().indexOf("Windows") > -1) }); //append error messages to the buffer - abiword.stderr.on('data', function (data) + abiword.stderr.on('data', function (data) { stdoutBuffer += data.toString(); }); @@ -63,7 +63,7 @@ if(os.type().indexOf("Windows") > -1) callback(); }); }; - + exports.convertFile = function(srcFile, destFile, type, callback) { doConvertTask({"srcFile": srcFile, "destFile": destFile, "type": type}, callback); @@ -79,16 +79,16 @@ else var spawnAbiword = function (){ abiword = spawn(settings.abiword, ["--plugin", "AbiCommand"]); var stdoutBuffer = ""; - var firstPrompt = true; + var firstPrompt = true; //append error messages to the buffer - abiword.stderr.on('data', function (data) + abiword.stderr.on('data', function (data) { stdoutBuffer += data.toString(); }); //abiword died, let's restart abiword and return an error with the callback - abiword.on('exit', function (code) + abiword.on('exit', function (code) { spawnAbiword(); stdoutCallback(`Abiword died with exit code ${code}`); @@ -105,10 +105,10 @@ else { //filter the feedback message var err = stdoutBuffer.search("OK") != -1 ? null : stdoutBuffer; - + //reset the buffer stdoutBuffer = ""; - + //call the callback with the error message //skip the first prompt if(stdoutCallback != null && !firstPrompt) @@ -116,7 +116,7 @@ else stdoutCallback(err); stdoutCallback = null; } - + firstPrompt = false; } }); @@ -138,7 +138,7 @@ else } }; }; - + //Queue with the converts we have to do var queue = async.queue(doConvertTask, 1); exports.convertFile = function(srcFile, destFile, type, callback) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index 9cbcd2aa0..18b32d247 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -331,12 +331,12 @@ function getHTMLFromAtext(pad, atext, authorColors) nextLine = _analyzeLine(textLines[i + 1], attribLines[i + 1], apool); } hooks.aCallAll('getLineHTMLForExport', context); - //To create list parent elements + //To create list parent elements if ((!prevLine || prevLine.listLevel !== line.listLevel) || (prevLine && line.listTypeName !== prevLine.listTypeName)) { var exists = _.find(openLists, function (item) { - return (item.level === line.listLevel && item.type === line.listTypeName); + return (item.level === line.listLevel && item.type === line.listTypeName); }); if (!exists) { var prevLevel = 0; @@ -365,7 +365,7 @@ function getHTMLFromAtext(pad, atext, authorColors) { pieces.push(""); } - } + } } } else//outside any list, need to close line.listLevel of lists diff --git a/src/node/utils/customError.js b/src/node/utils/customError.js index 5ca7a7a41..c18743485 100644 --- a/src/node/utils/customError.js +++ b/src/node/utils/customError.js @@ -5,11 +5,11 @@ function customError(message, errorName) { this.name = errorName || "Error"; this.message = message; - + var stackParts = new Error().stack.split("\n"); stackParts.splice(0,2); stackParts.unshift(this.name + ": " + message); - + this.stack = stackParts.join("\n"); } customError.prototype = Error.prototype; diff --git a/src/static/js/AttributePool.js b/src/static/js/AttributePool.js index 96ea9b0da..7e7634e42 100644 --- a/src/static/js/AttributePool.js +++ b/src/static/js/AttributePool.js @@ -91,6 +91,6 @@ AttributePool.prototype.fromJsonable = function (obj) { } return this; }; - -module.exports = AttributePool; \ No newline at end of file + +module.exports = AttributePool; diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index 6f6e7d099..2458ae65e 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -42,7 +42,7 @@ exports.error = function error(msg) { }; /** - * This method is used for assertions with Messages + * This method is used for assertions with Messages * if assert fails, the error function is called. * @param b {boolean} assertion condition * @param msgParts {string} error to be passed if it fails @@ -76,7 +76,7 @@ exports.numToString = function (num) { * Converts stuff before $ to base 10 * @obsolete not really used anywhere?? * @param cs {string} the string - * @return integer + * @return integer */ exports.toBaseTen = function (cs) { var dollarIndex = cs.indexOf('$'); @@ -93,10 +93,10 @@ exports.toBaseTen = function (cs) { */ /** - * returns the required length of the text before changeset + * returns the required length of the text before changeset * can be applied * @param cs {string} String representation of the Changeset - */ + */ exports.oldLen = function (cs) { return exports.unpack(cs).oldLen; }; @@ -104,16 +104,16 @@ exports.oldLen = function (cs) { /** * returns the length of the text after changeset is applied * @param cs {string} String representation of the Changeset - */ + */ exports.newLen = function (cs) { return exports.unpack(cs).newLen; }; /** * this function creates an iterator which decodes string changeset operations - * @param opsStr {string} String encoding of the change operations to be performed - * @param optStartIndex {int} from where in the string should the iterator start - * @return {Op} type object iterator + * @param opsStr {string} String encoding of the change operations to be performed + * @param optStartIndex {int} from where in the string should the iterator start + * @return {Op} type object iterator */ exports.opIterator = function (opsStr, optStartIndex) { //print(opsStr); @@ -131,7 +131,7 @@ exports.opIterator = function (opsStr, optStartIndex) { if (result[0] == '?') { exports.error("Hit error opcode in op stream"); } - + return result; } var regexResult = nextRegexMatch(); @@ -504,7 +504,7 @@ exports.opAssembler = function () { /** * A custom made String Iterator * @param str {string} String to be iterated over - */ + */ exports.stringIterator = function (str) { var curIndex = 0; // newLines is the number of \n between curIndex and str.length @@ -549,7 +549,7 @@ exports.stringIterator = function (str) { }; /** - * A custom made StringBuffer + * A custom made StringBuffer */ exports.stringAssembler = function () { var pieces = []; @@ -827,12 +827,12 @@ exports.textLinesMutator = function (lines) { }; /** - * Function allowing iterating over two Op strings. + * Function allowing iterating over two Op strings. * @params in1 {string} first Op string * @params idx1 {int} integer where 1st iterator should start * @params in2 {string} second Op string * @params idx2 {int} integer where 2nd iterator should start - * @params func {function} which decides how 1st or 2nd iterator + * @params func {function} which decides how 1st or 2nd iterator * advances. When opX.opcode = 0, iterator X advances to * next element * func has signature f(op1, op2, opOut) @@ -889,7 +889,7 @@ exports.unpack = function (cs) { }; /** - * Packs Changeset object into a string + * Packs Changeset object into a string * @params oldLen {int} Old length of the Changeset * @params newLen {int] New length of the Changeset * @params opsStr {string} String encoding of the changes to be made @@ -980,8 +980,8 @@ exports.mutateTextLines = function (cs, lines) { * Composes two attribute strings (see below) into one. * @param att1 {string} first attribute string * @param att2 {string} second attribue string - * @param resultIsMutaton {boolean} - * @param pool {AttribPool} attribute pool + * @param resultIsMutaton {boolean} + * @param pool {AttribPool} attribute pool */ exports.composeAttributes = function (att1, att2, resultIsMutation, pool) { // att1 and att2 are strings like "*3*f*1c", asMutation is a boolean. @@ -1041,8 +1041,8 @@ exports.composeAttributes = function (att1, att2, resultIsMutation, pool) { }; /** - * Function used as parameter for applyZip to apply a Changeset to an - * attribute + * Function used as parameter for applyZip to apply a Changeset to an + * attribute */ exports._slicerZipperFunc = function (attOp, csOp, opOut, pool) { // attOp is the op from the sequence that is being operated on, either an @@ -1359,7 +1359,7 @@ exports.compose = function (cs1, cs2, pool) { * returns a function that tests if a string of attributes * (e.g. *3*4) contains a given attribute key,value that * is already present in the pool. - * @param attribPair array [key,value] of the attribute + * @param attribPair array [key,value] of the attribute * @param pool {AttribPool} Attribute pool */ exports.attributeTester = function (attribPair, pool) { @@ -1391,9 +1391,9 @@ exports.identity = function (N) { /** - * creates a Changeset which works on oldFullText and removes text - * from spliceStart to spliceStart+numRemoved and inserts newText - * instead. Also gives possibility to add attributes optNewTextAPairs + * creates a Changeset which works on oldFullText and removes text + * from spliceStart to spliceStart+numRemoved and inserts newText + * instead. Also gives possibility to add attributes optNewTextAPairs * for the new text. * @param oldFullText {string} old text * @param spliecStart {int} where splicing starts @@ -1429,7 +1429,7 @@ exports.makeSplice = function (oldFullText, spliceStart, numRemoved, newText, op * @param cs Changeset */ exports.toSplices = function (cs) { - // + // var unpacked = exports.unpack(cs); var splices = []; @@ -1460,7 +1460,7 @@ exports.toSplices = function (cs) { }; /** - * + * */ exports.characterRangeFollow = function (cs, startChar, endChar, insertionsAfter) { var newStartChar = startChar; @@ -1547,7 +1547,7 @@ exports.makeAttribution = function (text) { * and runs function func on them * @param cs {Changeset} changeset * @param func {function} function to be called - */ + */ exports.eachAttribNumber = function (cs, func) { var dollarPos = cs.indexOf('$'); if (dollarPos < 0) { @@ -1566,16 +1566,16 @@ exports.eachAttribNumber = function (cs, func) { * callable on a exports, attribution string, or attribs property of an op, * though it may easily create adjacent ops that can be merged. * @param cs {Changeset} changeset to be filtered - * @param filter {function} fnc which returns true if an + * @param filter {function} fnc which returns true if an * attribute X (int) should be kept in the Changeset - */ + */ exports.filterAttribNumbers = function (cs, filter) { return exports.mapAttribNumbers(cs, filter); }; /** - * does exactly the same as exports.filterAttribNumbers - */ + * does exactly the same as exports.filterAttribNumbers + */ exports.mapAttribNumbers = function (cs, func) { var dollarPos = cs.indexOf('$'); if (dollarPos < 0) { @@ -1600,7 +1600,7 @@ exports.mapAttribNumbers = function (cs, func) { /** * Create a Changeset going from Identity to a certain state * @params text {string} text of the final change - * @attribs attribs {string} optional, operations which insert + * @attribs attribs {string} optional, operations which insert * the text and also puts the right attributes */ exports.makeAText = function (text, attribs) { @@ -1611,9 +1611,9 @@ exports.makeAText = function (text, attribs) { }; /** - * Apply a Changeset to a AText + * Apply a Changeset to a AText * @param cs {Changeset} Changeset to be applied - * @param atext {AText} + * @param atext {AText} * @param pool {AttribPool} Attribute Pool to add to */ exports.applyToAText = function (cs, atext, pool) { @@ -1625,7 +1625,7 @@ exports.applyToAText = function (cs, atext, pool) { /** * Clones a AText structure - * @param atext {AText} + * @param atext {AText} */ exports.cloneAText = function (atext) { if (atext) { @@ -1638,7 +1638,7 @@ exports.cloneAText = function (atext) { /** * Copies a AText structure from atext1 to atext2 - * @param atext {AText} + * @param atext {AText} */ exports.copyAText = function (atext1, atext2) { atext2.text = atext1.text; @@ -1647,7 +1647,7 @@ exports.copyAText = function (atext1, atext2) { /** * Append the set of operations from atext to an assembler - * @param atext {AText} + * @param atext {AText} * @param assem Assembler like smartOpAssembler */ exports.appendATextToAssembler = function (atext, assem) { @@ -1685,7 +1685,7 @@ exports.appendATextToAssembler = function (atext, assem) { /** * Creates a clone of a Changeset and it's APool - * @param cs {Changeset} + * @param cs {Changeset} * @param pool {AtributePool} */ exports.prepareForWire = function (cs, pool) { @@ -1706,8 +1706,8 @@ exports.isIdentity = function (cs) { }; /** - * returns all the values of attributes with a certain key - * in an Op attribs string + * returns all the values of attributes with a certain key + * in an Op attribs string * @param attribs {string} Attribute string of a Op * @param key {string} string to be seached for * @param pool {AttribPool} attribute pool @@ -1717,8 +1717,8 @@ exports.opAttributeValue = function (op, key, pool) { }; /** - * returns all the values of attributes with a certain key - * in an attribs string + * returns all the values of attributes with a certain key + * in an attribs string * @param attribs {string} Attribute string * @param key {string} string to be seached for * @param pool {AttribPool} attribute pool @@ -1736,7 +1736,7 @@ exports.attribsAttributeValue = function (attribs, key, pool) { }; /** - * Creates a Changeset builder for a string with initial + * Creates a Changeset builder for a string with initial * length oldLen. Allows to add/remove parts of it * @param oldLen {int} Old length */ @@ -2224,7 +2224,7 @@ exports.composeWithDeletions = function (cs1, cs2, pool) { return exports.pack(len1, len3, newOps, bankAssem.toString()); }; -// This function is 95% like _slicerZipperFunc, we just changed two lines to ensure it merges the attribs of deletions properly. +// This function is 95% like _slicerZipperFunc, we just changed two lines to ensure it merges the attribs of deletions properly. // This is necassary for correct paddiff. But to ensure these changes doesn't affect anything else, we've created a seperate function only used for paddiffs exports._slicerZipperFuncWithDeletions= function (attOp, csOp, opOut, pool) { // attOp is the op from the sequence that is being operated on, either an diff --git a/src/static/js/admin/plugins.js b/src/static/js/admin/plugins.js index c9a244871..3bc0daddc 100644 --- a/src/static/js/admin/plugins.js +++ b/src/static/js/admin/plugins.js @@ -1,5 +1,5 @@ $(document).ready(function () { - + var socket, loc = document.location, port = loc.port == "" ? (loc.protocol == "https:" ? 443 : 80) : loc.port, @@ -23,7 +23,7 @@ $(document).ready(function () { search.searchTerm = searchTerm; socket.emit("search", {searchTerm: searchTerm, offset:search.offset, limit: limit, sortBy: search.sortBy, sortDir: search.sortDir}); search.offset += limit; - + $('#search-progress').show() search.messages.show('fetching') search.searching = true @@ -76,7 +76,7 @@ $(document).ready(function () { function displayPluginList(plugins, container, template) { plugins.forEach(function(plugin) { var row = template.clone(); - + for (attr in plugin) { if(attr == "name"){ // Hack to rewrite URLS into name var link = $(''); @@ -96,7 +96,7 @@ $(document).ready(function () { }) updateHandlers(); } - + function sortPluginList(plugins, property, /*ASC?*/dir) { return plugins.sort(function(a, b) { if (a[property] < b[property]) @@ -113,7 +113,7 @@ $(document).ready(function () { $("#search-query").unbind('keyup').keyup(function () { search($("#search-query").val()); }); - + // Prevent form submit $('#search-query').parent().bind('submit', function() { return false; @@ -167,7 +167,7 @@ $(document).ready(function () { search.messages.hide('nothing-found') search.messages.hide('fetching') $("#search-query").removeAttr('disabled') - + console.log('got search results', data) // add to results @@ -218,7 +218,7 @@ $(document).ready(function () { installed.messages.show("nothing-installed") } }); - + socket.on('results:updatable', function(data) { data.updatable.forEach(function(pluginName) { var $row = $('#installed-plugins > tr.'+pluginName) @@ -250,7 +250,7 @@ $(document).ready(function () { // remove plugin from installed list $('#installed-plugins .'+data.plugin).remove() - + socket.emit("getInstalled"); // update search results diff --git a/src/static/js/admin/settings.js b/src/static/js/admin/settings.js index 6c1f5e236..d95a424e5 100644 --- a/src/static/js/admin/settings.js +++ b/src/static/js/admin/settings.js @@ -31,7 +31,7 @@ $(document).ready(function () { } else{ alert("YOUR JSON IS BAD AND YOU SHOULD FEEL BAD"); - } + } }); /* When the admin clicks save Settings check the JSON then send the JSON back to the server */ diff --git a/src/static/js/broadcast.js b/src/static/js/broadcast.js index 817155b55..1bd547f52 100644 --- a/src/static/js/broadcast.js +++ b/src/static/js/broadcast.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -239,7 +239,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro */ function applyChangeset(changeset, revision, preventSliderMovement, timeDelta) - { + { // disable the next 'gotorevision' call handled by a timeslider update if (!preventSliderMovement) { @@ -263,12 +263,12 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro debugLog('Time Delta: ', timeDelta) updateTimer(); - + var authors = _.map(padContents.getActiveAuthors(), function(name) { return authorData[name]; }); - + BroadcastSlider.setAuthors(authors); } @@ -281,7 +281,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro str = '0' + str; return str; } - + var date = new Date(padContents.currentTime); var dateFormat = function() { @@ -296,15 +296,15 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro "month": month, "year": year, "hours": hours, - "minutes": minutes, + "minutes": minutes, "seconds": seconds })); } - - - - - + + + + + $('#timer').html(dateFormat()); var revisionDate = html10n.get("timeslider.saved", { "day": date.getDate(), @@ -327,7 +327,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro $('#revision_date').html(revisionDate) } - + updateTimer(); function goToRevision(newRevision) @@ -378,13 +378,13 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro // Loading changeset history for old revision (to make diff between old and new revision) loadChangesetsForRevision(padContents.currentRevision - 1); } - + var authors = _.map(padContents.getActiveAuthors(), function(name){ return authorData[name]; }); BroadcastSlider.setAuthors(authors); } - + function loadChangesetsForRevision(revision, callback) { if (BroadcastSlider.getSliderLength() > 10000) { @@ -566,7 +566,7 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro goToRevision.apply(goToRevision, arguments); } } - + BroadcastSlider.onSlider(goToRevisionIfEnabled); var dynamicCSS = makeCSSManager('dynamicsyntax'); diff --git a/src/static/js/broadcast_revisions.js b/src/static/js/broadcast_revisions.js index 1980bdf30..abe3292dc 100644 --- a/src/static/js/broadcast_revisions.js +++ b/src/static/js/broadcast_revisions.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ diff --git a/src/static/js/broadcast_slider.js b/src/static/js/broadcast_slider.js index 2299bba32..1893994ef 100644 --- a/src/static/js/broadcast_slider.js +++ b/src/static/js/broadcast_slider.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -59,7 +59,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) slidercallbacks[i](newval); } } - + var updateSliderElements = function() { for (var i = 0; i < savedRevisions.length; i++) @@ -68,7 +68,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) savedRevisions[i].css('left', (position * ($("#ui-slider-bar").width() - 2) / (sliderLength * 1.0)) - 1); } $("#ui-slider-handle").css('left', sliderPos * ($("#ui-slider-bar").width() - 2) / (sliderLength * 1.0)); - } + } var addSavedRevision = function(position, info) { @@ -171,7 +171,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) var height = $('#timeslider-top').height(); $('#editorcontainerbox').css({marginTop: height}); }, 600); - + function setAuthors(authors) { var authorsList = $("#authorsList"); @@ -187,7 +187,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) if (author.name) { if (numNamed !== 0) authorsList.append(', '); - + $('') .text(author.name || "unnamed") .css('background-color', authorColor) @@ -206,17 +206,17 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) if (numAnonymous > 0) { var anonymousAuthorString = html10n.get("timeslider.unnamedauthors", { num: numAnonymous }); - + if (numNamed !== 0){ authorsList.append(' + ' + anonymousAuthorString); } else { authorsList.append(anonymousAuthorString); } - + if(colorsAnonymous.length > 0){ authorsList.append(' ('); _.each(colorsAnonymous, function(color, i){ - if( i > 0 ) authorsList.append(' '); + if( i > 0 ) authorsList.append(' '); $(' ') .css('background-color', color) .addClass('author author-anonymous') @@ -224,13 +224,13 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) }); authorsList.append(')'); } - + } if (authors.length == 0) { authorsList.append(html10n.get("timeslider.toolbar.authorsList")); } - + fixPadHeight(); } @@ -288,7 +288,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) { disableSelection($("#playpause_button")[0]); disableSelection($("#timeslider")[0]); - + $(document).keyup(function(e) { // If focus is on editbar, don't do anything @@ -337,7 +337,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) } else if (code == 32) playpause(); }); - + $(window).resize(function() { updateSliderElements(); @@ -467,7 +467,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) if (clientVars) { $("#timeslider").show(); - + var startPos = clientVars.collab_client_vars.rev; if(window.location.hash.length > 1) { @@ -478,15 +478,15 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded) setTimeout(function() { setSliderPosition(hashRev); }, 1); } } - + setSliderLength(clientVars.collab_client_vars.rev); setSliderPosition(clientVars.collab_client_vars.rev); - + _.each(clientVars.savedRevisions, function(revision) { addSavedRevision(revision.revNum, revision); }) - + } }); })(); diff --git a/src/static/js/changesettracker.js b/src/static/js/changesettracker.js index fe362c4b7..4e7cd3ed6 100644 --- a/src/static/js/changesettracker.js +++ b/src/static/js/changesettracker.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -163,7 +163,7 @@ function makeChangesetTracker(scheduler, apool, aceCallbacksProvider) else { - // add forEach function to Array.prototype for IE8 + // add forEach function to Array.prototype for IE8 if (!('forEach' in Array.prototype)) { Array.prototype.forEach= function(action, that /*opt*/) { for (var i= 0, n= this.length; i p').eq(-1); } } - }, + }, send: function() { var text = $("#chatinput").val(); @@ -121,7 +121,7 @@ var chat = (function() { //correct the time msg.time += this._pad.clientTimeOffset; - + //create the time string var minutes = "" + new Date(msg.time).getMinutes(); var hours = "" + new Date(msg.time).getHours(); @@ -130,7 +130,7 @@ var chat = (function() if(hours.length == 1) hours = "0" + hours ; var timeStr = hours + ":" + minutes; - + //create the authorclass var authorClass = "author-" + msg.userId.replace(/[^a-y0-9]/g, function(c) { diff --git a/src/static/js/colorutils.js b/src/static/js/colorutils.js index 74a2e4635..af471c453 100644 --- a/src/static/js/colorutils.js +++ b/src/static/js/colorutils.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index 6820da07c..d3bd73383 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -252,14 +252,14 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas { state.listNesting = (state.listNesting || 0) + 1; } - + if(listType === 'none' || !listType ){ - delete state.lineAttributes['list']; + delete state.lineAttributes['list']; } else{ state.lineAttributes['list'] = listType; } - + _recalcAttribString(state); return oldListType; } @@ -303,7 +303,7 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas // see https://github.com/ether/etherpad-lite/issues/2567 for more information // in long term the contentcollector should be refactored to get rid of this workaround var ATTRIBUTE_SPLIT_STRING = "::"; - + // see if attributeString is splittable var attributeSplits = a.split(ATTRIBUTE_SPLIT_STRING); if (attributeSplits.length > 1) { @@ -410,7 +410,7 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas text:txt, styl: null, cls: null - }); + }); var txt = (typeof(txtFromHook)=='object'&&txtFromHook.length==0)?dom.nodeValue(node):txtFromHook[0]; var rest = ''; @@ -504,7 +504,7 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas tvalue:tvalue, styl: null, cls: null - }); + }); var startNewLine= (typeof(induceLineBreak)=='object'&&induceLineBreak.length==0)?true:induceLineBreak[0]; if(startNewLine){ cc.startNewLine(state); diff --git a/src/static/js/domline.js b/src/static/js/domline.js index a7501fcc6..100ce0919 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -135,7 +135,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) } postHtml += ''; } - } + } processedMarker = true; } _.map(hooks.callAll("aceDomLineProcessLineAttributes", { @@ -150,7 +150,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if( processedMarker ){ result.lineMarker += txt.length; return; // don't append any text - } + } } var href = null; var simpleTags = null; diff --git a/src/static/js/l10n.js b/src/static/js/l10n.js index c79ea706d..473850bd9 100644 --- a/src/static/js/l10n.js +++ b/src/static/js/l10n.js @@ -6,9 +6,9 @@ html10n.bind('indexed', function() { html10n.localize([language, navigator.language, navigator.userLanguage, 'en']) }) - + html10n.bind('localized', function() { document.documentElement.lang = html10n.getLanguage() document.documentElement.dir = html10n.getDirection() }) -})(document) \ No newline at end of file +})(document) diff --git a/src/static/js/linestylefilter.js b/src/static/js/linestylefilter.js index 3cf7a510a..0c7cff812 100644 --- a/src/static/js/linestylefilter.js +++ b/src/static/js/linestylefilter.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -80,10 +80,10 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun { var classes = ''; var isLineAttribMarker = false; - + Changeset.eachAttribNumber(attribs, function(n) { - var key = apool.getAttribKey(n); + var key = apool.getAttribKey(n); if (key) { var value = apool.getAttribValue(n); @@ -115,11 +115,11 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun key: key, value: value }, " ", " ", ""); - } + } } } }); - + if(isLineAttribMarker) classes += ' ' + lineAttributeMarker; return classes.substring(1); } @@ -157,7 +157,7 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun linestylefilter: linestylefilter, text: txt, "class": cls - }, " ", " ", ""); + }, " ", " ", ""); var disableAuthors = (disableAuthColorForThisLine==null||disableAuthColorForThisLine.length==0)?false:disableAuthColorForThisLine[0]; while (txt.length > 0) { diff --git a/src/static/js/pad_connectionstatus.js b/src/static/js/pad_connectionstatus.js index 76eedbc4d..4e5f41be0 100644 --- a/src/static/js/pad_connectionstatus.js +++ b/src/static/js/pad_connectionstatus.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -50,7 +50,7 @@ var padconnectionstatus = (function() status = { what: 'reconnecting' }; - + padmodals.showModal('reconnecting'); padmodals.showOverlay(); }, @@ -58,12 +58,12 @@ var padconnectionstatus = (function() { if(status.what == "disconnected") return; - + status = { what: 'disconnected', why: msg }; - + var k = String(msg); // known reason why if (!(k == 'userdup' || k == 'deleted' || k == 'looping' || k == 'slowcommit' || k == 'initsocketfail' || k == 'unauth' || k == 'badChangeset' || k == 'corruptPad')) { diff --git a/src/static/js/pad_cookie.js b/src/static/js/pad_cookie.js index 62c88cffe..2fa20452e 100644 --- a/src/static/js/pad_cookie.js +++ b/src/static/js/pad_cookie.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -82,7 +82,7 @@ var padcookie = (function() alreadyWarnedAboutNoCookies = true; } } - + function isHttpsScheme() { return window.location.protocol == "https:"; } diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js index ec2339562..c59a2fc61 100644 --- a/src/static/js/pad_editor.js +++ b/src/static/js/pad_editor.js @@ -142,7 +142,7 @@ var padeditor = (function() } var fontFamily = newOptions['padFontFamily']; - switch (fontFamily) { + switch (fontFamily) { case "monospace": self.ace.setProperty("textface", "monospace"); break; case "montserrat": self.ace.setProperty("textface", "Montserrat"); break; case "opendyslexic": self.ace.setProperty("textface", "OpenDyslexic"); break; @@ -162,7 +162,7 @@ var padeditor = (function() case "wingdings": self.ace.setProperty("textface", "Wingdings"); break; case "sansserif": self.ace.setProperty("textface", "sans-serif"); break; case "serif": self.ace.setProperty("textface", "serif"); break; - default: self.ace.setProperty("textface", ""); break; + default: self.ace.setProperty("textface", ""); break; } }, dispose: function() diff --git a/src/static/js/pad_utils.js b/src/static/js/pad_utils.js index 9c1277a00..ef675dc75 100644 --- a/src/static/js/pad_utils.js +++ b/src/static/js/pad_utils.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -53,7 +53,7 @@ function createCookie(name, value, days, path){ /* Used by IE */ if(!path){ // IF the Path of the cookie isn't set then just create it on root path = "/"; } - + //Check if we accessed the pad over https var secure = window.location.protocol == "https:" ? ";secure" : ""; @@ -531,9 +531,9 @@ function setupGlobalExceptionHandler() { var errObj = {errorInfo: JSON.stringify({errorId: errorId, msg: msg, url: window.location.href, linenumber: linenumber, userAgent: navigator.userAgent})}; var loc = document.location; var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror"; - + $.post(url, errObj); - + return false; }; window.onerror = globalExceptionHandler; diff --git a/src/static/js/skiplist.js b/src/static/js/skiplist.js index a02a2ad52..04155e320 100644 --- a/src/static/js/skiplist.js +++ b/src/static/js/skiplist.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -155,7 +155,7 @@ function SkipList() var widthLoc = point.widthSkips[0] + point.nodes[0].downSkipWidths[0]; var newWidth = _entryWidth(entry); p.mark("loop1"); - + // The new node will have at least level 1 // With a proability of 0.01^(n-1) the nodes level will be >= n while (newNode.levels == 0 || Math.random() < 0.01) diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 7e744118f..3cdff91a9 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -60,10 +60,10 @@ function init() { var url = loc.protocol + "//" + loc.hostname + ":" + port + "/"; //find out in which subfolder we are var resource = exports.baseURL.substring(1) + 'socket.io'; - + //build up the socket io connection socket = io.connect(url, {path: exports.baseURL + 'socket.io', resource: resource}); - + //send the ready message once we're connected socket.on('connect', function() { @@ -126,13 +126,13 @@ function sendSocketMsg(type, data) } var fireWhenAllScriptsAreLoaded = []; - + var changesetLoader; function handleClientVars(message) { //save the client Vars clientVars = message.data; - + //load all script that doesn't work without the clientVars BroadcastSlider = require('./broadcast_slider').loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded); require('./broadcast_revisions').loadBroadcastRevisionsJS(); diff --git a/src/static/js/undomodule.js b/src/static/js/undomodule.js index 4b55311bf..6610224fe 100644 --- a/src/static/js/undomodule.js +++ b/src/static/js/undomodule.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */