diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 2a505f826..6767b693e 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -56,7 +56,7 @@ echo "Ensure jQuery is downloaded and up to date..." DOWNLOAD_JQUERY="true" NEEDED_VERSION="1.7.1" if [ -f "static/js/jquery.js" ]; then - VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9].[0-9]"); + VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?"); if [ ${VERSION#v} = $NEEDED_VERSION ]; then DOWNLOAD_JQUERY="false" @@ -79,7 +79,7 @@ if [ -f "static/js/prefixfree.js" ]; then fi if [ $DOWNLOAD_PREFIXFREE = "true" ]; then - curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 + curl -lo static/js/prefixfree.js -k https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 fi #Remove all minified data to force node creating it new diff --git a/node/server.js b/node/server.js index 69813bc8c..b502a13a0 100644 --- a/node/server.js +++ b/node/server.js @@ -141,9 +141,6 @@ async.waterfall([ gracefulShutdown(); }); - //serve minified files - app.get('/minified/:filename', minify.minifyJS); - //serve static files app.get('/static/js/require-kernel.js', function (req, res, next) { res.header("Content-Type","application/javascript; charset: utf-8"); diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 98774d195..859ee07ae 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -73,8 +73,7 @@ function _handle(req, res, jsFilename, jsFiles) { //minifying is enabled if(settings.minify) { - var fileValues = {}; - var embeds = {}; + var result = undefined; var latestModification = 0; async.series([ @@ -143,87 +142,20 @@ function _handle(req, res, jsFilename, jsFiles) { //load all js files function (callback) { - async.forEach(jsFiles, function (item, callback) - { - fs.readFile(JS_DIR + item, "utf-8", function(err, data) - { - if(ERR(err, callback)) return; - fileValues[item] = data; - callback(); - }); - }, callback); - }, - //find all includes in ace.js and embed them - function(callback) - { - //if this is not the creation of pad.js, skip this part - if(jsFilename != "pad.js") - { - callback(); - return; - } - - var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"-]+\)/gi); - - //go trough all includes - async.forEach(founds, function (item, callback) - { - var filename = item.match(/"[^"]*"/g)[0].substr(1); - filename = filename.substr(0,filename.length-1); - - var type = item.match(/INCLUDE_[A-Z]+/g)[0].substr("INCLUDE_".length); - - //read the included file - var shortFilename = filename.replace(/^..\/static\/js\//, ''); - if (shortFilename == 'require-kernel.js') { - // the kernel isn’t actually on the file system. - handleEmbed(null, requireDefinition()); - } else { - fs.readFile(ROOT_DIR + filename, "utf-8", handleEmbed); - } - function handleEmbed(err, data) - { - if(ERR(err, callback)) return; - - if(type == "JS") - { - if (shortFilename == 'require-kernel.js') { - embeds[filename] = compressJS([data]); - } else { - embeds[filename] = compressJS([isolateJS(data, shortFilename)]); - } - } - else - { - embeds[filename] = compressCSS([data]); - } - callback(); - } - }, function(err) - { - if(ERR(err, callback)) return; - - fileValues["ace.js"] += ';\n' - fileValues["ace.js"] += - 'Ace2Editor.EMBEDED = Ace2Editor.EMBED || {};\n' - for (var filename in embeds) - { - fileValues["ace.js"] += - 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = ' - + JSON.stringify(embeds[filename]) + ';\n'; - } + var values = []; + tarCode( + jsFiles + , function (content) {values.push(content)} + , function (err) { + if(ERR(err)) return; + result = values.join(''); callback(); }); }, //put all together and write it into a file function(callback) { - //minify all javascript files to one - var values = []; - tarCode(jsFiles, fileValues, function (content) {values.push(content)}); - var result = compressJS(values); - async.parallel([ //write the results plain in a file function(callback) @@ -271,54 +203,123 @@ function _handle(req, res, jsFilename, jsFiles) { //minifying is disabled, so put the files together in one file else { - var fileValues = {}; - - //read all js files - async.forEach(jsFiles, function (item, callback) - { - fs.readFile(JS_DIR + item, "utf-8", function(err, data) - { - if(ERR(err, callback)) return; - fileValues[item] = data; - callback(); - }); - }, - //send all files together - function(err) - { + tarCode( + jsFiles + , function (content) {res.write(content)} + , function (err) { if(ERR(err)) return; - - tarCode(jsFiles, fileValues, function (content) {res.write(content)}); - res.end(); }); } } +// find all includes in ace.js and embed them. +function getAceFile(callback) { + fs.readFile(JS_DIR + 'ace.js', "utf8", function(err, data) { + if(ERR(err, callback)) return; + + // Find all includes in ace.js and embed them + var founds = data.match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"-]+\)/gi); + if (!settings.minify) { + founds = []; + } + founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")'); + + data += ';\n'; + data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n'; + + //go trough all includes + async.forEach(founds, function (item, callback) { + var filename = item.match(/"([^"]*)"/)[1]; + var type = item.match(/INCLUDE_([A-Z]+)/)[1]; + var shortFilename = (filename.match(/^..\/static\/js\/(.*)$/, '')||[])[1]; + + //read the included files + if (shortFilename) { + if (shortFilename == 'require-kernel.js') { + // the kernel isn’t actually on the file system. + handleEmbed(null, requireDefinition()); + } else { + var contents = ''; + tarCode(tar[shortFilename] || shortFilename + , function (content) { + contents += content; + } + , function () { + handleEmbed(null, contents); + } + ); + } + } else { + fs.readFile(ROOT_DIR + filename, "utf8", handleEmbed); + } + + function handleEmbed(error, data_) { + if (error) { + return; // Don't bother to include it. + } + if (settings.minify) { + if (type == "JS") { + try { + data_ = compressJS([data_]); + } catch (e) { + // Ignore, include uncompresseed, which will break in browser. + } + } else { + data_ = compressCSS([data_]); + } + } + data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = ' + + JSON.stringify(data_) + ';\n'; + callback(); + } + }, function(error) { + callback(error, data); + }); + }); +} + exports.requireDefinition = requireDefinition; function requireDefinition() { return 'var require = ' + RequireKernel.kernelSource + ';\n'; } -function tarCode(filesInOrder, files, write) { - for(var i = 0, ii = filesInOrder.length; i < filesInOrder.length; i++) { - var filename = filesInOrder[i]; - write("\n\n\n/*** File: static/js/" + filename + " ***/\n\n\n"); - write(isolateJS(files[filename], filename)); - } -} +function tarCode(jsFiles, write, callback) { + write('require.define({'); + var initialEntry = true; + async.forEach(jsFiles, function (filename, callback){ + if (filename == 'ace.js') { + getAceFile(handleFile); + } else { + fs.readFile(JS_DIR + filename, "utf8", handleFile); + } -// Wrap the following code in a self executing function and assign exports to -// global. This is a first step towards removing symbols from the global scope. -// exports is global and require is a function that returns global. -function isolateJS(code, filename) { - var srcPath = JSON.stringify('/' + filename); - var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, '')); - return 'require.define({' - + srcPath + ': ' - + 'function (require, exports, module) {' + code + '}' - + (srcPath != srcPathAbbv ? '\n,' + srcPathAbbv + ': null' : '') - + '});\n'; + function handleFile(err, data) { + if(ERR(err, callback)) return; + var srcPath = JSON.stringify('/' + filename); + var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, '')); + if (!initialEntry) { + write('\n,'); + } else { + initialEntry = false; + } + write(srcPath + ': ') + data = '(function (require, exports, module) {' + data + '})'; + if (settings.minify) { + write(compressJS([data])); + } else { + write(data); + } + if (srcPath != srcPathAbbv) { + write('\n,' + srcPathAbbv + ': null'); + } + + callback(); + } + }, function () { + write('});\n'); + callback(); + }); } function compressJS(values) diff --git a/node/utils/tar.json b/node/utils/tar.json index aeafe23fb..b319791cf 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -48,4 +48,18 @@ , "broadcast_revisions.js" , "timeslider.js" ] +, "ace2_inner.js": [ + "ace2_common.js" + , "skiplist.js" + , "virtual_lines.js" + , "easysync2.js" + , "cssmanager.js" + , "colorutils.js" + , "undomodule.js" + , "contentcollector.js" + , "changesettracker.js" + , "linestylefilter.js" + , "domline.js" + , "ace2_inner.js" + ] } diff --git a/package.json b/package.json index d91725d53..e60f9f583 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "name": "Robin Buse" } ], "dependencies" : { - "require-kernel" : "1.0.0", + "require-kernel" : "1.0.1", "socket.io" : "0.8.7", - "ueberDB" : "0.1.3", + "ueberDB" : "0.1.7", "async" : "0.1.15", "express" : "2.5.0", "clean-css" : "0.2.4", diff --git a/static/custom/js.template b/static/custom/js.template index e857a8bfe..152c3d5d7 100644 --- a/static/custom/js.template +++ b/static/custom/js.template @@ -1,6 +1,6 @@ -function costumStart() +function customStart() { //define your javascript here - //jquery is avaiable - except index.js + //jquery is available - except index.js //you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/ } diff --git a/static/index.html b/static/index.html index fe38318b7..97736d1ef 100644 --- a/static/index.html +++ b/static/index.html @@ -148,8 +148,8 @@ return randomstring; } - //start the costum js - if(typeof costumStart == "function") costumStart(); + // start the custom js + if (typeof customStart == "function") customStart(); diff --git a/static/js/ace.js b/static/js/ace.js index 6854b1142..049309101 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -217,40 +217,32 @@ function Ace2Editor() return {embeded: embededFiles, remote: remoteFiles}; } function pushRequireScriptTo(buffer) { - /* Folling is for packaging regular expression. */ - /* $$INCLUDE_JS("../static/js/require-kernel.js"); */ var KERNEL_SOURCE = '../static/js/require-kernel.js'; + var KERNEL_BOOT = 'require.setRootURI("../minified/");\nrequire.setGlobalKeyPath("require");' if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) { buffer.push('\ +'); + pushScriptsTo(iframeHTML); iframeHTML.push(''); iframeHTML.push(' '); @@ -362,19 +351,6 @@ function Ace2Editor() // (throbs busy while typing) outerHTML.push('', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '
x
'); - if (!Array.prototype.map) Array.prototype.map = function(fun) - { //needed for IE - if (typeof fun != "function") throw new TypeError(); - var len = this.length; - var res = new Array(len); - var thisp = arguments[1]; - for (var i = 0; i < len; i++) - { - if (i in this) res[i] = fun.call(thisp, this[i], i, this); - } - return res; - }; - var outerFrame = document.createElement("IFRAME"); outerFrame.frameBorder = 0; // for IE info.frame = outerFrame; diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 977c5cdff..31d4dac94 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -238,7 +238,7 @@ function OUTER(gscope) } // Text color - var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.45) ? '#ffffff' : '#000000'; + var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) ? '#ffffff' : '#000000'; var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))); diff --git a/static/js/broadcast.js b/static/js/broadcast.js index 2aa0b5d06..020f47e7c 100644 --- a/static/js/broadcast.js +++ b/static/js/broadcast.js @@ -25,6 +25,7 @@ var domline = require('/domline_client').domline; var Changeset = require('/easysync2_client').Changeset; var AttribPool = require('/easysync2_client').AttribPool; var linestylefilter = require('/linestylefilter_client').linestylefilter; +var colorutils = require('/colorutils').colorutils; // These parameters were global, now they are injected. A reference to the // Timeslider controller would probably be more appropriate. @@ -757,7 +758,9 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro var bgcolor = typeof data.colorId == "number" ? clientVars.colorPalette[data.colorId] : data.colorId; if (bgcolor && dynamicCSS) { - dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor; + var selector = dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)); + selector.backgroundColor = bgcolor + selector.color = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) ? '#ffffff' : '#000000'; //see ace2_inner.js for the other part } authorData[author] = data; } diff --git a/static/js/chat.js b/static/js/chat.js index e094f93df..9f0903cf5 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -106,7 +106,7 @@ var chat = (function() var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName); - var html = "

" + authorName + ":" + timeStr + " " + text + "

"; + var html = "

" + authorName + ":" + timeStr + " " + text + "

"; $("#chattext").append(html); //should we increment the counter?? diff --git a/static/js/collab_client.js b/static/js/collab_client.js index b697d4853..ec575fe0a 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -20,11 +20,6 @@ * limitations under the License. */ -$(window).bind("load", function() -{ - getCollabClient.windowLoaded = true; -}); - var chat = require('/chat').chat; // Dependency fill on init. This exists for `pad.socket` only. @@ -268,19 +263,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) }*/ } - function setUpSocketWhenWindowLoaded() - { - if (getCollabClient.windowLoaded) - { - setUpSocket(); - } - else - { - setTimeout(setUpSocketWhenWindowLoaded, 200); - } - } - setTimeout(setUpSocketWhenWindowLoaded, 0); - var hiccupCount = 0; function handleCometHiccup(params) @@ -654,8 +636,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) }, 0); } - var self; - return (self = { + var self = { setOnUserJoin: function(cb) { callbacks.onUserJoin = cb; @@ -698,7 +679,10 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) callWhenNotCommitting: callWhenNotCommitting, addHistoricalAuthors: tellAceAboutHistoricalAuthors, setChannelState: setChannelState - }); + }; + + $(document).ready(setUpSocket); + return self; } function selectElementContents(elem) diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index fd90a07be..0437ccd7b 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -26,12 +26,7 @@ var _MAX_LIST_LEVEL = 8; var Changeset = require('/easysync2').Changeset -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; function sanitizeUnicode(s) { @@ -42,15 +37,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { browser = browser || {}; - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; var dom = domInterface || { isNodeText: function(n) diff --git a/static/js/domline.js b/static/js/domline.js index 5de33c5aa..8d8c2ea9e 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -26,12 +26,8 @@ // requires: plugins // requires: undefined -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -148,20 +144,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) var extraOpenTags = ""; var extraCloseTags = ""; - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; - plugins_.callHook("aceCreateDomLine", { + map(plugins_.callHook("aceCreateDomLine", { domline: domline, cls: cls - }).map(function(modifier) + }), function(modifier) { cls = modifier.cls; extraOpenTags = extraOpenTags + modifier.extraOpenTags; diff --git a/static/js/domline_client.js b/static/js/domline_client.js index b999e3589..87b6ed558 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -25,12 +25,8 @@ // requires: plugins // requires: undefined -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -147,20 +143,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) var extraOpenTags = ""; var extraCloseTags = ""; - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; - plugins_.callHook("aceCreateDomLine", { + map(plugins_.callHook("aceCreateDomLine", { domline: domline, cls: cls - }).map(function(modifier) + }), function(modifier) { cls = modifier.cls; extraOpenTags = extraOpenTags + modifier.extraOpenTags; diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index fa1b40dee..d0b5bc6e8 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -29,12 +29,8 @@ // requires: undefined var Changeset = require('/easysync2').Changeset -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -59,15 +55,7 @@ linestylefilter.getAuthorClassName = function(author) linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool) { - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; if (lineLength == 0) return textAndClassFunc; @@ -312,21 +300,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) { var func = linestylefilter.getURLFilter(lineText, textAndClassFunc); - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; var hookFilters = plugins_.callHook("aceGetFilterStack", { linestylefilter: linestylefilter, browser: browser }); - hookFilters.map(function(hookFilter) + map(hookFilters, function(hookFilter) { func = hookFilter(lineText, func); }); diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index 7ff5bef41..f057e21a2 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -27,12 +27,8 @@ // requires: undefined var Changeset = require('/easysync2_client').Changeset -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -57,15 +53,7 @@ linestylefilter.getAuthorClassName = function(author) linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool) { - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; if (lineLength == 0) return textAndClassFunc; @@ -310,21 +298,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) { var func = linestylefilter.getURLFilter(lineText, textAndClassFunc); - var plugins_; - if (typeof(plugins) != 'undefined') - { - plugins_ = plugins; - } - else - { - plugins_ = parent.parent.plugins; - } + var plugins_ = plugins; var hookFilters = plugins_.callHook("aceGetFilterStack", { linestylefilter: linestylefilter, browser: browser }); - hookFilters.map(function(hookFilter) + map(hookFilters, function(hookFilter) { func = hookFilter(lineText, func); }); diff --git a/static/js/pad.js b/static/js/pad.js index 7eb744a12..17c2c800a 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -99,6 +99,7 @@ function getParams() var IsnoColors = params["noColors"]; var hideQRCode = params["hideQRCode"]; var rtl = params["rtl"]; + var alwaysShowChat = params["alwaysShowChat"]; if(IsnoColors) { @@ -153,6 +154,13 @@ function getParams() settings.rtlIsTrue = true } } + if(alwaysShowChat) + { + if(alwaysShowChat == "true") + { + chat.stickToScreen(); + } + } } function getUrlVars() @@ -414,8 +422,8 @@ var pad = { $(document).ready(function() { - //start the costum js - if(typeof costumStart == "function") costumStart(); + // start the custom js + if (typeof customStart == "function") customStart(); getParams(); handshake(); }); diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 9280bc7bc..8e4ffa3c9 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -24,6 +24,15 @@ var padutils = require('/pad_utils').padutils; var padeditor = require('/pad_editor').padeditor; var padsavedrevs = require('/pad_savedrevs').padsavedrevs; +function indexOf(array, value) { + for (var i = 0, ii = array.length; i < ii; i++) { + if (array[i] == value) { + return i; + } + } + return -1; +} + var padeditbar = (function() { @@ -190,7 +199,7 @@ var padeditbar = (function() } else { - var nth_child = modules.indexOf(moduleName) + 1; + var nth_child = indexOf(modules, moduleName) + 1; if (nth_child > 0 && nth_child <= 3) { $("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected"); $("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("selected"); diff --git a/static/js/plugins.js b/static/js/plugins.js index ce3ec9bd7..3e226eba1 100644 --- a/static/js/plugins.js +++ b/static/js/plugins.js @@ -4,7 +4,7 @@ * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ -plugins = { +var plugins = { callHook: function(hookName, args) { var global = (function () {return this}()); @@ -25,10 +25,12 @@ plugins = { if (sep == undefined) sep = ''; if (pre == undefined) pre = ''; if (post == undefined) post = ''; - return plugins.callHook(hookName, args).map(function(x) - { - return pre + x + post - }).join(sep || ""); + var newCallhooks = []; + var callhooks = plugins.callHook(hookName, args); + for (var i = 0, ii = callhooks.length; i < ii; i++) { + newCallhooks[i] = pre + callhooks[i] + post; + } + return newCallhooks.join(sep || ""); } }; diff --git a/static/js/timeslider.js b/static/js/timeslider.js index a36bd628a..d2fce8fd7 100644 --- a/static/js/timeslider.js +++ b/static/js/timeslider.js @@ -65,8 +65,8 @@ var socket, token, padId, export_links; function init() { $(document).ready(function () { - //start the costum js - if(typeof costumStart == "function") costumStart(); + // start the custom js + if (typeof customStart == "function") customStart(); //get the padId out of the url var urlParts= document.location.pathname.split("/"); diff --git a/static/pad.html b/static/pad.html index e2e4690c2..0345d65b0 100644 --- a/static/pad.html +++ b/static/pad.html @@ -11,14 +11,6 @@ - - - - - -
- + + + +