From e8ef99fb728aa792e697e29542ae15b5c06bc774 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 16 Dec 2011 15:41:11 -0500 Subject: [PATCH 001/265] Sanitize pad names --- node/db/PadManager.js | 41 +++++++++++ node/handler/APIHandler.js | 29 +++++++- node/server.js | 141 +++++++++++++++++++------------------ static/js/pad2.js | 2 +- static/timeslider.html | 2 +- 5 files changed, 145 insertions(+), 70 deletions(-) diff --git a/node/db/PadManager.js b/node/db/PadManager.js index 36c272637..1aadcd1ff 100644 --- a/node/db/PadManager.js +++ b/node/db/PadManager.js @@ -38,6 +38,14 @@ var globalPads = { remove: function (name) { delete this[':'+name]; } }; +/** + * An array of padId transformations. These represent changes in pad name policy over + * time, and allow us to "play back" these changes so legacy padIds can be found. + */ +var padIdTransforms = [ + [/\s+/g, '_'] +]; + /** * Returns a Pad Object with the callback * @param id A String with the id of the pad @@ -110,6 +118,39 @@ exports.doesPadExists = function(padId, callback) }); } +//returns a sanitized padId, respecting legacy pad id formats +exports.sanitizePadId = function(padId, callback) { + var transform_index = arguments[2] || 0; + //we're out of possible transformations, so just return it + if(transform_index >= padIdTransforms.length) + { + callback(padId); + } + //check if padId exists + else + { + exports.doesPadExists(padId, function(junk, exists) + { + if(exists) + { + callback(padId); + } + else + { + //get the next transformation *that's different* + var transformedPadId = padId; + while(transformedPadId == padId && transform_index < padIdTransforms.length) + { + transformedPadId = padId.replace(padIdTransforms[transform_index][0], padIdTransforms[transform_index][1]); + transform_index += 1; + } + //check the next transform + exports.sanitizePadId(transformedPadId, callback, transform_index); + } + }); + } +} + exports.isValidPadId = function(padId) { return /^(g.[a-zA-Z0-9]{16}\$)?[^$]{1,50}$/.test(padId); diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js index 5c29f9e4c..0cd9cb58e 100644 --- a/node/handler/APIHandler.js +++ b/node/handler/APIHandler.js @@ -21,6 +21,7 @@ var ERR = require("async-stacktrace"); var fs = require("fs"); var api = require("../db/API"); +var padManager = require("../db/PadManager"); //ensure we have an apikey var apikey = null; @@ -95,7 +96,33 @@ exports.handle = function(functionName, fields, req, res) res.send({code: 3, message: "no such function", data: null}); return; } - + + //sanitize any pad id's before continuing + if(fields["padID"]) + { + padManager.sanitizePadId(fields["padID"], function(padId) + { + fields["padID"] = padId; + callAPI(functionName, fields, req, res); + }); + } + else if(fields["padName"]) + { + padManager.sanitizePadId(fields["padName"], function(padId) + { + fields["padName"] = padId; + callAPI(functionName, fields, req, res); + }); + } + else + { + callAPI(functionName, fields, req, res); + } +} + +//calls the api function +function callAPI(functionName, fields, req, res) +{ //put the function parameters in an array var functionParams = []; for(var i=0;i' + real_path + '', 302); + } + //the pad id was fine, so just render it + else + { + render(); + } + }); + } + } + + //serve pad.html under /p + app.get('/p/:pad', function(req, res, next) + { + goToPad(req, res, function() { + res.header("Server", serverName); + var filePath = path.normalize(__dirname + "/../static/pad.html"); + res.sendfile(filePath, { maxAge: exports.maxAge }); + }); }); //serve timeslider.html under /p/$padname/timeslider app.get('/p/:pad/timeslider', function(req, res, next) { - //ensure the padname is valid and the url doesn't end with a / - if(!padManager.isValidPadId(req.params.pad) || /\/$/.test(req.url)) - { - res.send('Such a padname is forbidden', 404); - return; - } - - res.header("Server", serverName); - var filePath = path.normalize(__dirname + "/../static/timeslider.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); + goToPad(req, res, function() { + res.header("Server", serverName); + var filePath = path.normalize(__dirname + "/../static/timeslider.html"); + res.sendfile(filePath, { maxAge: exports.maxAge }); + }); }); //serve timeslider.html under /p/$padname/timeslider app.get('/p/:pad/export/:type', function(req, res, next) { - //ensure the padname is valid and the url doesn't end with a / - if(!padManager.isValidPadId(req.params.pad) || /\/$/.test(req.url)) - { - res.send('Such a padname is forbidden', 404); - return; - } - - var types = ["pdf", "doc", "txt", "html", "odt", "dokuwiki"]; - //send a 404 if we don't support this filetype - if(types.indexOf(req.params.type) == -1) - { - next(); - return; - } - - //if abiword is disabled, and this is a format we only support with abiword, output a message - if(settings.abiword == null && - ["odt", "pdf", "doc"].indexOf(req.params.type) !== -1) - { - res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature"); - return; - } - - res.header("Access-Control-Allow-Origin", "*"); - res.header("Server", serverName); - - hasPadAccess(req, res, function() - { - exportHandler.doExport(req, res, req.params.pad, req.params.type); + goToPad(req, res, function() { + var types = ["pdf", "doc", "txt", "html", "odt", "dokuwiki"]; + //send a 404 if we don't support this filetype + if(types.indexOf(req.params.type) == -1) + { + next(); + return; + } + + //if abiword is disabled, and this is a format we only support with abiword, output a message + if(settings.abiword == null && + ["odt", "pdf", "doc"].indexOf(req.params.type) !== -1) + { + res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature"); + return; + } + + res.header("Access-Control-Allow-Origin", "*"); + res.header("Server", serverName); + + hasPadAccess(req, res, function() + { + exportHandler.doExport(req, res, req.params.pad, req.params.type); + }); }); }); //handle import requests app.post('/p/:pad/import', function(req, res, next) { - //ensure the padname is valid and the url doesn't end with a / - if(!padManager.isValidPadId(req.params.pad) || /\/$/.test(req.url)) - { - res.send('Such a padname is forbidden', 404); - return; - } - - //if abiword is disabled, skip handling this request - if(settings.abiword == null) - { - next(); - return; - } + goToPad(req, res, function() { + //if abiword is disabled, skip handling this request + if(settings.abiword == null) + { + next(); + return; + } - res.header("Server", serverName); - - hasPadAccess(req, res, function() - { - importHandler.doImport(req, res, req.params.pad); + res.header("Server", serverName); + + hasPadAccess(req, res, function() + { + importHandler.doImport(req, res, req.params.pad); + }); }); }); var apiLogger = log4js.getLogger("API"); //This is for making an api call, collecting all post information and passing it to the apiHandler - var apiCaller = function(req, res, fields) { + var apiCaller = function(req, res, fields) + { res.header("Server", serverName); res.header("Content-Type", "application/json; charset=utf-8"); diff --git a/static/js/pad2.js b/static/js/pad2.js index b75c1f9cc..bbb385b3b 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -194,7 +194,7 @@ function handshake() padId = decodeURIComponent(padId); // unescape neccesary due to Safari and Opera interpretation of spaces if(!isReconnect) - document.title = document.title + " | " + padId; + document.title = document.title + " | " + padId.replace(/_+/g, ' '); var token = readCookie("token"); if (token == null) diff --git a/static/timeslider.html b/static/timeslider.html index 11c5ef7f4..4ca11f3a7 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -65,7 +65,7 @@ padId = decodeURIComponent(urlParts[urlParts.length-2]); //set the title - document.title = document.title + " | " + padId; + document.title = document.title + " | " + padId.replace(/_+/g, ' '); //ensure we have a token token = readCookie("token"); From 2a86d57e4672d8e9740f8d4121ff53a8cd294f6c Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 18 Dec 2011 00:18:35 -0500 Subject: [PATCH 002/265] Add ability to export specific pad revisions --- node/handler/ExportHandler.js | 16 ++++++--- node/handler/PadMessageHandler.js | 10 +----- node/handler/TimesliderMessageHandler.js | 2 ++ node/server.js | 2 +- node/utils/Minify.js | 2 +- node/utils/Settings.js | 14 ++++++++ static/css/timeslider.css | 5 +++ static/js/pad_editbar.js | 2 +- static/js/pad_impexp.js | 29 +++++++++------- static/timeslider.html | 43 +++++++++++++++++++++++- 10 files changed, 96 insertions(+), 29 deletions(-) diff --git a/node/handler/ExportHandler.js b/node/handler/ExportHandler.js index a38c01606..1b7fcc26d 100644 --- a/node/handler/ExportHandler.js +++ b/node/handler/ExportHandler.js @@ -53,8 +53,16 @@ exports.doExport = function(req, res, padId, type) padManager.getPad(padId, function(err, pad) { ERR(err); - - res.send(pad.text()); + if(req.params.rev){ + pad.getInternalRevisionAText(req.params.rev, function(junk, text) + { + res.send(text.text ? text.text : null); + }); + } + else + { + res.send(pad.text()); + } }); } else if(type == 'dokuwiki') @@ -66,7 +74,7 @@ exports.doExport = function(req, res, padId, type) //render the dokuwiki document function(callback) { - exportdokuwiki.getPadDokuWikiDocument(padId, null, function(err, dokuwiki) + exportdokuwiki.getPadDokuWikiDocument(padId, req.params.rev, function(err, dokuwiki) { res.send(dokuwiki); callback("stop"); @@ -87,7 +95,7 @@ exports.doExport = function(req, res, padId, type) //render the html document function(callback) { - exporthtml.getPadHTMLDocument(padId, null, false, function(err, _html) + exporthtml.getPadHTMLDocument(padId, req.params.rev, false, function(err, _html) { if(ERR(err, callback)) return; html = _html; diff --git a/node/handler/PadMessageHandler.js b/node/handler/PadMessageHandler.js index d86528498..0b48320b3 100644 --- a/node/handler/PadMessageHandler.js +++ b/node/handler/PadMessageHandler.js @@ -28,7 +28,6 @@ var readOnlyManager = require("../db/ReadOnlyManager"); var settings = require('../utils/Settings'); var securityManager = require("../db/SecurityManager"); var log4js = require('log4js'); -var os = require("os"); var messageLogger = log4js.getLogger("message"); /** @@ -755,13 +754,6 @@ function handleClientReady(client, message) var apool = attribsForWire.pool.toJsonable(); atext.attribs = attribsForWire.translated; - //check if abiword is avaiable - var abiwordAvailable = settings.abiword != null ? "yes" : "no"; - if(settings.abiword != null && os.type().indexOf("Windows") != -1) - { - abiwordAvailable = "withoutPDF"; - } - var clientVars = { "accountPrivs": { "maxRevisions": 100 @@ -798,7 +790,7 @@ function handleClientReady(client, message) "fullWidth": false, "hideSidebar": false }, - "abiwordAvailable": abiwordAvailable, + "abiwordAvailable": settings.abiwordAvailable(), "hooks": {} } diff --git a/node/handler/TimesliderMessageHandler.js b/node/handler/TimesliderMessageHandler.js index b3493d8cb..b30a9fc9d 100644 --- a/node/handler/TimesliderMessageHandler.js +++ b/node/handler/TimesliderMessageHandler.js @@ -23,6 +23,7 @@ var async = require("async"); var padManager = require("../db/PadManager"); var Changeset = require("../utils/Changeset"); var AttributePoolFactory = require("../utils/AttributePoolFactory"); +var settings = require('../utils/Settings'); var authorManager = require("../db/AuthorManager"); var log4js = require('log4js'); var messageLogger = log4js.getLogger("message"); @@ -160,6 +161,7 @@ function createTimesliderClientVars (padId, callback) fullWidth: false, disableRightBar: false, initialChangesets: [], + abiwordAvailable: settings.abiwordAvailable(), hooks: [], initialStyledContents: {} }; diff --git a/node/server.js b/node/server.js index 461e82693..827bd5828 100644 --- a/node/server.js +++ b/node/server.js @@ -264,7 +264,7 @@ async.waterfall([ }); //serve timeslider.html under /p/$padname/timeslider - app.get('/p/:pad/export/:type', function(req, res, next) + app.get('/p/:pad/:rev?/export/:type', function(req, res, next) { //ensure the padname is valid and the url doesn't end with a / if(!padManager.isValidPadId(req.params.pad) || /\/$/.test(req.url)) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index fd1dd0793..588456fd9 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -34,7 +34,7 @@ var os = require('os'); var padJS = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js", "excanvas.js", "farbtastic.js"]; -var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"]; +var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "pad_impexp.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"]; /** * creates the minifed javascript for the given minified name diff --git a/node/utils/Settings.js b/node/utils/Settings.js index 7ef809c91..43c22975e 100644 --- a/node/utils/Settings.js +++ b/node/utils/Settings.js @@ -20,6 +20,7 @@ */ var fs = require("fs"); +var os = require("os"); /** * The IP ep-lite should listen to @@ -73,6 +74,19 @@ exports.loglevel = "INFO"; */ exports.httpAuth = null; +//checks if abiword is avaiable +exports.abiwordAvailable = function() +{ + if(exports.abiword != null) + { + return os.type().indexOf("Windows") != -1 ? "withoutPDF" : "yes"; + } + else + { + return "no"; + } +} + //read the settings sync var settingsStr = fs.readFileSync("../settings.json").toString(); diff --git a/static/css/timeslider.css b/static/css/timeslider.css index f03f70c92..e34509322 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -195,6 +195,11 @@ float:right; color: #222; } +#importexport{ + top:103px; + width:185px; +} + ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } ul.list-bullet1 { margin-left: 1.5em; } diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 9de23f82e..b4b4c1cca 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -156,7 +156,7 @@ var padeditbar = (function() }, cmd, true); } } - padeditor.ace.focus(); + if(padeditor.ace) padeditor.ace.focus(); }, toogleDropDown: function(moduleName) { diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 4cf7ffcd8..2f519a1ec 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -236,11 +236,16 @@ var padimpexp = (function() var self = { init: function() { + //get /p/padname + var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) + //get http://example.com/p/padname + var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path) + // build the export links - $("#exporthtmla").attr("href", document.location.pathname + "/export/html"); - $("#exportplaina").attr("href", document.location.pathname + "/export/txt"); - $("#exportwordlea").attr("href", document.location.pathname + "/export/wordle"); - $("#exportdokuwikia").attr("href", document.location.pathname + "/export/dokuwiki"); + $("#exporthtmla").attr("href", pad_root_path + "/export/html"); + $("#exportplaina").attr("href", pad_root_path + "/export/txt"); + $("#exportwordlea").attr("href", pad_root_path + "/export/wordle"); + $("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki"); //hide stuff thats not avaible if abiword is disabled if(clientVars.abiwordAvailable == "no") @@ -256,21 +261,21 @@ var padimpexp = (function() { $("#exportpdfa").remove(); - $("#exportworda").attr("href", document.location.pathname + "/export/doc"); - $("#exportopena").attr("href", document.location.pathname + "/export/odt"); + $("#exportworda").attr("href", pad_root_path + "/export/doc"); + $("#exportopena").attr("href", pad_root_path + "/export/odt"); $("#importexport").css({"height":"142px"}); $("#importexportline").css({"height":"142px"}); - $("#importform").get(0).setAttribute('action', document.location.href + "/import"); + $("#importform").attr('action', pad_root_url + "/import"); } else { - $("#exportworda").attr("href", document.location.pathname + "/export/doc"); - $("#exportpdfa").attr("href", document.location.pathname + "/export/pdf"); - $("#exportopena").attr("href", document.location.pathname + "/export/odt"); + $("#exportworda").attr("href", pad_root_path + "/export/doc"); + $("#exportpdfa").attr("href", pad_root_path + "/export/pdf"); + $("#exportopena").attr("href", pad_root_path + "/export/odt"); - $("#importform").get(0).setAttribute('action', document.location.pathname + "/import"); + $("#importform").attr('action', pad_root_path + "/import"); } $("#impexp-close").click(function() @@ -308,7 +313,7 @@ var padimpexp = (function() }, export2Wordle: function() { - var padUrl = document.location.href + "/export/txt"; + var padUrl = $('#exportwordlea').attr('href').replace(/\/wordle$/, '/txt') $.get(padUrl, function(data) { diff --git a/static/timeslider.html b/static/timeslider.html index 11c5ef7f4..a03385e57 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -53,7 +53,7 @@ return "t." + randomstring; } - var socket, token, padId; + var socket, token, padId, export_links; $(document).ready(function () { @@ -110,6 +110,9 @@ $("body").html("

You have no permission to access this pad

") } }); + + //get all the export links + export_links = $('#export > .exportlink') }); //sends a message over the socket @@ -141,6 +144,19 @@ loadBroadcastSliderJS(); loadBroadcastRevisionsJS(); loadBroadcastJS(); + + //initialize export ui + padimpexp.init(); + + //change export urls when the slider moves + var export_rev_regex = /(\/\d+)?\/export/ + BroadcastSlider.onSlider(function(revno) + { + export_links.each(function() + { + this.setAttribute('href', this.href.replace(export_rev_regex, '/' + revno + '/export')); + }); + }); //fire all start functions of these scripts, formerly fired with window.load for(var i=0;i < fireWhenAllScriptsAreLoaded.length;i++) @@ -269,6 +285,13 @@
+ Return to pad @@ -24,55 +25,55 @@
From 20b63f1fa7dfa590f824a77022f7ff0269e30f76 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 13 Jan 2012 23:58:01 +0100 Subject: [PATCH 013/265] Merged and optimized icons --- static/img/etherpad_lite_icons.png | Bin 2307 -> 5686 bytes static/img/fileicons.gif | Bin 1649 -> 0 bytes static/img/nw-resize.png | Bin 452 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 static/img/fileicons.gif delete mode 100644 static/img/nw-resize.png diff --git a/static/img/etherpad_lite_icons.png b/static/img/etherpad_lite_icons.png index 606612313dd64b158a7ad0007a56271346aa53ac..b22da518cf974b2265ecab982299f3939f57f78f 100644 GIT binary patch literal 5686 zcmV-67Rl*}P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000%GNkljrKQG({AsHjMa zqEje?x{Bkb4*%$+-zMvort=uNI5005AaOFDvV-MZEAkDx%-uU{_#xEwfepnN8F z8(pqCaRcyVohlG78VIDhz1GRg%cIk$Piq}c%ZW7vqVd3i0|{Px^5jYP@E92xNg*L2 zrdW#DI&|nz*%(o7;>3xjdV>?hjh;PwQros|X~BYprrvNrK0aRF!(JZ`0?WjM=w2FX(T5Az$Aqu6Q~oH+qnd(5Ke*- zL2XlUibdFiKAa|PS7)nItVu=EItVh*i!R1`F@KfE{(mnmT;1M_8E+qmTlCV^S8lYo z+c5g#go*tqJ0Lu&J*q%sSm75NfQTrvpq z19r(>lXb8wpCYmpE9cLbA@Ex9_jF}frYtzeJ=7szpr(dQAOJuv;BrA8iPX5ZAQ^)t zyqdE%Wpd`uijck90c;PSE;*Iy4?zo2P1ZrO#R~w$LMNxTZ!~tVrroHh71x0!HT5H! zHgzmr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Nl%%FB(v7g{NMTs1grVeA@%JVlu|&ihd^6JNcEcD5yIo{Y3{xOP z*CDRU0$mPx5(TQ!OY(pg14d*UO;x9c0YOnrgw#5~tP!jI3gAMqhUQ)%K-dquq8Kga zd8tVdKWs{PJhs%teAsMCblOZoY&uR;6wGu+JDS!p&vizlO}|8+@siWxXS}PY&ocrN zOrK{4OiT#rd5x?w<_Oor`+oKYW}j_KzCf1843C&TVMiEv5Hr17P27;ka;0R90D6gb z+{96Vl5zfA;|lqZ)$+qsvUM3&hfuzV&-N83`N@N$OwU}7IjP2T7rHOfm3$& z3DT$4Szt!UB9WDqm06;*NWV|CETX;$9xP68KA3K`fHiAkU~%!o%JhTQXtcEvjg`&T zW@~zs_OJprTdme;>xUFrX?@sieV9mr)+SP#NB~sCk~A4jByqdXjeB9gKy?XWPb(J(3UwF8?zWeZSd|{jb>cW%l_4Qxg-i|d!)E9^A>u+zX<0Ek| z*Pm=}AF8UlMZG*w)v2i$G)yTrfjx;INPAmd5mZW=MrIl=ozqH*Wl3Hmm3ax=E^e)4x@bn?;bcNAEi zoc!%q@%7~7`=pms@`aKAUA`>M?o%LM>r2ma`Eqn6n=h+B9<655##5YLqo6UZv_RBD_K+*{XcWxJ+4j&NSik^^rZFZ!yAd?dKYL%D dM>2T3`WL`2cP$2MSY-eJ002ovPDHLkV1nkYhF1Up diff --git a/static/img/fileicons.gif b/static/img/fileicons.gif deleted file mode 100644 index c03b6031a62780479212fe50240ccb60dd3750b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1649 zcmV-%29EhhNk%w1VG#hQ0LFg+N=i!c@$svxtN8f%?Ck87m6fH(lWA#bk>88L!^5H0 zkZhRMh{M*(%FAi5&)DhJ@UW|TdV1ENII*#@+}zw~iqb`iz>v zf~|G_{{L2K$m;6q^z-xg+Sq8atmy3bRMTo|S1^Qxgj#dVR;1GS>F8CtoVe@D)85Wm zebCj_)SjN7e3;j!+1Po*$&9wKinoi9rQ7nuzvO&%e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)DlN!P z<4iR0IOH1S(|F~mjqHL8nQP7l8$zq7iPYGRY$64t$G)8EVoO&xOlQMw)7ozL?)!JJ zColmJFT4N*5Nikk2O4P(AOH|?M4!U+)Mt?c8fc)s#`ZuIF2D@Z2_#_s6gj~0#|tR{ zA$*qKi+_Fj1N v0ZdU3Bme>lvQU7+4Wfq=KpzEOu){IBpb!E`00punN5K){iN9k+AOHY6T+#W% diff --git a/static/img/nw-resize.png b/static/img/nw-resize.png deleted file mode 100644 index b6c5e3956a9a5af065f612644cdfc61e5a9df466..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmV;#0XzPQP)ZUOIEANKpPhp z6X{o+SN%0{obm3Di*EoLfCeDZKc}SU1?WpDSOB!3b_n66a-sJts6L?50$>4J1;7Iw zjSZro01B7{_-O&qhBn~nZWMr>AHlqUo~;0upe;DN(E#lH80I``X2`o~J%I zKg$J?%meJ)v-47c9pr+j%Y-r>SOm5VttB8zUZ>YqX3XEd1)h(g3W5T2K%i(p4Hwj8 z%t;=jI*2anTh-olF<}jI0sI6a?tQekVfJ|!vH@s_4n*gFC|6Vp1MI-OcQI*Y1)xHK zN=d7bZP#TM0CX!l6mW@G(-eS?fS&Ds)db5J5CFPn`z|J^MfIB$^%VV=&fpeEk&G#7 usj-s(wJ2L27+pWrx8uM4DsBK~R=xo&Yt|tOTFVUp0000 Date: Fri, 13 Jan 2012 23:58:47 +0100 Subject: [PATCH 014/265] Changed position values --- static/css/pad.css | 29 +++++++++++++++-------------- static/pad.html | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 933b7af12..5d95c9f44 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -970,14 +970,15 @@ position: relative; } .ui-resizable-nw { - background-image: url("../img/nw-resize.png"); + background-image: url("../../static/img/etherpad_lite_icons.png"); + background-position: 0 -416px; background-repeat: no-repeat; background-size: 100% auto; cursor: nw-resize; - height: 22px; - left: 0; - top: 0; - width: 22px; + height: 17px; + left: 3px; + top: 3px; + width: 17px; } .ui-resizable-ne @@ -1022,10 +1023,10 @@ position: relative; } .exporttype{ - line-height:25px; + line-height:20px; background-repeat:no-repeat; padding-left:25px; - background-image: url("../img/fileicons.gif"); + background-image: url("../../static/img/etherpad_lite_icons.png"); color:#fff; text-decoration:none; } @@ -1045,31 +1046,31 @@ position: relative; } #exporthtml{ - background-position: 2px -25px; + background-position: 0px -299px; } #exportplain{ - background-position: 2px -121px; + background-position: 0px -395px; } #exportword{ - background-position: 2px -0px; + background-position: 0px -275px; } #exportpdf{ - background-position: 2px -97px; + background-position: 0px -371px; } #exportopen{ - background-position: 2px -74px; + background-position: 0px -347px; } #exportwordle{ - background-position: 2px -49px; + background-position: 0px -323px; } #exportdokuwiki{ - background-position: 2px -144px; + background-position: 0px -459px; } #export a{ diff --git a/static/pad.html b/static/pad.html index 4324544e1..c6fd3e774 100644 --- a/static/pad.html +++ b/static/pad.html @@ -100,7 +100,7 @@
  • -
    +
    1
  • From 42eee71295c51f165471c876d9e4e9088d38f5cb Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 14 Jan 2012 15:07:11 +0100 Subject: [PATCH 015/265] Fixed file input readability in Chrome --- static/css/pad.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 933b7af12..fed8c2879 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -92,10 +92,6 @@ a img background: -webkit-linear-gradient(#ddd, #fff); } -input[type="file"] { - color: #000; -} - #editbar ul li.separator { border: inherit; From f9b0b10709765436bbc42ac613e60befe8ee7b77 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sat, 14 Jan 2012 16:16:35 +0100 Subject: [PATCH 016/265] made 0ip images so that Pita likes them --- static/img/etherpad_lite_icons.png | Bin 5686 -> 7625 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/static/img/etherpad_lite_icons.png b/static/img/etherpad_lite_icons.png index b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T%5m~{)JyrtX#a%oXsE-DP<{{R|S+ASw{aO4aC0000< KMNUMnLSTaBiM`JN From f08e68c8f93a2a504bbf44e8a2fdde34f9ffcaf1 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 14 Jan 2012 21:41:41 +0100 Subject: [PATCH 017/265] Addition for 720px phones (forgot index.html) --- static/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index eb41e8afd..1e1861639 100644 --- a/static/index.html +++ b/static/index.html @@ -86,7 +86,7 @@ } input[type="submit"]::-moz-focus-inner { border: 0 } @-moz-document url-prefix() { input[type="submit"] { padding: 7px } } - @media only screen and (min-device-width: 320px) and (max-device-width: 600px) { + @media only screen and (min-device-width: 320px) and (max-device-width: 720px) { body { background: #bbb; background: -webkit-linear-gradient(#aaa,#eee 60%) center fixed; @@ -145,4 +145,4 @@ //start the costum js if(typeof costumStart == "function") costumStart(); - \ No newline at end of file + From 6e36b59a59d15916d3581c7a9dbad490cab4dcfb Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 14 Jan 2012 14:46:15 -0800 Subject: [PATCH 018/265] All escaping functions replace HTML reserved characters. --- node/utils/ExportHtml.js | 5 +++-- static/js/ace2_common.js | 9 ++++++++- static/js/domline.js | 2 +- static/js/pad_utils.js | 9 ++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js index 46ed980a5..ef85d51f1 100644 --- a/node/utils/ExportHtml.js +++ b/node/utils/ExportHtml.js @@ -429,14 +429,15 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) function _escapeHTML(s) { - var re = /[&<>]/g; + var re = /[&"<>]/g; if (!re.MAP) { // persisted across function calls! re.MAP = { '&': '&', + '"': '"', '<': '<', - '>': '>', + '>': '>' }; } diff --git a/static/js/ace2_common.js b/static/js/ace2_common.js index 1246a16ec..1e5c415c7 100644 --- a/static/js/ace2_common.js +++ b/static/js/ace2_common.js @@ -142,7 +142,14 @@ function binarySearchInfinite(expectedLength, func) function htmlPrettyEscape(str) { - return str.replace(/&/g, '&').replace(//g, '>').replace(/\r?\n/g, '\\n'); + return str.replace(/[&"<>]/g, function (c) { + return { + '&': '&', + '"': '"', + '<': '<', + '>': '>' + }[c] || c; + }).replace(/\r?\n/g, '\\n'); } if (typeof exports !== "undefined") diff --git a/static/js/domline.js b/static/js/domline.js index 56f74a1cd..b0fbcc8c1 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -229,7 +229,7 @@ domline.escapeHTML = function(s) '&': '&', '<': '<', '>': '>', - '"': '"', + '"': '"', "'": ''' }; } diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index 76a167057..bd028485d 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -23,7 +23,14 @@ var padutils = { escapeHtml: function(x) { - return String(x).replace(/\/g, '>'); + return String(x).replace(/[&"<>]/g, function (c) { + return { + '&': '&', + '"': '"', + '<': '<', + '>': '>' + }[c] || c; + }); }, uniqueId: function() { From 387dd4a48bd07abf8d375b457be117fbbb6778d3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 14 Jan 2012 14:50:23 -0800 Subject: [PATCH 019/265] The value of all href attributes is escaped. --- node/utils/ExportHtml.js | 2 +- static/js/domline.js | 2 +- static/js/domline_client.js | 2 +- static/js/pad_utils.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js index ef85d51f1..c699c4119 100644 --- a/node/utils/ExportHtml.js +++ b/node/utils/ExportHtml.js @@ -292,7 +292,7 @@ function getHTMLFromAtext(pad, atext) var url = urlData[1]; var urlLength = url.length; processNextChars(startIndex - idx); - assem.append(''); + assem.append(''); processNextChars(urlLength); assem.append(''); }); diff --git a/static/js/domline.js b/static/js/domline.js index b0fbcc8c1..3456419c4 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -162,7 +162,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { href = "http://"+href; } - extraOpenTags = extraOpenTags + ''; + extraOpenTags = extraOpenTags + ''; extraCloseTags = '' + extraCloseTags; } if (simpleTags) diff --git a/static/js/domline_client.js b/static/js/domline_client.js index a152412c9..cac753b96 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -158,7 +158,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if (href) { - extraOpenTags = extraOpenTags + ''; + extraOpenTags = extraOpenTags + ''; extraCloseTags = '' + extraCloseTags; } if (simpleTags) diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index bd028485d..9083fa9b6 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -187,7 +187,7 @@ var padutils = { var startIndex = urls[j][0]; var href = urls[j][1]; advanceTo(startIndex); - pieces.push(''); + pieces.push(''); advanceTo(startIndex + href.length); pieces.push(''); } From 77804673d7bf7f3df455bb42c479203e9455c68d Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 14 Jan 2012 16:12:03 -0800 Subject: [PATCH 020/265] Move packaging info into its own file. --- node/utils/Minify.js | 19 ++++++------------ node/utils/tar.json | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 node/utils/tar.json diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 588456fd9..330c5810a 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -32,9 +32,8 @@ var gzip = require('gzip'); var server = require('../server'); var os = require('os'); -var padJS = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js", "excanvas.js", "farbtastic.js"]; - -var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "pad_impexp.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"]; +var TAR_PATH = path.join(__dirname, 'tar.json'); +var tar = JSON.parse(fs.readFileSync(TAR_PATH, 'utf8')); /** * creates the minifed javascript for the given minified name @@ -46,16 +45,10 @@ exports.minifyJS = function(req, res, jsFilename) res.header("Content-Type","text/javascript"); //choose the js files we need - if(jsFilename == "pad.js") - { - jsFiles = padJS; - } - else if(jsFilename == "timeslider.js") - { - jsFiles = timesliderJS; - } - else - { + var jsFiles = undefined; + if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) { + jsFiles = tar[jsFilename]; + } else { throw new Error("there is no profile for creating " + name); } diff --git a/node/utils/tar.json b/node/utils/tar.json new file mode 100644 index 000000000..7cb606943 --- /dev/null +++ b/node/utils/tar.json @@ -0,0 +1,47 @@ +{ + "pad.js": [ + "jquery.min.js" + , "pad_utils.js" + , "plugins.js" + , "undo-xpopup.js" + , "json2.js" + , "pad_cookie.js" + , "pad_editor.js" + , "pad_editbar.js" + , "pad_docbar.js" + , "pad_modals.js" + , "ace.js" + , "collab_client.js" + , "pad_userlist.js" + , "pad_impexp.js" + , "pad_savedrevs.js" + , "pad_connectionstatus.js" + , "pad2.js" + , "jquery-ui.js" + , "chat.js" + , "excanvas.js" + , "farbtastic.js" + ] +, "timeslider.js": [ + "jquery.min.js" + , "plugins.js" + , "undo-xpopup.js" + , "json2.js" + , "colorutils.js" + , "draggable.js" + , "pad_utils.js" + , "pad_cookie.js" + , "pad_editor.js" + , "pad_editbar.js" + , "pad_docbar.js" + , "pad_modals.js" + , "pad_impexp.js" + , "easysync2_client.js" + , "domline_client.js" + , "linestylefilter_client.js" + , "cssmanager_client.js" + , "broadcast.js" + , "broadcast_slider.js" + , "broadcast_revisions.js" + ] +} From f4dca37a933fc80c79ffbdf8d2d9e1dfd9968023 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 15 Jan 2012 17:20:20 +0000 Subject: [PATCH 021/265] Ordered list support --- node/utils/ExportHtml.js | 90 +++++++++++++++--- node/utils/contentcollector.js | 4 +- static/css/iframe_editor.css | 21 ++++- static/css/pad.css | 4 + static/css/timeslider.css | 37 ++++++++ static/img/fileicons.gif | Bin 0 -> 1649 bytes static/js/ace2_inner.js | 136 ++++++++++++++++++++++++++-- static/js/contentcollector.js | 2 +- static/js/domline.js | 14 ++- static/js/domline_client.js | 23 ++++- static/js/linestylefilter.js | 4 + static/js/linestylefilter_client.js | 6 +- static/js/pad_editbar.js | 1 + static/pad.html | 5 + 14 files changed, 316 insertions(+), 31 deletions(-) create mode 100644 static/img/fileicons.gif diff --git a/node/utils/ExportHtml.js b/node/utils/ExportHtml.js index c699c4119..d4be80d20 100644 --- a/node/utils/ExportHtml.js +++ b/node/utils/ExportHtml.js @@ -309,13 +309,14 @@ function getHTMLFromAtext(pad, atext) // People might use weird indenting, e.g. skip a level, // so we want to do something reasonable there. We also // want to deal gracefully with blank lines. + // => keeps track of the parents level of indentation var lists = []; // e.g. [[1,'bullet'], [3,'bullet'], ...] for (var i = 0; i < textLines.length; i++) { var line = _analyzeLine(textLines[i], attribLines[i], apool); var lineContent = getLineHTML(line.text, line.aline); - - if (line.listLevel || lists.length > 0) + + if (line.listLevel)//If we are inside a list { // do list stuff var whichList = -1; // index into lists or -1 @@ -331,41 +332,89 @@ function getHTMLFromAtext(pad, atext) } } - if (whichList >= lists.length) + if (whichList >= lists.length)//means we are on a deeper level of indentation than the previous line { lists.push([line.listLevel, line.listTypeName]); - pieces.push('
    • ', lineContent || '
      '); + if(line.listTypeName == "number") + { + pieces.push('
      1. ', lineContent || '
        '); + } + else + { + pieces.push('
        • ', lineContent || '
          '); + } } - else if (whichList == -1) + //the following code *seems* dead after my patch. + //I keep it just in case I'm wrong... + /*else if (whichList == -1)//means we are not inside a list { if (line.text) { + console.log('trace 1'); // non-blank line, end all lists - pieces.push(new Array(lists.length + 1).join('
        • ')); + if(line.listTypeName == "number") + { + pieces.push(new Array(lists.length + 1).join('
      ')); + } + else + { + pieces.push(new Array(lists.length + 1).join('
    ')); + } lists.length = 0; pieces.push(lineContent, '
    '); } else { + console.log('trace 2'); pieces.push('

    '); } - } - else + }*/ + else//means we are getting closer to the lowest level of indentation { while (whichList < lists.length - 1) { - pieces.push(''); + if(lists[lists.length - 1][1] == "number") + { + pieces.push(''); + } + else + { + pieces.push(''); + } lists.length--; } pieces.push('
  • ', lineContent || '
    '); } } - else + else//outside any list { + while (lists.length > 0)//if was in a list: close it before + { + if(lists[lists.length - 1][1] == "number") + { + pieces.push('
  • '); + } + else + { + pieces.push(''); + } + lists.length--; + } pieces.push(lineContent, '
    '); } } - pieces.push(new Array(lists.length + 1).join('')); + + for (var k = lists.length - 1; k >= 0; k--) + { + if(lists[k][1] == "number") + { + pieces.push(''); + } + else + { + pieces.push(''); + } + } return pieces.join(''); } @@ -415,7 +464,24 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) { if(ERR(err, callback)) return; - var head = (noDocType ? '' : '\n') + '\n' + (noDocType ? '' : '\n' + '\n' + '\n' + '\n') + ''; + var head = + (noDocType ? '' : '\n') + + '\n' + (noDocType ? '' : '\n' + + '\n' + + '\n' + '\n') + + ''; var foot = '\n\n'; diff --git a/node/utils/contentcollector.js b/node/utils/contentcollector.js index 60bd0a6ef..a7fa940a6 100644 --- a/node/utils/contentcollector.js +++ b/node/utils/contentcollector.js @@ -472,10 +472,10 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { cc.doAttrib(state, "strikethrough"); } - if (tname == "ul") + if (tname == "ul" || tname == "ol") { var type; - var rr = cls && /(?:^| )list-(bullet[12345678])\b/.exec(cls); + var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls); type = rr && rr[1] || "bullet" + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1)); oldListTypeOrNull = (_enterList(state, type) || 'none'); } diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 86ca99117..2faaae065 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -32,6 +32,25 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } + +ol { list-style-type: decimal; } +ol.list-number1 { list-style-type: decimal; } +ol.list-number2 { list-style-type: lower-latin; } +ol.list-number3 { list-style-type: lower-roman; } +ol.list-number4 { list-style-type: decimal; } +ol.list-number5 { list-style-type: lower-latin; } +ol.list-number6 { list-style-type: lower-roman; } +ol.list-number7 { list-style-type: decimal; } +ol.list-number8 { list-style-type: lower-latin; } + ul.list-indent1 { margin-left: 1.5em; } ul.list-indent2 { margin-left: 3em; } ul.list-indent3 { margin-left: 4.5em; } @@ -74,7 +93,7 @@ body.doesWrap { padding-top: 1px; /* important for some reason? */ padding-right: 10px; padding-bottom: 8px; - padding-left: 1px /* prevents characters from looking chopped off in FF3 */; + padding-left: 10px /* prevents characters from looking chopped off in FF3 */; overflow: hidden; /* blank 1x1 gif, so that IE8 doesn't consider the body transparent */ background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==); diff --git a/static/css/pad.css b/static/css/pad.css index 41ef75902..feed00e44 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1069,6 +1069,10 @@ position: relative; background-position: 0px -459px; } +#exportdokuwiki{ + background-position: 2px -144px; +} + #export a{ text-decoration: none; } diff --git a/static/css/timeslider.css b/static/css/timeslider.css index e34509322..9df408683 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -221,3 +221,40 @@ ul.list-bullet6 { list-style-type: square; } ul.list-bullet7 { list-style-type: disc; } ul.list-bullet8 { list-style-type: circle; } +ol.list-number1 { margin-left: 1.5em; } +ol.list-number2 { margin-left: 3em; } +ol.list-number3 { margin-left: 4.5em; } +ol.list-number4 { margin-left: 6em; } +ol.list-number5 { margin-left: 7.5em; } +ol.list-number6 { margin-left: 9em; } +ol.list-number7 { margin-left: 10.5em; } +ol.list-number8 { margin-left: 12em; } + +ol { list-style-type: decimal; } +ol.list-number1 { list-style-type: decimal; } +ol.list-number2 { list-style-type: lower-latin; } +ol.list-number3 { list-style-type: lower-roman; } +ol.list-number4 { list-style-type: decimal; } +ol.list-number5 { list-style-type: lower-latin; } +ol.list-number6 { list-style-type: lower-roman; } +ol.list-number7 { list-style-type: decimal; } +ol.list-number8 { list-style-type: lower-latin; } + +ul.list-indent1 { margin-left: 1.5em; } +ul.list-indent2 { margin-left: 3em; } +ul.list-indent3 { margin-left: 4.5em; } +ul.list-indent4 { margin-left: 6em; } +ul.list-indent5 { margin-left: 7.5em; } +ul.list-indent6 { margin-left: 9em; } +ul.list-indent7 { margin-left: 10.5em; } +ul.list-indent8 { margin-left: 12em; } + +ul.list-indent1 { list-style-type: none; } +ul.list-indent2 { list-style-type: none; } +ul.list-indent3 { list-style-type: none; } +ul.list-indent4 { list-style-type: none; } +ul.list-indent5 { list-style-type: none; } +ul.list-indent6 { list-style-type: none; } +ul.list-indent7 { list-style-type: none; } +ul.list-indent8 { list-style-type: none; } + diff --git a/static/img/fileicons.gif b/static/img/fileicons.gif new file mode 100644 index 0000000000000000000000000000000000000000..c03b6031a62780479212fe50240ccb60dd3750b1 GIT binary patch literal 1649 zcmV-%29EhhNk%w1VG#hQ0LFg+N=i!c@$svxtN8f%?Ck87m6fH(lWA#bk>88L!^5H0 zkZhRMh{M*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(&XY=9;XY0?k_FFvJZIq}JgL zJwPyp4I%WP!wnY?D22|Mkn~UrP-Hud4Lxijhk?p12SyH3(5set^HOK;9{?A%oxg0i z-EZ2Gln13!F%|3-dkRklU%jZ&SBrfd50HQc6HqBYFbV#*smKZX!N%Z(8~zQ)DlN!P z<4iR0IOH1S(|F~mjqHL8nQP7l8$zq7iPYGRY$64t$G)8EVoO&xOlQMw)7ozL?)!JJ zColmJFT4N*5Nikk2O4P(AOH|?M4!U+)Mt?c8fc)s#`ZuIF2D@Z2_#_s6gj~0#|tR{ zA$*qKi+_Fj1N v0ZdU3Bme>lvQU7+4Wfq=KpzEOu){IBpb!E`00punN5K){iN9k+AOHY6T+#W% literal 0 HcmV?d00001 diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index bad0ca346..15c6debae 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -3535,16 +3535,36 @@ function OUTER(gscope) var lineNum = rep.selStart[0]; var listType = getLineListType(lineNum); - performDocumentReplaceSelection('\n'); if (listType) { - if (lineNum + 1 < rep.lines.length()) + var text = rep.lines.atIndex(lineNum).text; + listType = /([a-z]+)([12345678])/.exec(listType); + var type = listType[1]; + var level = Number(listType[2]); + + //detect empty list item; exclude indentation + if(text === '*' && type !== "indent") { - setLineListType(lineNum + 1, listType); + //if not already on the highest level + if(level > 1) + { + setLineListType(lineNum, type+(level-1));//automatically decrease the level + } + else + { + setLineListType(lineNum, '');//remove the list + renumberList(lineNum + 1);//trigger renumbering of list that may be right after + } + } + else if (lineNum + 1 < rep.lines.length()) + { + performDocumentReplaceSelection('\n'); + setLineListType(lineNum + 1, type+level); } } else { + performDocumentReplaceSelection('\n'); handleReturnIndentation(); } } @@ -3688,6 +3708,15 @@ function OUTER(gscope) } } } + //if the list has been removed, it is necessary to renumber + //starting from the *next* line because the list may have been + //separated. If it returns null, it means that the list was not cut, try + //from the current one. + var line = caretLine(); + if(line != -1 && renumberList(line+1)==null) + { + renumberList(line); + } } // set of "letter or digit" chars is based on section 20.5.16 of the original Java Language Spec @@ -5184,7 +5213,83 @@ function OUTER(gscope) [lineNum, listType] ]); } - + + function renumberList(lineNum){ + //1-check we are in a list + var type = getLineListType(lineNum); + if(!type) + { + return null; + } + type = /([a-z]+)[12345678]/.exec(type); + if(type[1] == "indent") + { + return null; + } + + //2-find the first line of the list + while(lineNum-1 >= 0 && (type=getLineListType(lineNum-1))) + { + type = /([a-z]+)[12345678]/.exec(type); + if(type[1] == "indent") + break; + lineNum--; + } + + //3-renumber every list item of the same level from the beginning, level 1 + //IMPORTANT: never skip a level because there imbrication may be arbitrary + var builder = Changeset.builder(rep.lines.totalWidth()); + loc = [0,0]; + function applyNumberList(line, level) + { + //init + var position = 1; + var curLevel = level; + var listType; + //loop over the lines + while(listType = getLineListType(line)) + { + //apply new num + listType = /([a-z]+)([12345678])/.exec(listType); + curLevel = Number(listType[2]); + if(isNaN(curLevel) || listType[0] == "indent") + { + return line; + } + else if(curLevel == level) + { + buildKeepRange(builder, loc, (loc = [line, 0])); + buildKeepRange(builder, loc, (loc = [line, 1]), [ + ['start', position] + ], rep.apool); + + position++; + line++; + } + else if(curLevel < level) + { + return line;//back to parent + } + else + { + line = applyNumberList(line, level+1);//recursive call + } + } + return line; + } + + applyNumberList(lineNum, 1); + var cs = builder.toString(); + if (!Changeset.isIdentity(cs)) + { + performDocumentApplyChangeset(cs); + } + + //4-apply the modifications + + + } + function setLineListTypes(lineNumTypePairsInOrder) { var loc = [0, 0]; @@ -5231,9 +5336,18 @@ function OUTER(gscope) { performDocumentApplyChangeset(cs); } + + //if the list has been removed, it is necessary to renumber + //starting from the *next* line because the list may have been + //separated. If it returns null, it means that the list was not cut, try + //from the current one. + if(renumberList(lineNum+1)==null) + { + renumberList(lineNum); + } } - function doInsertUnorderedList() + function doInsertList(type) { if (!(rep.selStart && rep.selEnd)) { @@ -5248,7 +5362,7 @@ function OUTER(gscope) for (var n = firstLine; n <= lastLine; n++) { var listType = getLineListType(n); - if (!listType || listType.slice(0, 'bullet'.length) != 'bullet') + if (!listType || listType.slice(0, type.length) != type) { allLinesAreList = false; break; @@ -5267,11 +5381,19 @@ function OUTER(gscope) level = Number(listType[2]); } var t = getLineListType(n); - mods.push([n, allLinesAreList ? 'indent' + level : (t ? 'bullet' + level : 'bullet1')]); + mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]); } setLineListTypes(mods); } + + function doInsertUnorderedList(){ + doInsertList('bullet'); + } + function doInsertOrderedList(){ + doInsertList('number'); + } editorInfo.ace_doInsertUnorderedList = doInsertUnorderedList; + editorInfo.ace_doInsertOrderedList = doInsertOrderedList; var mozillaFakeArrows = (browser.mozilla && (function() { diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index 69036ba25..883ca09f0 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -476,7 +476,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { cc.doAttrib(state, "strikethrough"); } - if (tname == "ul") + if (tname == "ul" || tname == "ol") { var type; var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls); diff --git a/static/js/domline.js b/static/js/domline.js index 3456419c4..84aeb4a81 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -95,13 +95,23 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (cls.indexOf('list') >= 0) { var listType = /(?:^| )list:(\S+)/.exec(cls); + var start = /(?:^| )start:(\S+)/.exec(cls); if (listType) { listType = listType[1]; + start = start?'start="'+start[1]+'"':''; if (listType) { - preHtml = '
    • '; - postHtml = '
    '; + if(listType.indexOf("number") < 0) + { + preHtml = '
    • '; + postHtml = '
    '; + } + else + { + preHtml = '
    1. '; + postHtml = '
    '; + } } result.lineMarker += txt.length; return; // don't append any text diff --git a/static/js/domline_client.js b/static/js/domline_client.js index cac753b96..9f47dae54 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -94,13 +94,23 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if (cls.indexOf('list') >= 0) { var listType = /(?:^| )list:(\S+)/.exec(cls); + var start = /(?:^| )start:(\S+)/.exec(cls); if (listType) { listType = listType[1]; + start = start?'start="'+start[1]+'"':''; if (listType) { - preHtml = '
    • '; - postHtml = '
    '; + if(listType.indexOf("number") < 0) + { + preHtml = '
    • '; + postHtml = '
    '; + } + else + { + preHtml = '
    1. '; + postHtml = '
    '; + } } result.lineMarker += txt.length; return; // don't append any text @@ -141,8 +151,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) plugins_.callHook("aceCreateDomLine", { domline: domline, - cls: cls, - document: document + cls: cls }).map(function(modifier) { cls = modifier.cls; @@ -158,7 +167,11 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if (href) { - extraOpenTags = extraOpenTags + ''; + if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it. + { + href = "http://"+href; + } + extraOpenTags = extraOpenTags + ''; extraCloseTags = '' + extraCloseTags; } if (simpleTags) diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 9164d42f0..13a746186 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -90,6 +90,10 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun { classes += ' list:' + value; } + else if (key == 'start') + { + classes += ' start:' + value; + } else if (linestylefilter.ATTRIB_CLASSES[key]) { classes += ' ' + linestylefilter.ATTRIB_CLASSES[key]; diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index 69c3f1242..9fd2a3f8c 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -88,6 +88,10 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun { classes += ' list:' + value; } + else if (key == 'start') + { + classes += ' start:' + value; + } else if (linestylefilter.ATTRIB_CLASSES[key]) { classes += ' ' + linestylefilter.ATTRIB_CLASSES[key]; @@ -241,7 +245,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag) linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/; linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')'); -linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); +linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); linestylefilter.getURLFilter = linestylefilter.getRegexpFilter( linestylefilter.REGEX_URL, 'url'); diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index b4b4c1cca..6cd5163de 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -126,6 +126,7 @@ var padeditbar = (function() if (cmd == 'bold' || cmd == 'italic' || cmd == 'underline' || cmd == 'strikethrough') ace.ace_toggleAttributeOnSelection(cmd); else if (cmd == 'undo' || cmd == 'redo') ace.ace_doUndoRedo(cmd); else if (cmd == 'insertunorderedlist') ace.ace_doInsertUnorderedList(); + else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList(); else if (cmd == 'indent') { if (!ace.ace_doIndentOutdent(false)) diff --git a/static/pad.html b/static/pad.html index c6fd3e774..5c68f7733 100644 --- a/static/pad.html +++ b/static/pad.html @@ -46,6 +46,11 @@
  • +
  • + +
    +
    +
  • From 960a79b77ba3ac3dc5dce35969598c8d350c0ed4 Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 15 Jan 2012 18:37:33 +0100 Subject: [PATCH 022/265] Added icon for ordered lists --- static/img/etherpad_lite_icons.png | Bin 7625 -> 5541 bytes static/pad.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/static/img/etherpad_lite_icons.png b/static/img/etherpad_lite_icons.png index 09bce37de0e9becf97fd0fe819736fea43df052c..cadf5ed2b3717939e2f23dc0c24a5360f8e822d8 100644 GIT binary patch literal 5541 zcmV;W6N2bPDNB8 zb~7$DE-^4L^m3s902LugL_t(|UhQ28bQV>Xwx_$#^mO-(j>~cBcCZ=r*e)a8Dj>oP z-LwwPHX@ts`yP-*K_UX$tP#f`Mqog;NdO7ihy=nGlCT64k`NLINhB;9!X^ZeUGBW^ zkz2f~|J7ghSArAa&pD5(dhg!v-Fx4C+pT&(cir`)`TOXjkBC!hS{iv0JTfwp`uFco zxE?xm$QwvfQj!GmBmpx)l}VE(RSkqy@hnM6Nr_a&vq4dFwb*0s+_^Mz zY>%y5w;KN831t2H^%8*7{{8#COXEp`Ak!Udfr5epI(hP>dxx_Qfne_2w=cnKj~_qo z3=|O&K_MX_rm+-b>!3k{Br`_2@#Dwq$6AaVUAuOrmMvS-f&~jrwIM$tAwlM$PvN<3 z+qPyp)C^|SP*zrE0?5e7kPKF5fW*iLpezFb9$-8x@t84Vw1YJ4G;G)~S-IrdvuBUg z85tPW*{~o)o@!|1VUXgAVFpvhD^{$K5+Q*Ywn1$w5h{TiP{-EaVUyU{SZN!8Sx0#o zR;RWWkR`cedsmH79Fz9gv118W&q4tJlN7EDqE1{+_mZbtB=M|5wKHPagFUJ=X$KAK z+b$SnU>Dbejjm~fhOKsozik1XMlW6Ytu=<-hA|*Xn7B%!sx_)Wb~e*iW+nC{ky}ap zf>)bObhQN3I-YFcW$vvOm8&Fe&0@xurOFZkq{=`H;ulCIa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*735PK!bow? z21JYoOQ{Uqfa-~X9-1pHE!%(l-84^$l#QzV$fI2hvD?dUL`NBuF*-ji(mAgI343S8mBBGFj(nd%O*7ZlaW7zYET{UoCh5|!5VgbLna5&awO=G z$Jh(>h5jiT0DB(m`hFiaS<{`0dxJEu%tl%CV%oo5uzMVqA2v13MD-AlH0oZ}*j6uN zGT=M2ATJz+>=>}>BS6Syd^0ePB?jhXwCi9TFcX^ZKkO2I5%ih54#*2@>)pIY1h(9Y zuF-j~DiLJFp#4*IcR5D>oMa~EQ2Jjft1@&$(rF=U7fwHY(Pd?WZLtX&=;JzFFNauY zuz-j+g;%N(N1UpvQ(tk7TQ>x_<22Uq+Ay0gI@*kEd+Yy<@Yy>^H7+A0m!ZB9d%gXa zLx4^6?T7`?ZRT)l(6R9K;+E0Ze^c(TC`R>s%b$!;euY`jXp@$s-cPSpT+1+#bZ2hkJ+ff|lS8C??4%RoQ z&8&k40$sOr-o{ND9N9_d%jh{5#g6Z1^{vki`F&Om@Mk2L6wkivf6DBkw-TJ2`L?{~ zq|6zm?A>%WFc`aY>T^)i^p`B_N6qbbwm7X!u7mMRC{K>}PHWtn6{*3KaMwCz&sS=) RN$@`_AS09 diff --git a/static/pad.html b/static/pad.html index 5c68f7733..f57438d56 100644 --- a/static/pad.html +++ b/static/pad.html @@ -48,7 +48,7 @@
  • -
    +
  • From 1767e0f6e8f80420f13441954f75d855edaca9f3 Mon Sep 17 00:00:00 2001 From: 0ip Date: Sun, 15 Jan 2012 18:55:33 +0100 Subject: [PATCH 023/265] Update static/css/pad.css --- static/css/pad.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index feed00e44..41ef75902 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1069,10 +1069,6 @@ position: relative; background-position: 0px -459px; } -#exportdokuwiki{ - background-position: 2px -144px; -} - #export a{ text-decoration: none; } From e14fd222848e27abab1775eb628b5491f99567bb Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 15 Jan 2012 17:59:19 +0000 Subject: [PATCH 024/265] fix large left padding --- static/css/iframe_editor.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/css/iframe_editor.css b/static/css/iframe_editor.css index 2faaae065..6a483c07b 100644 --- a/static/css/iframe_editor.css +++ b/static/css/iframe_editor.css @@ -93,7 +93,7 @@ body.doesWrap { padding-top: 1px; /* important for some reason? */ padding-right: 10px; padding-bottom: 8px; - padding-left: 10px /* prevents characters from looking chopped off in FF3 */; + padding-left: 1px /* prevents characters from looking chopped off in FF3 -- Removed because it added too much whitespace */; overflow: hidden; /* blank 1x1 gif, so that IE8 doesn't consider the body transparent */ background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==); From 5f46ac2b01fd08b8bcc0ebe38eb6503c2ff87a81 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 15 Jan 2012 18:24:18 +0000 Subject: [PATCH 025/265] Temporary fix that was breaking clicks inside of embedded pads --- static/js/ace2_inner.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 15c6debae..a75f7ae68 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -3488,7 +3488,9 @@ function OUTER(gscope) function handleClick(evt) { //hide the dropdowns - window.top.padeditbar.toogleDropDown("none"); + if(window.top.padeditbar){ // required in case its in an iframe should probably use parent.. See Issue 327 https://github.com/Pita/etherpad-lite/issues/327 + window.top.padeditbar.toogleDropDown("none"); + } inCallStack("handleClick", function() { From 9c91f16c71b7f541aa2ea5d9f7e6d797464124fb Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 14 Jan 2012 21:42:47 -0800 Subject: [PATCH 026/265] Improve inlining of editor content. Instead of replacing substrings, write each included file's content into a shared dictionary for lookup later. This eliminates duplication and arguably improves readability. --- node/utils/Minify.js | 42 +++++++++++++----------------------------- static/js/ace.js | 40 ++++++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 47 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 330c5810a..719cdaeeb 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -155,52 +155,36 @@ exports.minifyJS = function(req, res, jsFilename) var type = item.match(/INCLUDE_[A-Z]+/g)[0].substr("INCLUDE_".length); - var quote = item.search("_Q") != -1; - //read the included file fs.readFile(filename, "utf-8", function(err, data) { if(ERR(err, callback)) return; - - //compress the file + if(type == "JS") { - embeds[item] = " + diff --git a/static/timeslider.html b/static/timeslider.html index c1310cc6c..71b4443d2 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -19,6 +19,8 @@ // Date: Mon, 16 Jan 2012 00:37:48 -0800 Subject: [PATCH 055/265] Add missing dependency for `timeslider.js`. When dependencies are made explicity `pad_savedrevs.js` will be required by several of the `pad_*.js`. --- node/utils/tar.json | 1 + 1 file changed, 1 insertion(+) diff --git a/node/utils/tar.json b/node/utils/tar.json index 3b1ba63ca..92883bb74 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -35,6 +35,7 @@ , "pad_editbar.js" , "pad_docbar.js" , "pad_modals.js" + , "pad_savedrevs.js" , "pad_impexp.js" , "easysync2_client.js" , "domline_client.js" From 72d29b1c627d54453fe48a89b063631fec8e6859 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 21:05:19 -0800 Subject: [PATCH 056/265] Inject the pad dependency into chat. --- static/js/chat.js | 7 ++++--- static/js/pad2.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index 1636ab690..a0d0d9ac2 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -82,13 +82,13 @@ var chat = (function() send: function() { var text = $("#chatinput").val(); - pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text}); + this._pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text}); $("#chatinput").val(""); }, addMessage: function(msg, increment) { //correct the time - msg.time += pad.clientTimeOffset; + msg.time += this._pad.clientTimeOffset; //create the time string var minutes = "" + new Date(msg.time).getMinutes(); @@ -150,8 +150,9 @@ var chat = (function() self.scrollDown(); }, - init: function() + init: function(pad) { + this._pad = pad; $("#chatinput").keypress(function(evt) { //if the user typed enter, fire the send diff --git a/static/js/pad2.js b/static/js/pad2.js index 8a2c33847..5f454172f 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -413,7 +413,7 @@ var pad = { pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp; //initialize the chat - chat.init(); + chat.init(this); pad.initTime = +(new Date()); pad.padOptions = clientVars.initialOptions; From 7f98116a435d0204f91100cb24bfb4f1f49f41d3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 20:16:11 -0800 Subject: [PATCH 057/265] Implement `require` for most modules. --- static/js/ace2_inner.js | 29 +++++++++++++++++++++++++++++ static/js/broadcast.js | 6 ++++++ static/js/changesettracker.js | 2 ++ static/js/chat.js | 2 ++ static/js/collab_client.js | 2 ++ static/js/contentcollector.js | 2 ++ static/js/linestylefilter.js | 3 +++ static/js/linestylefilter_client.js | 3 +++ static/js/pad2.js | 3 +++ static/js/pad_editor.js | 1 + static/js/undomodule.js | 2 ++ 11 files changed, 55 insertions(+) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index ea6d7cbe2..455958cd2 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -20,6 +20,35 @@ * limitations under the License. */ +var Ace2Common = require('/ace2_common'); +// Extract useful method defined in the other module. +var isNodeText = Ace2Common.isNodeText; +var object = Ace2Common.object; +var extend = Ace2Common.extend; +var forEach = Ace2Common.forEach; +var map = Ace2Common.map; +var filter = Ace2Common.filter; +var isArray = Ace2Common.isArray; +var browser = Ace2Common.browser; +var getAssoc = Ace2Common.getAssoc; +var setAssoc = Ace2Common.setAssoc; +var binarySearch = Ace2Common.binarySearch; +var binarySearchInfinite = Ace2Common.binarySearchInfinite; +var htmlPrettyEscape = Ace2Common.htmlPrettyEscape; +var map = Ace2Common.map; + +var makeChangesetTracker = require('/changesettracker').makeChangesetTracker; +var colorutils = require('/colorutils').colorutils; +var makeContentCollector = require('/contentcollector').makeContentCollector; +var makeCSSManager = require('/cssmanager').makeCSSManager; +var domline = require('/domline').domline; +var AttribPool = require('/easysync2').AttribPool; +var Changeset = require('/easysync2').Changeset; +var linestylefilter = require('/linestylefilter').linestylefilter; +var newSkipList = require('/skiplist').newSkipList; +var undoModule = require('/undomodule').undoModule; +var makeVirtualLineView = require('/virtual_lines').makeVirtualLineView; + function OUTER(gscope) { diff --git a/static/js/broadcast.js b/static/js/broadcast.js index edfeef9c6..f2aa048fb 100644 --- a/static/js/broadcast.js +++ b/static/js/broadcast.js @@ -22,6 +22,12 @@ var global = this; +var makeCSSManager = require('/cssmanager_client').makeCSSManager; +var domline = require('/domline_client').domline; +var Changeset = require('/easysync2_client').Changeset; +var AttribPool = require('/easysync2_client').AttribPool; +var linestylefilter = require('/linestylefilter_client').linestylefilter; + function loadBroadcastJS() { // just in case... (todo: this must be somewhere else in the client code.) diff --git a/static/js/changesettracker.js b/static/js/changesettracker.js index 60c73d3d5..db3ab9446 100644 --- a/static/js/changesettracker.js +++ b/static/js/changesettracker.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var Changeset = require('/easysync2').Changeset; +var AttribPool = require('/easysync2').AttribPool; function makeChangesetTracker(scheduler, apool, aceCallbacksProvider) { diff --git a/static/js/chat.js b/static/js/chat.js index a0d0d9ac2..b4d15f4e5 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; + var chat = (function() { var bottomMargin = "0px"; diff --git a/static/js/collab_client.js b/static/js/collab_client.js index 3a40fba17..1f4e21dc8 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -25,6 +25,8 @@ $(window).bind("load", function() getCollabClient.windowLoaded = true; }); +var chat = require('/chat').chat; + // Dependency fill on init. This exists for `pad.socket` only. // TODO: bind directly to the socket. var pad = undefined; diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index e5a90586c..d69d813d8 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -25,6 +25,8 @@ var _MAX_LIST_LEVEL = 8; +var Changeset = require('/easysync2').Changeset + function sanitizeUnicode(s) { return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?'); diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index e990a68bc..5d831ae80 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -27,6 +27,9 @@ // requires: top // requires: plugins // requires: undefined + +var Changeset = require('/easysync2').Changeset + var linestylefilter = {}; linestylefilter.ATTRIB_CLASSES = { diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index a4536490f..b9203c9fd 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -25,6 +25,9 @@ // requires: top // requires: plugins // requires: undefined + +var Changeset = require('/easysync2_client').Changeset + var linestylefilter = {}; linestylefilter.ATTRIB_CLASSES = { diff --git a/static/js/pad2.js b/static/js/pad2.js index 5f454172f..3964dae6b 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -32,6 +32,9 @@ settings.globalUserName = false; settings.hideQRCode = false; settings.rtlIsTrue = false; +var chat = require('/chat').chat; +var getCollabClient = require('/collab_client').getCollabClient; + $(document).ready(function() { //start the costum js diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 929112bbf..5fc067cb2 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -20,6 +20,7 @@ * limitations under the License. */ +var Ace2Editor = require('/ace').Ace2Editor; var padeditor = (function() { diff --git a/static/js/undomodule.js b/static/js/undomodule.js index a0073e19e..b515180d4 100644 --- a/static/js/undomodule.js +++ b/static/js/undomodule.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var Changeset = require('/easysync2').Changeset; +var extend = require('/ace2_common').extend; var undoModule = (function() { From fa2a6e9ee690eef161b5e286e3d21fb186283f1d Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 21:37:47 -0800 Subject: [PATCH 058/265] Implement `require` of dependencies for all `pad_*` modules. Create a lazily-defined local reference for pad on initialization in each pad module in order to avoid circular dependency. At some point in the future this dependency should instead be injected into each module on initialization. --- static/js/pad2.js | 14 ++++++++++++-- static/js/pad_connectionstatus.js | 2 ++ static/js/pad_cookie.js | 3 +++ static/js/pad_docbar.js | 6 ++++++ static/js/pad_editbar.js | 4 ++++ static/js/pad_editor.js | 9 ++++++++- static/js/pad_impexp.js | 8 ++++++++ static/js/pad_modals.js | 6 ++++++ static/js/pad_savedrevs.js | 6 +++++- static/js/pad_userlist.js | 7 ++++++- static/js/pad_utils.js | 2 ++ 11 files changed, 62 insertions(+), 5 deletions(-) diff --git a/static/js/pad2.js b/static/js/pad2.js index 3964dae6b..5369d422a 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -34,6 +34,16 @@ settings.rtlIsTrue = false; var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; +var padconnectionstatus = require('/pad_connectionstatus').padconnectionstatus; +var padcookie = require('/pad_cookie').padcookie; +var paddocbar = require('/pad_docbar').paddocbar; +var padeditbar = require('/pad_editbar').padeditbar; +var padeditor = require('/pad_editor').padeditor; +var padimpexp = require('/pad_impexp').padimpexp; +var padmodals = require('/pad_modals').padmodals; +var padsavedrevs = require('/pad_savedrevs').padsavedrevs; +var paduserlist = require('/pad_userlist').paduserlist; +var padutils = require('/pad_utils').padutils; $(document).ready(function() { @@ -275,13 +285,13 @@ function handshake() { $("#editorloadingbox").html("You need a password to access this pad
    " + ""+ - ""); + ""); } else if(obj.accessStatus == "wrongPassword") { $("#editorloadingbox").html("You're password was wrong
    " + ""+ - ""); + ""); } } diff --git a/static/js/pad_connectionstatus.js b/static/js/pad_connectionstatus.js index bec359c36..d3a7648cb 100644 --- a/static/js/pad_connectionstatus.js +++ b/static/js/pad_connectionstatus.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var padmodals = require('/pad_modals').padmodals; + var padconnectionstatus = (function() { diff --git a/static/js/pad_cookie.js b/static/js/pad_cookie.js index d8eb464c7..00dc28f39 100644 --- a/static/js/pad_cookie.js +++ b/static/js/pad_cookie.js @@ -85,9 +85,12 @@ var padcookie = (function() var alreadyWarnedAboutNoCookies = false; var inited = false; + var pad = undefined; var self = { init: function(prefsToSet) { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + var rawCookie = getRawCookie(); if (rawCookie) { diff --git a/static/js/pad_docbar.js b/static/js/pad_docbar.js index 09315c778..2bf1a1da0 100644 --- a/static/js/pad_docbar.js +++ b/static/js/pad_docbar.js @@ -20,6 +20,7 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; var paddocbar = (function() { @@ -113,11 +114,14 @@ var paddocbar = (function() self.renderPassword(); } + var pad = undefined; var self = { title: null, password: null, init: function(opts) { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + panels = { impexp: { animator: getPanelOpenCloseAnimator("impexp", 160) @@ -444,6 +448,8 @@ var paddocbar = (function() }, handleResizePage: function() { + // Side-step circular reference. This should be injected. + var padsavedrevs = require('/pad_savedrevs').padsavedrevs; padsavedrevs.handleResizePage(); }, hideLaterIfNoOtherInteraction: function() diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 6754e99c2..774208940 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -20,6 +20,10 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; +var padeditor = require('/pad_editor').padeditor; +var padsavedrevs = require('/pad_savedrevs').padsavedrevs; + var padeditbar = (function() { diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 5fc067cb2..45a90f006 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -20,16 +20,23 @@ * limitations under the License. */ -var Ace2Editor = require('/ace').Ace2Editor; +var padcookie = require('/pad_cookie').padcookie; +var padutils = require('/pad_utils').padutils; var padeditor = (function() { + var Ace2Editor = undefined; + var pad = undefined; + var settings = undefined; var self = { ace: null, // this is accessed directly from other files viewZoom: 100, init: function(readyFunc, initialViewOptions) { + Ace2Editor = require('/ace').Ace2Editor; + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + settings = require('/pad2').settings; function aceReady() { diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 638991a64..8f187a5cb 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -20,6 +20,7 @@ * limitations under the License. */ +var paddocbar = require('/pad_docbar').paddocbar; var padimpexp = (function() { @@ -233,9 +234,16 @@ var padimpexp = (function() } ///// + var pad = undefined; var self = { init: function() { + try { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + } catch (e) { + // skip (doesn't require pad when required by timeslider) + } + //get /p/padname var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) //get http://example.com/p/padname diff --git a/static/js/pad_modals.js b/static/js/pad_modals.js index d5e7811b9..9d24c5f1a 100644 --- a/static/js/pad_modals.js +++ b/static/js/pad_modals.js @@ -20,6 +20,9 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; +var paddocbar = require('/pad_docbar').paddocbar; + var padmodals = (function() { @@ -70,9 +73,12 @@ var padmodals = (function() clearShareBoxTo(); } + var pad = undefined; var self = { init: function() { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + self.initFeedback(); self.initShareBox(); }, diff --git a/static/js/pad_savedrevs.js b/static/js/pad_savedrevs.js index 7aadea71e..964c83386 100644 --- a/static/js/pad_savedrevs.js +++ b/static/js/pad_savedrevs.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; +var paddocbar = require('/pad_docbar').paddocbar; var padsavedrevs = (function() { @@ -39,7 +41,7 @@ var padsavedrevs = (function() box.find(".srauthor").html("by " + padutils.escapeHtml(revisionInfo.savedBy)); var viewLink = '/ep/pad/view/' + pad.getPadId() + '/' + revisionInfo.id; box.find(".srview").attr('href', viewLink); - var restoreLink = 'javascript:void padsavedrevs.restoreRevision(' + rnum + ');'; + var restoreLink = 'javascript:void(require('+JSON.stringify(module.id)+').padsavedrevs.restoreRevision(' + JSON.stringify(rnum) + ');'; box.find(".srrestore").attr('href', restoreLink); box.find(".srname").click(function(evt) { @@ -345,9 +347,11 @@ var padsavedrevs = (function() $(document).unbind('mouseup', clearScrollRepeatTimer); } + var pad = undefined; var self = { init: function(initialRevisions) { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). self.newRevisionList(initialRevisions, true); $("#savedrevs-savenow").click(function() diff --git a/static/js/pad_userlist.js b/static/js/pad_userlist.js index 965132258..b9d08932e 100644 --- a/static/js/pad_userlist.js +++ b/static/js/pad_userlist.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; + var myUserInfo = {}; var colorPickerOpen = false; @@ -460,9 +462,12 @@ var paduserlist = (function() return true; }, 1000); + var pad = undefined; var self = { init: function(myInitialUserInfo) { + pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). + self.setMyUserInfo(myInitialUserInfo); $("#otheruserstable tr").remove(); @@ -652,7 +657,7 @@ var paduserlist = (function() if (box.length == 0) { // make guest prompt box - box = $('
    Guest: ' + padutils.escapeHtml(displayName) + '
    '); + box = $('
    Guest: ' + padutils.escapeHtml(displayName) + '
    '); $("#guestprompts").append(box); } else diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index 3c73aa069..30ff308c0 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -34,6 +34,7 @@ var padutils = { }, uniqueId: function() { + var pad = require('/pad2').pad; // Sidestep circular dependency function encodeNum(n, width) { // returns string that is exactly 'width' chars, padding with zeros @@ -226,6 +227,7 @@ var padutils = { }, timediff: function(d) { + var pad = require('/pad2').pad; // Sidestep circular dependency function format(n, word) { n = Math.round(n); From 86f31c752d60957768bff7a684c156277d74e2cf Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 21:52:03 -0800 Subject: [PATCH 059/265] Implement `require` for for plugin module. --- static/js/ace.js | 2 ++ static/js/contentcollector.js | 6 ++++++ static/js/domline.js | 8 ++++++++ static/js/domline_client.js | 8 ++++++++ static/js/linestylefilter.js | 6 ++++++ static/js/linestylefilter_client.js | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/static/js/ace.js b/static/js/ace.js index 4735aaae7..78a79d7ec 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -28,6 +28,8 @@ Ace2Editor.registry = { nextId: 1 }; +var plugins = require('/plugins').plugins; + function Ace2Editor() { var ace2 = Ace2Editor; diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index d69d813d8..5f78a3f24 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -26,6 +26,12 @@ var _MAX_LIST_LEVEL = 8; var Changeset = require('/easysync2').Changeset +var plugins = undefined; +try { + plugins = require('/plugins').plugins; +} catch (e) { + // silence +} function sanitizeUnicode(s) { diff --git a/static/js/domline.js b/static/js/domline.js index 7ebf5b350..2d8913928 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -25,6 +25,14 @@ // requires: top // requires: plugins // requires: undefined + +var plugins = undefined; +try { + plugins = require('/plugins').plugins; +} catch (e) { + // silence +} + var domline = {}; domline.noop = function() {}; diff --git a/static/js/domline_client.js b/static/js/domline_client.js index e995140f4..6a09a1723 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -24,6 +24,14 @@ // requires: top // requires: plugins // requires: undefined + +var plugins = undefined; +try { + plugins = require('/plugins').plugins; +} catch (e) { + // silence +} + var domline = {}; domline.noop = function() {}; diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 5d831ae80..9558ed71b 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -29,6 +29,12 @@ // requires: undefined var Changeset = require('/easysync2').Changeset +var plugins = undefined; +try { + plugins = require('/plugins').plugins; +} catch (e) { + // silence +} var linestylefilter = {}; diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index b9203c9fd..9b1cb83dc 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -27,6 +27,12 @@ // requires: undefined var Changeset = require('/easysync2_client').Changeset +var plugins = undefined; +try { + plugins = require('/plugins').plugins; +} catch (e) { + // silence +} var linestylefilter = {}; From 1b89e7e2903877487ee72b8df39f07b4ed1d8a36 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 16 Jan 2012 02:10:34 -0800 Subject: [PATCH 060/265] Implement `require` in HTML pages. --- static/pad.html | 8 ++++++++ static/timeslider.html | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/static/pad.html b/static/pad.html index 33df2d4f3..fba52b782 100644 --- a/static/pad.html +++ b/static/pad.html @@ -340,5 +340,13 @@ + + diff --git a/static/timeslider.html b/static/timeslider.html index 71b4443d2..a416562e8 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -21,6 +21,10 @@ var require = (function (path) {return (function () {return this}())}); + /* TODO: These globals shouldn't exist. */ + padeditbar = require('/pad_editbar').padeditbar; + padimpexp = require('/pad_impexp').padimpexp; + function createCookie(name,value,days) { if (days) { @@ -143,9 +147,9 @@ clientVars = message.data; //load all script that doesn't work without the clientVars - loadBroadcastSliderJS(); - loadBroadcastRevisionsJS(); - loadBroadcastJS(); + require('/broadcast_slider').loadBroadcastSliderJS(); + require('/broadcast_revisions').loadBroadcastRevisionsJS(); + require('/broadcast').loadBroadcastJS(); //initialize export ui padimpexp.init(); From 8bf0e7c2aaa457b991955650e1e32e1f0e5357bc Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 22:53:44 -0800 Subject: [PATCH 061/265] Allow dashes in included file names. --- node/utils/Minify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 12efc547a..8b198f3e1 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -162,7 +162,7 @@ function _handle(req, res, jsFilename, jsFiles) { return; } - var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"]+\)/gi); + 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) From 71dfced06de716dcc24cdc933ee02bdb4e75d535 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 22:56:41 -0800 Subject: [PATCH 062/265] Provide filename to isolation function. --- node/utils/Minify.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 8b198f3e1..016739b1a 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -179,7 +179,8 @@ function _handle(req, res, jsFilename, jsFiles) { if(type == "JS") { - embeds[filename] = compressJS([isolateJS(data)]); + var shortFilename = filename.replace(/^..\/static\/js\//, ''); + embeds[filename] = compressJS([isolateJS(data, shortFilename)]); } else { @@ -297,14 +298,14 @@ 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])); + write(isolateJS(files[filename], filename)); } } // 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) { +function isolateJS(code, filename) { return '(function (exports, require) {' + code + '\n' + '}(function () {return this}(), (function (path) {return (function () {return this}())})));\n'; From 62e0a8f26c3dea9d46818dd5ae9599cf375ad91e Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 22:07:45 -0800 Subject: [PATCH 063/265] Use require-kernel for require functionality. --- node/server.js | 8 ++++++++ node/utils/Minify.js | 40 ++++++++++++++++++++++++++++++++-------- package.json | 1 + static/js/ace.js | 35 ++++++++++++++++++++++++++--------- static/pad.html | 4 +--- static/timeslider.html | 3 +-- 6 files changed, 69 insertions(+), 22 deletions(-) diff --git a/node/server.js b/node/server.js index 422bbe120..c0d6ce6ad 100644 --- a/node/server.js +++ b/node/server.js @@ -114,7 +114,15 @@ 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"); + res.write(minify.requireDefinition()); + res.end(); + }); app.get('/static/*', function(req, res) { var filePath = path.normalize(__dirname + "/.." + diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 016739b1a..348f25373 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -29,6 +29,7 @@ var pro = require("uglify-js").uglify; var path = require('path'); var Buffer = require('buffer').Buffer; var gzip = require('gzip'); +var RequireKernel = require('require-kernel'); var server = require('../server'); var os = require('os'); @@ -173,22 +174,31 @@ function _handle(req, res, jsFilename, jsFiles) { var type = item.match(/INCLUDE_[A-Z]+/g)[0].substr("INCLUDE_".length); //read the included file - fs.readFile(ROOT_DIR + filename, "utf-8", function(err, data) + 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") { - var shortFilename = filename.replace(/^..\/static\/js\//, ''); - embeds[filename] = compressJS([isolateJS(data, shortFilename)]); + 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; @@ -294,21 +304,35 @@ function _handle(req, res, jsFilename, jsFiles) { } } +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)); } + + for(var i = 0, ii = filesInOrder.length; i < filesInOrder.length; i++) { + var filename = filesInOrder[i]; + write('require(' + JSON.stringify('/' + filename.replace(/^\/+/, '')) + ');\n'); + } } // 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) { - return '(function (exports, require) {' - + code + '\n' - + '}(function () {return this}(), (function (path) {return (function () {return this}())})));\n'; + 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 compressJS(values) diff --git a/package.json b/package.json index efc89fd7a..6567e5324 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "name": "Robin Buse" } ], "dependencies" : { + "require-kernel" : "1.0.0", "socket.io" : "0.8.7", "ueberDB" : "0.1.3", "async" : "0.1.15", diff --git a/static/js/ace.js b/static/js/ace.js index 78a79d7ec..8ecfbc0cb 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -216,25 +216,41 @@ 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'; + if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) { + buffer.push(' + - diff --git a/static/timeslider.html b/static/timeslider.html index a416562e8..4e85047e3 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -9,6 +9,7 @@ + @@ -19,8 +20,6 @@ // Date: Mon, 16 Jan 2012 00:47:10 -0800 Subject: [PATCH 064/265] Remove guards surrounding export steps. --- static/js/ace.js | 2 -- static/js/ace2_common.js | 2 -- static/js/ace2_inner.js | 2 -- static/js/broadcast.js | 2 -- static/js/broadcast_revisions.js | 2 -- static/js/broadcast_slider.js | 2 -- static/js/changesettracker.js | 2 -- static/js/chat.js | 2 -- static/js/collab_client.js | 2 -- static/js/colorutils.js | 2 -- static/js/contentcollector.js | 2 -- static/js/cssmanager.js | 2 -- static/js/cssmanager_client.js | 2 -- static/js/domline.js | 2 -- static/js/domline_client.js | 2 -- static/js/draggable.js | 2 -- static/js/easysync2.js | 2 -- static/js/easysync2_client.js | 2 -- static/js/linestylefilter.js | 2 -- static/js/linestylefilter_client.js | 2 -- static/js/pad2.js | 2 -- static/js/pad_connectionstatus.js | 2 -- static/js/pad_cookie.js | 2 -- static/js/pad_docbar.js | 2 -- static/js/pad_editbar.js | 2 -- static/js/pad_editor.js | 2 -- static/js/pad_impexp.js | 2 -- static/js/pad_modals.js | 2 -- static/js/pad_savedrevs.js | 2 -- static/js/pad_userlist.js | 2 -- static/js/pad_utils.js | 2 -- static/js/plugins.js | 2 -- static/js/skiplist.js | 2 -- static/js/undomodule.js | 2 -- static/js/virtual_lines.js | 2 -- 35 files changed, 70 deletions(-) diff --git a/static/js/ace.js b/static/js/ace.js index 8ecfbc0cb..6854b1142 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -391,6 +391,4 @@ function Ace2Editor() return editor; } -if (typeof exports !== 'undefined') { exports.Ace2Editor = Ace2Editor; -} diff --git a/static/js/ace2_common.js b/static/js/ace2_common.js index 0918189c9..1ce7810aa 100644 --- a/static/js/ace2_common.js +++ b/static/js/ace2_common.js @@ -147,7 +147,6 @@ function htmlPrettyEscape(str) }).replace(/\r?\n/g, '\\n'); } -if (typeof exports !== 'undefined') { exports.isNodeText = isNodeText; exports.object = object; exports.extend = extend; @@ -162,4 +161,3 @@ exports.binarySearch = binarySearch; exports.binarySearchInfinite = binarySearchInfinite; exports.htmlPrettyEscape = htmlPrettyEscape; exports.map = map; -} diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 455958cd2..e97847721 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5888,6 +5888,4 @@ function OUTER(gscope) OUTER(this); -if (typeof exports !== 'undefined') { exports.OUTER = OUTER; // This is probably unimportant. -} diff --git a/static/js/broadcast.js b/static/js/broadcast.js index f2aa048fb..b49b185a5 100644 --- a/static/js/broadcast.js +++ b/static/js/broadcast.js @@ -765,6 +765,4 @@ function loadBroadcastJS() receiveAuthorData(clientVars.historicalAuthorData); } -if (typeof exports !== 'undefined') { exports.loadBroadcastJS = loadBroadcastJS; -} diff --git a/static/js/broadcast_revisions.js b/static/js/broadcast_revisions.js index f60e58bb8..364ac3e8c 100644 --- a/static/js/broadcast_revisions.js +++ b/static/js/broadcast_revisions.js @@ -126,6 +126,4 @@ function loadBroadcastRevisionsJS() } } -if (typeof exports !== 'undefined') { exports.loadBroadcastRevisionsJS = loadBroadcastRevisionsJS; -} diff --git a/static/js/broadcast_slider.js b/static/js/broadcast_slider.js index 1d9f4928e..972190acb 100644 --- a/static/js/broadcast_slider.js +++ b/static/js/broadcast_slider.js @@ -497,6 +497,4 @@ function loadBroadcastSliderJS() }) } -if (typeof exports !== 'undefined') { exports.loadBroadcastSliderJS = loadBroadcastSliderJS; -} diff --git a/static/js/changesettracker.js b/static/js/changesettracker.js index db3ab9446..7b0fb3e46 100644 --- a/static/js/changesettracker.js +++ b/static/js/changesettracker.js @@ -210,6 +210,4 @@ function makeChangesetTracker(scheduler, apool, aceCallbacksProvider) } -if (typeof exports !== 'undefined') { exports.makeChangesetTracker = makeChangesetTracker; -} diff --git a/static/js/chat.js b/static/js/chat.js index b4d15f4e5..475d01939 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -176,6 +176,4 @@ var chat = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.chat = chat; -} diff --git a/static/js/collab_client.js b/static/js/collab_client.js index 1f4e21dc8..b697d4853 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -725,7 +725,5 @@ function selectElementContents(elem) } } -if (typeof exports !== 'undefined') { exports.getCollabClient = getCollabClient; exports.selectElementContents = selectElementContents; -} diff --git a/static/js/colorutils.js b/static/js/colorutils.js index 1fc452b6a..9bba39ad2 100644 --- a/static/js/colorutils.js +++ b/static/js/colorutils.js @@ -120,6 +120,4 @@ colorutils.blend = function(c1, c2, t) return [colorutils.scale(t, c1[0], c2[0]), colorutils.scale(t, c1[1], c2[1]), colorutils.scale(t, c1[2], c2[2])]; } -if (typeof exports !== 'undefined') { exports.colorutils = colorutils; -} diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index 5f78a3f24..fd90a07be 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -701,7 +701,5 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class return cc; } -if (typeof exports !== 'undefined') { exports.sanitizeUnicode = sanitizeUnicode; exports.makeContentCollector = makeContentCollector; -} diff --git a/static/js/cssmanager.js b/static/js/cssmanager.js index 1d45f3024..46075e578 100644 --- a/static/js/cssmanager.js +++ b/static/js/cssmanager.js @@ -119,6 +119,4 @@ function makeCSSManager(emptyStylesheetTitle, top) }; } -if (typeof exports !== 'undefined') { exports.makeCSSManager = makeCSSManager; -} diff --git a/static/js/cssmanager_client.js b/static/js/cssmanager_client.js index 3db467e31..6d9d989e8 100644 --- a/static/js/cssmanager_client.js +++ b/static/js/cssmanager_client.js @@ -115,6 +115,4 @@ function makeCSSManager(emptyStylesheetTitle) }; } -if (typeof exports !== 'undefined') { exports.makeCSSManager = makeCSSManager; -} diff --git a/static/js/domline.js b/static/js/domline.js index 2d8913928..5de33c5aa 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -319,6 +319,4 @@ domline.processSpaces = function(s, doesWrap) return parts.join(''); }; -if (typeof exports !== 'undefined') { exports.domline = domline; -} diff --git a/static/js/domline_client.js b/static/js/domline_client.js index 6a09a1723..b999e3589 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -318,6 +318,4 @@ domline.processSpaces = function(s, doesWrap) return parts.join(''); }; -if (typeof exports !== 'undefined') { exports.domline = domline; -} diff --git a/static/js/draggable.js b/static/js/draggable.js index 1d0ddb4c3..8d1975459 100644 --- a/static/js/draggable.js +++ b/static/js/draggable.js @@ -194,6 +194,4 @@ function makeResizableHPane(left, sep, right, minLeft, minRight, sepWidth, sepOf }); } -if (typeof exports !== 'undefined') { exports.makeDraggable = makeDraggable; -} diff --git a/static/js/easysync2.js b/static/js/easysync2.js index 81a416b25..cef868a1d 100644 --- a/static/js/easysync2.js +++ b/static/js/easysync2.js @@ -2509,7 +2509,5 @@ Changeset.followAttributes = function(att1, att2, pool) return buf.toString(); }; -if (typeof exports !== 'undefined') { exports.Changeset = Changeset; exports.AttribPool = AttribPool; -} diff --git a/static/js/easysync2_client.js b/static/js/easysync2_client.js index 5745110e6..f4f3d08fb 100644 --- a/static/js/easysync2_client.js +++ b/static/js/easysync2_client.js @@ -2270,7 +2270,5 @@ Changeset.inverse = function(cs, lines, alines, pool) return Changeset.checkRep(builder.toString()); }; -if (typeof exports !== 'undefined') { exports.Changeset = Changeset; exports.AttribPool = AttribPool; -} diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 9558ed71b..fa1b40dee 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -362,6 +362,4 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj) func(text, ''); }; -if (typeof exports !== 'undefined') { exports.linestylefilter = linestylefilter; -} diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index 9b1cb83dc..7ff5bef41 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -360,6 +360,4 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj) func(text, ''); }; -if (typeof exports !== 'undefined') { exports.linestylefilter = linestylefilter; -} diff --git a/static/js/pad2.js b/static/js/pad2.js index 5369d422a..65cd72218 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -967,7 +967,6 @@ var alertBar = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.settings = settings; exports.createCookie = createCookie; exports.readCookie = readCookie; @@ -978,4 +977,3 @@ exports.savePassword = savePassword; exports.handshake = handshake; exports.pad = pad; exports.alertBar = alertBar; -} diff --git a/static/js/pad_connectionstatus.js b/static/js/pad_connectionstatus.js index d3a7648cb..1de024e8d 100644 --- a/static/js/pad_connectionstatus.js +++ b/static/js/pad_connectionstatus.js @@ -88,6 +88,4 @@ var padconnectionstatus = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padconnectionstatus = padconnectionstatus; -} diff --git a/static/js/pad_cookie.js b/static/js/pad_cookie.js index 00dc28f39..24dc1e3fa 100644 --- a/static/js/pad_cookie.js +++ b/static/js/pad_cookie.js @@ -130,6 +130,4 @@ var padcookie = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padcookie = padcookie; -} diff --git a/static/js/pad_docbar.js b/static/js/pad_docbar.js index 2bf1a1da0..cf461c93d 100644 --- a/static/js/pad_docbar.js +++ b/static/js/pad_docbar.js @@ -463,6 +463,4 @@ var paddocbar = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.paddocbar = paddocbar; -} diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 774208940..d542b05d7 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -235,6 +235,4 @@ var padeditbar = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padeditbar = padeditbar; -} diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 45a90f006..bb775e957 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -159,6 +159,4 @@ var padeditor = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padeditor = padeditor; -} diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 8f187a5cb..aa99541ea 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -334,6 +334,4 @@ var padimpexp = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padimpexp = padimpexp; -} diff --git a/static/js/pad_modals.js b/static/js/pad_modals.js index 9d24c5f1a..81ef0776b 100644 --- a/static/js/pad_modals.js +++ b/static/js/pad_modals.js @@ -371,6 +371,4 @@ var padmodals = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padmodals = padmodals; -} diff --git a/static/js/pad_savedrevs.js b/static/js/pad_savedrevs.js index 964c83386..bb52658b2 100644 --- a/static/js/pad_savedrevs.js +++ b/static/js/pad_savedrevs.js @@ -523,6 +523,4 @@ var padsavedrevs = (function() return self; }()); -if (typeof exports !== 'undefined') { exports.padsavedrevs = padsavedrevs; -} diff --git a/static/js/pad_userlist.js b/static/js/pad_userlist.js index b9d08932e..e0a12f838 100644 --- a/static/js/pad_userlist.js +++ b/static/js/pad_userlist.js @@ -811,6 +811,4 @@ function showColorPicker() } } -if (typeof exports !== 'undefined') { exports.paduserlist = paduserlist; -} diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index 30ff308c0..aa469d87b 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -489,6 +489,4 @@ window.onerror = function test (msg, url, linenumber) return false; }; -if (typeof exports !== 'undefined') { exports.padutils = padutils; -} diff --git a/static/js/plugins.js b/static/js/plugins.js index 2cf0e0e26..ce3ec9bd7 100644 --- a/static/js/plugins.js +++ b/static/js/plugins.js @@ -32,6 +32,4 @@ plugins = { } }; -if (typeof exports !== 'undefined') { exports.plugins = plugins; -} diff --git a/static/js/skiplist.js b/static/js/skiplist.js index 995cd6bc7..385f08f0d 100644 --- a/static/js/skiplist.js +++ b/static/js/skiplist.js @@ -489,6 +489,4 @@ that is a string. return self; } -if (typeof exports !== 'undefined') { exports.newSkipList = newSkipList; -} diff --git a/static/js/undomodule.js b/static/js/undomodule.js index b515180d4..aff41a70c 100644 --- a/static/js/undomodule.js +++ b/static/js/undomodule.js @@ -332,6 +332,4 @@ var undoModule = (function() }; // apool is filled in by caller })(); -if (typeof exports !== 'undefined') { exports.undoModule = undoModule; -} diff --git a/static/js/virtual_lines.js b/static/js/virtual_lines.js index 32fc58875..2bcf5ed63 100644 --- a/static/js/virtual_lines.js +++ b/static/js/virtual_lines.js @@ -385,6 +385,4 @@ function makeVirtualLineView(lineNode) } -if (typeof exports !== 'undefined') { exports.makeVirtualLineView = makeVirtualLineView; -} From 228543a30e897e5391563da419233c7beb82ec04 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 23 Jan 2012 18:40:54 +0100 Subject: [PATCH 065/265] Text color changes based on author color --- static/js/ace2_inner.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index ec0d5dc45..292b3a4d6 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -207,12 +207,19 @@ function OUTER(gscope) { bgcolor = fadeColor(bgcolor, info.fade); } - - dynamicCSS.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).backgroundColor = bgcolor; - dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).backgroundColor = bgcolor; + // Text color + var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.45) ? '#ffffff' : '#000000'; + + var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))); + authorStyle.backgroundColor = bgcolor; + authorStyle.color = txtcolor; + + var authorStyleTop = dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( + getAuthorClassName(author))); + authorStyleTop.backgroundColor = bgcolor; + authorStyleTop.color = txtcolor; } } } From b15b7fe4bd73c9f475154f4aa76b594e90939e4f Mon Sep 17 00:00:00 2001 From: C Nelson Date: Tue, 24 Jan 2012 18:52:09 -0600 Subject: [PATCH 066/265] Changing openssl dev package name for Fedora to what it actually is. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2f85fcff..4995e852a 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
    1. Install the dependencies. We need gzip, git, curl, libssl develop libraries, python and gcc.
      For Debian/Ubuntu apt-get install gzip git-core curl python libssl-dev build-essential
      - For Fedora/CentOS yum install gzip git-core curl python openssl-dev && yum groupinstall "Development Tools" + For Fedora/CentOS yum install gzip git-core curl python openssl-devel && yum groupinstall "Development Tools"

    2. Install node.js
        From 7b77f3d4b58b4a15d46116b0e712bba85f34656b Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 25 Jan 2012 19:03:25 +0000 Subject: [PATCH 067/265] Toggle sticky chatf unction can be called very easily, 0ip to add to settings interface --- static/js/chat.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/static/js/chat.js b/static/js/chat.js index 475d01939..5fd1ad854 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -24,6 +24,7 @@ var padutils = require('/pad_utils').padutils; var chat = (function() { + var isStuck = false; var bottomMargin = "0px"; var sDuration = 500; var hDuration = 750; @@ -68,6 +69,22 @@ var chat = (function() chatMentions = 0; document.title = title; }, + stickToScreen: function() // Make chat stick to right hand side of screen + { + console.log(isStuck); + chat.show(); + if(!isStuck){ // Stick it to + $('#chatbox').css({"right":"0px", "top":"35px", "border-radius":"0px", "height":"auto"}); + $('#editorcontainer').css({"right":"170px", "width":"auto"}); + isStuck = true; + } + else{ // Unstick it + $('#chatbox').css({"right":"0px", "top":"auto", "border-top-radius":"5px", "height":"200px"}); + $('#editorcontainer').css({"right":"0px", "width":"100%"}); + isStuck = false; + } + } + , hide: function () { $("#chatcounter").text("0"); From 917732422d2fd9e07200f6547de0783db7322a0e Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 25 Jan 2012 19:06:41 +0000 Subject: [PATCH 068/265] fix minor bug where chat would overlay document scroll bar and also ensure rounded edges --- static/js/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/chat.js b/static/js/chat.js index 5fd1ad854..e2ecfb27c 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -79,7 +79,7 @@ var chat = (function() isStuck = true; } else{ // Unstick it - $('#chatbox').css({"right":"0px", "top":"auto", "border-top-radius":"5px", "height":"200px"}); + $('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "height":"200px"}); $('#editorcontainer').css({"right":"0px", "width":"100%"}); isStuck = false; } From 87b11045e18ea27d90087021145addac2bdc8a6e Mon Sep 17 00:00:00 2001 From: booo Date: Wed, 25 Jan 2012 22:00:08 +0100 Subject: [PATCH 069/265] fix issue #281? --- node/utils/Minify.js | 25 ++++++++----------------- package.json | 1 - 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 348f25373..ea7834dc1 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -28,7 +28,7 @@ var jsp = require("uglify-js").parser; var pro = require("uglify-js").uglify; var path = require('path'); var Buffer = require('buffer').Buffer; -var gzip = require('gzip'); +var zlib = require('zlib'); var RequireKernel = require('require-kernel'); var server = require('../server'); var os = require('os'); @@ -233,23 +233,14 @@ function _handle(req, res, jsFilename, jsFiles) { //write the results compressed in a file function(callback) { - //spawn a gzip process if we're on a unix system - if(os.type().indexOf("Windows") == -1) - { - gzip(result, 9, function(err, compressedResult){ - //weird gzip bug that returns 0 instead of null if everything is ok - err = err === 0 ? null : err; + zlib.gzip(result, function(err, compressedResult){ + //weird gzip bug that returns 0 instead of null if everything is ok + err = err === 0 ? null : err; + + if(ERR(err, callback)) return; - if(ERR(err, callback)) return; - - fs.writeFile(CACHE_DIR + "minified_" + jsFilename + ".gz", compressedResult, callback); - }); - } - //skip this step on windows - else - { - callback(); - } + fs.writeFile(CACHE_DIR + "minified_" + jsFilename + ".gz", compressedResult, callback); + }); } ],callback); } diff --git a/package.json b/package.json index 6567e5324..a24e96088 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "express" : "2.5.0", "clean-css" : "0.2.4", "uglify-js" : "1.1.1", - "gzip" : "0.1.0", "formidable" : "1.0.7", "log4js" : "0.3.9", "jsdom-nocontextifiy" : "0.2.10", From d370a5b76f2046b93b6131f5f90fb31c43aff38f Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Thu, 26 Jan 2012 12:55:54 +0100 Subject: [PATCH 070/265] Improved npm and node version checks --- bin/installDeps.sh | 7 +++++++ package.json | 3 +++ 2 files changed, 10 insertions(+) diff --git a/bin/installDeps.sh b/bin/installDeps.sh index a3f767a24..8580387db 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -33,6 +33,13 @@ if [ ! $(echo $NPM_VERSION | cut -d "." -f 1) = "1" ]; then exit 1 fi +#check node version +NODE_VERSION=$(node --version) +if [ ! $(echo $NODE_VERSION | cut -d "." -f 1-2) = "v0.6" ]; then + echo "You're running a wrong version of node, you're using $NODE_VERSION, we need v0.6.x" >&2 + exit 1 +fi + #Does a settings.json exist? if no copy the template if [ ! -f "settings.json" ]; then echo "Copy the settings template to settings.json..." diff --git a/package.json b/package.json index a24e96088..a515f2dd1 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,8 @@ "devDependencies": { "jshint" : "*" }, + "engines" : { "node" : ">=0.6.0", + "npm" : ">=1.0" + }, "version" : "1.0.0" } From 622068183a532eab6ffe00d1a641742392a4fd67 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Thu, 26 Jan 2012 12:57:57 +0100 Subject: [PATCH 071/265] Revert "Text color changes based on author color" This reverts commit 49061175c9557b14132e95df5ad4959edf18af4f. --- static/js/ace2_inner.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 3f0ed5fdc..e97847721 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -236,22 +236,12 @@ function OUTER(gscope) { bgcolor = fadeColor(bgcolor, info.fade); } - - // Background + dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))).backgroundColor = bgcolor; dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))).backgroundColor = bgcolor; - - // Text color - var txtcolor = (colorutils.luminosity(bgcolor) < 0.45) ? 'ffffff' : '000000'; - - dynamicCSS.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).color = txtcolor; - - dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))).color = txtcolor; } } } From 57075d15453331cd1ff6ad1175cb67bd7852d4d2 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 26 Jan 2012 17:22:44 +0100 Subject: [PATCH 072/265] Beautified html, sticky chat, dynamic inputs, beautified qr-code, fixed chat bug --- node/utils/tar.json | 2 + static/css/pad.css | 87 +++--- static/index.html | 19 +- static/js/chat.js | 33 ++- static/js/pad_editbar.js | 9 +- static/js/pad_editor.js | 9 +- static/js/pad_utils.js | 20 +- static/pad.html | 613 ++++++++++++++++++--------------------- 8 files changed, 371 insertions(+), 421 deletions(-) diff --git a/node/utils/tar.json b/node/utils/tar.json index 92883bb74..fd285b94d 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -1,6 +1,7 @@ { "pad.js": [ "jquery.js" + , "ace2_common.js" , "pad_utils.js" , "plugins.js" , "undo-xpopup.js" @@ -29,6 +30,7 @@ , "json2.js" , "colorutils.js" , "draggable.js" + , "ace2_common.js" , "pad_utils.js" , "pad_cookie.js" , "pad_editor.js" diff --git a/static/css/pad.css b/static/css/pad.css index 41ef75902..88775fa26 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1,13 +1,13 @@ *,html,body,p{ margin: 0; padding: 0; } .clear { clear: both; } -html { font-size: 62.5%; } +html { font-size: 62.5%; width: 100%; } body, textarea { font-family: Helvetica, Arial, sans-serif; } iframe {position:absolute;} #users { position: absolute; - z-index: 10; + z-index:500; background-color: #000; background-color: rgba(0,0,0,0.7); width: 160px; @@ -560,28 +560,6 @@ table#otheruserstable { display: none; } display: none; z-index: 55; } #revision-notifier .label { color: #777; font-weight: bold; } -/* We don't ever actually hide the wrapper, even when the panel is - cloased, so that its contents can always be manipulated accurately. */ - - -#padoptions { position: absolute; top: 0; left: 0; font-size: 1.2em; - color: #444; height: 100%; width: 100%; line-height: 15px; } -#options-viewhead { font-weight: bold; position: absolute; top: 10px; left: 15px; - width: auto; height: auto; } -#padoptions label { display: block; } -#padoptions input { padding: 0; margin: 0; } -#options-colorscheck { position: absolute; left: 15px; top: 34px; width: 15px; height: 15px; } -#options-colorslabel { position: absolute; left: 35px; top: 34px; } -#options-linenoscheck { position: absolute; left: 15px; top: 57px; width: 15px; height: 15px; } -#options-linenoslabel { position: absolute; left: 35px; top: 57px; } -#options-fontlabel { position: absolute; left: 15px; top: 82px; } -#viewfontmenu { position: absolute; top: 80px; left: 90px; width: 110px; } -#options-viewexplain { position: absolute; left: 215px; top: 15px; width: 100px; height: 70px; font-size: .7em; - padding-left: 10px; padding-top: 10px; border-left: 1px solid #ccc; - line-height: 20px; font-weight: bold; color: #999; } -#options-close { display: block; position: absolute; right: 7px; bottom: 8px; - width: auto; height: auto; font-size: 85%; color: #444; } - #mainmodals { z-index: 600; /* higher than the modals themselves so that modals are on top in IE */ } .modalfield { font-size: 1.2em; padding: 1px; border: 1px solid #bbb;} @@ -763,7 +741,26 @@ a#topbarmaximize { width: 100%; } -#embed, #readonly { +#settingsmenu { + position:absolute; + top:40px; + right:20px; + width:400px; + z-index:500; + padding:10px; + border-radius:6px; + background:black; + background:rgba(0, 0, 0, 0.7); + color: #fff; + font-size:14px; + display:none; +} +#settingsmenu p { + margin: 5px 0; +} + + +#embed { display:none; position:absolute; top:40px; @@ -780,20 +777,17 @@ padding: 10px; border-radius: 6px; } -#embedreadonly { +.right { float:right; } -#embedcode, #readonlyUrl, #linkcode { -margin-left:10px; -} - -#embedinput, #readonlyInput, #linkinput { -width:375px; -height:24px; -display:inline; +#embed input[type=text] { +width: 100%; +padding: 5px; +box-sizing: border-box; +-moz-box-sizing: border-box; +display:block; margin-top: 10px; -padding-left:4px; } ul#colorpickerswatches @@ -850,6 +844,7 @@ ul#colorpickerswatches li:hover left:0px; top:25px; bottom:25px; + z-index:1002; } #chattext p @@ -1006,7 +1001,7 @@ position: relative; #import{ position:absolute; - width:250px; + width:240px; left:10px; line-height:20px; } @@ -1019,7 +1014,7 @@ position: relative; } .exporttype{ - line-height:20px; + margin-top: 2px; background-repeat:no-repeat; padding-left:25px; background-image: url("../../static/img/etherpad_lite_icons.png"); @@ -1028,8 +1023,8 @@ position: relative; } #importexportline{ - border: dotted 1px; - height: 185px; + border-left: 1px solid #fff; + height: 190px; position:absolute; width:0px; left:260px; @@ -1149,14 +1144,22 @@ label[for=readonlyinput] { margin: 0 10px 0 2px; } - #qr_center { margin: 10px 10px auto 0; text-align: center; } -#qrcode{ - margin-left:10px; +#embedreadonlyqr { + box-shadow: 0 0 10px #000; + border-radius: 3px; + -webkit-transition: all .2s ease-in-out; + -moz-transition: all .2s ease-in-out; +} + +#embedreadonlyqr:hover { + cursor: none; + -moz-transform: scale(1.5); + -webkit-transform: scale(1.5); } @media screen and (max-width: 960px) { diff --git a/static/index.html b/static/index.html index 1e1861639..fe38318b7 100644 --- a/static/index.html +++ b/static/index.html @@ -1,8 +1,11 @@ - - - Etherpad Lite + + + Etherpad Lite + + + + +
        New Pad

        or create/open a Pad with the name
        - +
        -
        + + + + diff --git a/static/js/chat.js b/static/js/chat.js index e2ecfb27c..6d0711378 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -21,18 +21,17 @@ */ var padutils = require('/pad_utils').padutils; +var browser = require('/ace2_common').browser; var chat = (function() { var isStuck = false; - var bottomMargin = "0px"; var sDuration = 500; var hDuration = 750; var chatMentions = 0; var title = document.title; - if ($.browser.mobile){ - sDuration = 0; - hDuration = 0; + if (browser.mobile){ + sDuration = hDuration = 0; } var self = { show: function () @@ -57,11 +56,12 @@ var chat = (function() { $("#focusprotector").hide(); - if($.browser.mobile) - bottommargin = "32px"; - - $("#chatbox").css({right: "20px", bottom: bottomMargin, left: "", top: ""}); - + if(browser.mobile) { + $("#chatbox").css({right: "0px", bottom: "32px", left: "", top: ""}); + } else { + $("#chatbox").css({right: "20px", bottom: "0px", left: "", top: ""}); + } + self.scrollDown(); } }); @@ -73,18 +73,18 @@ var chat = (function() { console.log(isStuck); chat.show(); - if(!isStuck){ // Stick it to - $('#chatbox').css({"right":"0px", "top":"35px", "border-radius":"0px", "height":"auto"}); + if(!isStuck) { // Stick it to + $('#chatbox').css({"right":"0px", "top":"36px", "border-radius":"0px", "height":"auto", "border-right":"none", "border-left":"1px solid #ccc", "border-top":"none", "background-color":"#f1f1f1"}); + $('#chattext').css({"top":"0px"}); $('#editorcontainer').css({"right":"170px", "width":"auto"}); isStuck = true; - } - else{ // Unstick it - $('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "height":"200px"}); + } else { // Unstick it + $('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "border-right":"1px solid #999", "height":"200px", "border-top":"1px solid #999", "background-color":"#f7f7f7"}); + $('#chattext').css({"top":"25px"}); $('#editorcontainer').css({"right":"0px", "width":"100%"}); isStuck = false; } - } - , + }, hide: function () { $("#chatcounter").text("0"); @@ -194,3 +194,4 @@ var chat = (function() }()); exports.chat = chat; + diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index d542b05d7..e6ff9adf7 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -108,17 +108,20 @@ var padeditbar = (function() { self.toogleDropDown("users"); } + else if (cmd == 'settings') + { + self.toogleDropDown("settingsmenu"); + } else if (cmd == 'embed') { self.setEmbedLinks(); - $('#embedinput').focus().select(); + $('#linkinput').focus().select(); self.toogleDropDown("embed"); } else if (cmd == 'import_export') { self.toogleDropDown("importexport"); } - else if (cmd == 'save') { padsavedrevs.saveNow(); @@ -165,7 +168,7 @@ var padeditbar = (function() }, toogleDropDown: function(moduleName) { - var modules = ["embed", "users", "readonly", "importexport"]; + var modules = ["embed", "users", "readonly", "importexport", "settingsmenu"]; //hide all modules if(moduleName == "none") diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index bb775e957..e7be81753 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -87,6 +87,11 @@ var padeditor = (function() if (value == "false") return false; return defaultValue; } + + self.ace.setProperty("showsauthorcolors", settings.noColors); + + self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue); + var v; v = getOption('showLineNumbers', true); @@ -100,10 +105,6 @@ var padeditor = (function() v = getOption('useMonospaceFont', false); self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif")); $("#viewfontmenu").val(v ? "monospace" : "normal"); - - self.ace.setProperty("showsauthorcolors", settings.noColors); - - self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue); }, initViewZoom: function() { diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index aa469d87b..8583ca9e3 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -110,24 +110,6 @@ var padutils = { var x = ua.split(' ')[0]; return clean(x); }, - // "func" is a function over 0..(numItems-1) that is monotonically - // "increasing" with index (false, then true). Finds the boundary - // between false and true, a number between 0 and numItems inclusive. - binarySearch: function(numItems, func) - { - if (numItems < 1) return 0; - if (func(0)) return 0; - if (!func(numItems - 1)) return numItems; - var low = 0; // func(low) is always false - var high = numItems - 1; // func(high) is always true - while ((high - low) > 1) - { - var x = Math.floor((low + high) / 2); // x != low, x != high - if (func(x)) high = x; - else low = x; - } - return high; - }, // e.g. "Thu Jun 18 2009 13:09" simpleDateTime: function(date) { @@ -489,4 +471,6 @@ window.onerror = function test (msg, url, linenumber) return false; }; +padutils.binarySearch = require('/ace2_common').binarySearch; + exports.padutils = padutils; diff --git a/static/pad.html b/static/pad.html index 4b4b42261..3a5d01a38 100644 --- a/static/pad.html +++ b/static/pad.html @@ -1,350 +1,299 @@ - - - - - Etherpad Lite - - - - - - - - - - - - + - + Etherpad Lite -
        + + + - + + + - +
        + + +
        -
        +
        +
        +
        +
        +
        + Save + Cancel + +
        +
        +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
        -
        -
        - -
        +
        +
        +
        Loading...
        +
        -
        - -
        -
        - - - Save - - - Cancel - - -
        +
        +

        Pad settings

        +

        Global

        +

        These options affect everyone viewing this pad. [BETA]

        +

        + Authorship colors +

        +

        + Line numbers +

        +

        + Used font for this pad: + +

        +

        Local

        +

        + Sticky chat +

        +
        -
        -
        -
        -
        - -
        -
        - - - - - -
        -
        - -
        -
        -
        - -
        - -
        - -
        - - - - +
        +
        + Read only +
        +

        Share this pad

        +
        + +
        +
        +
        + +
        +
        +
        +
        +
        +
        +
        -
        +
        -
        - -
        -
        - Loading... -
        +
        + + Chat +
        +
        + 0 +
        -
        +
        +
        Chat
        +
        +
        +
        + +
        +
        +
        - -
        +
         
        -
        - Import from text file, HTML, PDF, Word, ODT or RTF:

        -
        -
        - -
        -
        -
        Successful!
        -
        - - - - - - -
        -
        -
        +
        +
        +
        + +
        +
        +
        +
        Connecting...
        +
        Reestablishing connection...
        +
        +

        Disconnected.

        +

        Opened in another window.

        +

        No Authorization.

        +
        +

        We're having trouble talking to the EtherPad lite synchronization server. You may be connecting through an incompatible firewall or proxy server.

        +
        +
        +

        We were unable to connect to the EtherPad lite synchronization server. This may be due to an incompatibility with your web browser or internet connection.

        +
        +
        +

        You seem to have opened this pad in another browser window. If you'd like to use this window instead, you can reconnect.

        +
        +
        +

        Lost connection with the EtherPad lite synchronization server. This may be due to a loss of network connectivity.

        +
        +
        +

        Server not responding. This may be due to network connectivity issues or high load on the server.

        +
        +
        +

        Your browser's credentials or permissions have changed while viewing this pad. Try reconnecting.

        +
        +
        +

        This pad was deleted.

        +
        +
        +

        If this continues to happen, please let us know

        +
        +
        + +
        +
        +
        + +
        + +
        -
        - -
        - Export current pad as: -
        HTML
        -
        Plain text
        -
        Microsoft Word
        -
        PDF
        -
        OpenDocument
        -
        DokuWiki text
        -
        Wordle
        -
        -
        -
        -
        -
        - - -
        -
        - -
        - Share: -
        -
        - -

        -
        - -

        -
        -
        -
        -
        -
        - -
        - -
        - - - -
        -
        Chat
        -
        -
        -
        - -
        -
        -
        - -
         
        - - -
        -
        - - -
        -
        -
        -
        -
        -
        - Connecting... -
        -
        - Reestablishing connection... -
        -
        -

        Disconnected.

        -

        Opened in another window.

        -

        No Authorization.

        -
        -

        - We're having trouble talking to the EtherPad lite synchronization server. - You may be connecting through an incompatible firewall or proxy server. -

        -
        -
        -

        - We were unable to connect to the EtherPad lite synchronization server. - This may be due to an incompatibility with your web browser or internet connection. -

        -
        -
        -

        - You seem to have opened this pad in another browser window. - If you'd like to use this window instead, you can reconnect. -

        -
        -
        -

        - Lost connection with the EtherPad lite synchronization server. This may be due to a loss of network connectivity. -

        -
        -
        -

        - Server not responding. This may be due to network connectivity issues or high load on the server. -

        -
        -
        -

        - Your browser's credentials or permissions have changed while viewing this pad. Try reconnecting. -

        -
        -
        -

        - This pad was deleted. -

        -
        -
        -

        - If this continues to happen, please let us know -

        -
        -
        - -
        -
        -
        - - - - - - + + From 47ee0ec383c0218067eb0965fd9b259e4aa7fcf5 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 27 Jan 2012 00:43:00 +0000 Subject: [PATCH 073/265] Fix minor styling isue where focus chat box would try to show up even if chat was stuck to screen --- static/js/chat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index 6d0711378..0ff8b398a 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -74,9 +74,9 @@ var chat = (function() console.log(isStuck); chat.show(); if(!isStuck) { // Stick it to - $('#chatbox').css({"right":"0px", "top":"36px", "border-radius":"0px", "height":"auto", "border-right":"none", "border-left":"1px solid #ccc", "border-top":"none", "background-color":"#f1f1f1"}); + $('#chatbox').css({"right":"0px", "top":"36px", "border-radius":"0px", "height":"auto", "border-right":"none", "border-left":"1px solid #ccc", "border-top":"none", "background-color":"#f1f1f1", "width":"185px"}); $('#chattext').css({"top":"0px"}); - $('#editorcontainer').css({"right":"170px", "width":"auto"}); + $('#editorcontainer').css({"right":"192px", "width":"auto"}); isStuck = true; } else { // Unstick it $('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "border-right":"1px solid #999", "height":"200px", "border-top":"1px solid #999", "background-color":"#f7f7f7"}); From a53de45b3257524f7932b0d7acc8da10d6fdc14b Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 27 Jan 2012 01:00:14 +0000 Subject: [PATCH 074/265] Beautifying 0ips commit to give settings option, also add warning prior to altering everyones view and moved everyones view stuff into my view only that needed to be moved.. --- static/css/pad.css | 36 +++++++++++++++++++++++++++++++++++ static/js/pad2.js | 6 +++++- static/pad.html | 47 ++++++++++++++++++++++++++-------------------- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 88775fa26..2e93f67f9 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -746,6 +746,7 @@ a#topbarmaximize { top:40px; right:20px; width:400px; + height:135px; z-index:500; padding:10px; border-radius:6px; @@ -1248,3 +1249,38 @@ label[for=readonlyinput] { .rtl{ direction:RTL; } + +#settingslocal{ + left:10px; + position:absolute; + width:200px; +} + +#settingseveryone{ + position:absolute; + right:10px; + width:200px; +} + +#settingsline{ + border-left: 1px solid #fff; + height: 110px; + position:absolute; + width:0px; + left:200px; + opacity:.8; +} + +.warning{ + padding:10px; + background-color:#FFA4A4; + opacity:.8; +} + +#settingseveryoneitems{ + display:none; +} + +#settingswarning{ + mouse:cursor; +} diff --git a/static/js/pad2.js b/static/js/pad2.js index 65cd72218..00cc0cb25 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -448,9 +448,13 @@ var pad = { // order of inits is important here: padcookie.init(clientVars.cookiePrefsToSet); - + $("#widthprefcheck").click(pad.toggleWidthPref); $("#sidebarcheck").click(pad.toggleSidebar); + $("#settingswarning").click(function(){ + $("#settingswarning").hide(); + $("#settingseveryoneitems").show(); + }); pad.myUserInfo = { userId: clientVars.userId, diff --git a/static/pad.html b/static/pad.html index 3a5d01a38..5117159e7 100644 --- a/static/pad.html +++ b/static/pad.html @@ -141,26 +141,33 @@

        Pad settings

        -

        Global

        -

        These options affect everyone viewing this pad. [BETA]

        -

        - Authorship colors -

        -

        - Line numbers -

        -

        - Used font for this pad: - -

        -

        Local

        -

        - Sticky chat -

        -
        +
        +

        My view only

        +

        + Chat always on screen +

        +

        + Authorship colors +

        +

        + Line numbers +

        +

        + Font type: + +

        + +
        +
        +
        +

        Everyones view

        +

        Warning:
        These options affect everyone viewing this pad.

        +
        There are no settings currently available to alter everyones view
        +
        +
        From 2a6e4ba194909f1bc69adbfb0efd6e23f7c72394 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 27 Jan 2012 01:02:12 +0000 Subject: [PATCH 075/265] Fix tiny css bug and make warning text not selectable --- static/css/pad.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/css/pad.css b/static/css/pad.css index 2e93f67f9..0a175ee97 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1282,5 +1282,11 @@ label[for=readonlyinput] { } #settingswarning{ - mouse:cursor; + cursor: pointer; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; } From f7089bba20e99c41ad1f536a12f5f40aa3a5a173 Mon Sep 17 00:00:00 2001 From: booo Date: Sat, 28 Jan 2012 12:55:11 +0100 Subject: [PATCH 076/265] package.json: update log4js version (0.4.1) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a515f2dd1..e24a776c3 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "clean-css" : "0.2.4", "uglify-js" : "1.1.1", "formidable" : "1.0.7", - "log4js" : "0.3.9", + "log4js" : "0.4.1", "jsdom-nocontextifiy" : "0.2.10", "async-stacktrace" : "0.0.2" }, From a300bb6e9268f047f990780edfda37cd9ae1c7c0 Mon Sep 17 00:00:00 2001 From: booo Date: Sat, 28 Jan 2012 13:24:58 +0100 Subject: [PATCH 077/265] move randomString function into module --- bin/convert.js | 16 +--------------- node/db/AuthorManager.js | 17 ++--------------- node/db/GroupManager.js | 16 +--------------- node/db/ReadOnlyManager.js | 17 ++--------------- node/db/SecurityManager.js | 2 ++ node/db/SessionManager.js | 16 +--------------- node/handler/APIHandler.js | 16 +--------------- node/utils/randomstring.js | 16 ++++++++++++++++ 8 files changed, 26 insertions(+), 90 deletions(-) create mode 100644 node/utils/randomstring.js diff --git a/bin/convert.js b/bin/convert.js index d410f7a4a..4302114c6 100644 --- a/bin/convert.js +++ b/bin/convert.js @@ -4,6 +4,7 @@ var ueberDB = require("ueberDB"); var mysql = require("mysql"); var async = require("async"); var Changeset = require("../node/utils/Changeset"); +var randomString = require("../node/utils/randomstring"); var AttributePoolFactory = require("../node/utils/AttributePoolFactory"); var settingsFile = process.argv[2]; @@ -450,18 +451,3 @@ function parsePage(array, pageStart, offsets, data, json) start+=unitLength; } } - -/** - * Generates a random String with the given length. Is needed to generate the Author Ids - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} diff --git a/node/db/AuthorManager.js b/node/db/AuthorManager.js index f4f42d112..7c054a56f 100644 --- a/node/db/AuthorManager.js +++ b/node/db/AuthorManager.js @@ -22,6 +22,8 @@ var ERR = require("async-stacktrace"); var db = require("./DB").db; var async = require("async"); +var randomString = require("../utils/randomstring"); + /** * Checks if the author exists */ @@ -177,18 +179,3 @@ exports.setAuthorName = function (author, name, callback) { db.setSub("globalAuthor:" + author, ["name"], name, callback); } - -/** - * Generates a random String with the given length. Is needed to generate the Author Ids - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} diff --git a/node/db/GroupManager.js b/node/db/GroupManager.js index 473ea9b77..7e3b7d6d1 100644 --- a/node/db/GroupManager.js +++ b/node/db/GroupManager.js @@ -20,6 +20,7 @@ var ERR = require("async-stacktrace"); var customError = require("../utils/customError"); +var randomString = require("../utils/randomstring"); var db = require("./DB").db; var async = require("async"); var padManager = require("./PadManager"); @@ -255,18 +256,3 @@ exports.listPads = function(groupID, callback) } }); } - -/** - * Generates a random String with the given length. Is needed to generate the Author Ids - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} diff --git a/node/db/ReadOnlyManager.js b/node/db/ReadOnlyManager.js index 73b3be9ec..1e5079c52 100644 --- a/node/db/ReadOnlyManager.js +++ b/node/db/ReadOnlyManager.js @@ -22,6 +22,8 @@ var ERR = require("async-stacktrace"); var db = require("./DB").db; var async = require("async"); +var randomString = require("../utils/randomstring"); + /** * returns a read only id for a pad * @param {String} padId the id of the pad @@ -70,18 +72,3 @@ exports.getPadId = function(readOnlyId, callback) { db.get("readonly2pad:" + readOnlyId, callback); } - -/** - * Generates a random String with the given length. Is needed to generate the read only ids - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} diff --git a/node/db/SecurityManager.js b/node/db/SecurityManager.js index 52d5afcbe..4b86d868a 100644 --- a/node/db/SecurityManager.js +++ b/node/db/SecurityManager.js @@ -26,6 +26,8 @@ var padManager = require("./PadManager"); var sessionManager = require("./SessionManager"); var settings = require("../utils/Settings") +var randomString = require("../utils/randomstring"); + /** * This function controlls the access to a pad, it checks if the user can access a pad. * @param padID the pad the user wants to access diff --git a/node/db/SessionManager.js b/node/db/SessionManager.js index a394f5442..084d4a695 100644 --- a/node/db/SessionManager.js +++ b/node/db/SessionManager.js @@ -20,6 +20,7 @@ var ERR = require("async-stacktrace"); var customError = require("../utils/customError"); +var randomString = require("../utils/randomstring"); var db = require("./DB").db; var async = require("async"); var groupMangager = require("./GroupManager"); @@ -358,21 +359,6 @@ function listSessionsWithDBKey (dbkey, callback) }); } -/** - * Generates a random String with the given length. Is needed to generate the SessionIDs - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} - //checks if a number is an int function is_int(value) { diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js index 0cd9cb58e..ca45e1f8f 100644 --- a/node/handler/APIHandler.js +++ b/node/handler/APIHandler.js @@ -22,6 +22,7 @@ var ERR = require("async-stacktrace"); var fs = require("fs"); var api = require("../db/API"); var padManager = require("../db/PadManager"); +var randomString = require("../utils/randomstring"); //ensure we have an apikey var apikey = null; @@ -157,18 +158,3 @@ function callAPI(functionName, fields, req, res) //call the api function api[functionName](functionParams[0],functionParams[1],functionParams[2],functionParams[3],functionParams[4]); } - -/** - * Generates a random String with the given length. Is needed to generate the Author Ids - */ -function randomString(len) -{ - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - var randomstring = ''; - for (var i = 0; i < len; i++) - { - var rnum = Math.floor(Math.random() * chars.length); - randomstring += chars.substring(rnum, rnum + 1); - } - return randomstring; -} diff --git a/node/utils/randomstring.js b/node/utils/randomstring.js new file mode 100644 index 000000000..4c1bba244 --- /dev/null +++ b/node/utils/randomstring.js @@ -0,0 +1,16 @@ +/** + * Generates a random String with the given length. Is needed to generate the Author, Group, readonly, session Ids + */ +var randomString = function randomString(len) +{ + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + var randomstring = ''; + for (var i = 0; i < len; i++) + { + var rnum = Math.floor(Math.random() * chars.length); + randomstring += chars.substring(rnum, rnum + 1); + } + return randomstring; +}; + +module.exports = randomString; From d872b42e31ec4698d9a9e0c3bc04e4f215ae7473 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 28 Jan 2012 17:38:52 +0100 Subject: [PATCH 078/265] reverted John's commits, added labels and tweaked popups to act more dynamically --- static/css/pad.css | 183 +++++++++++++++++---------------------------- static/js/pad2.js | 4 - static/pad.html | 57 +++++++------- 3 files changed, 96 insertions(+), 148 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 0a175ee97..7b083af03 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -741,56 +741,9 @@ a#topbarmaximize { width: 100%; } -#settingsmenu { - position:absolute; - top:40px; - right:20px; - width:400px; - height:135px; - z-index:500; - padding:10px; - border-radius:6px; - background:black; - background:rgba(0, 0, 0, 0.7); - color: #fff; - font-size:14px; - display:none; -} -#settingsmenu p { - margin: 5px 0; } -#embed { -display:none; -position:absolute; -top:40px; -font-size:14px; -width:400px; -right: 20px; -z-index: 500; -background-color: #000; -color: white; -background-color: rgb(0,0,0); -background-color: rgba(0,0,0,0.7); -padding: 10px; --moz-border-radius: 6px; -border-radius: 6px; -} - -.right { -float:right; -} - -#embed input[type=text] { -width: 100%; -padding: 5px; -box-sizing: border-box; --moz-box-sizing: border-box; -display:block; -margin-top: 10px; -} - ul#colorpickerswatches { padding-left: 3px; @@ -982,38 +935,6 @@ position: relative; top: -5px; } -#importexport{ - position:absolute; - top:40px; - font-size:14px; - width:450px; - right: 20px; - z-index: 500; - background-color: #000; - color: white; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0,0.7); - padding: 10px; - -moz-border-radius: 6px; - border-radius: 6px; - height:190px; - display:none; -} - -#import{ - position:absolute; - width:240px; - left:10px; - line-height:20px; -} - -#export{ - position:absolute; - width:180px; - right:10px; - line-height:20px; -} - .exporttype{ margin-top: 2px; background-repeat:no-repeat; @@ -1065,10 +986,6 @@ position: relative; background-position: 0px -459px; } -#export a{ - text-decoration: none; -} - #importstatusball{ display:none; } @@ -1141,10 +1058,6 @@ width:33px !important; color: #999; } -label[for=readonlyinput] { - margin: 0 10px 0 2px; -} - #qr_center { margin: 10px 10px auto 0; text-align: center; @@ -1250,43 +1163,81 @@ label[for=readonlyinput] { direction:RTL; } -#settingslocal{ - left:10px; - position:absolute; - width:200px; +#chattext p { + word-wrap: break-word; } -#settingseveryone{ - position:absolute; - right:10px; - width:200px; +/* fix for misaligned labels */ +label { + position: relative; + bottom: 1px; } -#settingsline{ - border-left: 1px solid #fff; - height: 110px; - position:absolute; - width:0px; - left:200px; - opacity:.8; +.right { + float:right; } -.warning{ - padding:10px; - background-color:#FFA4A4; - opacity:.8; +.popup { + font-size: 14px; + width: 400px; + z-index: 500; + padding: 10px; + border-radius: 6px; + background: #222; + background: rgba(0,0,0,.7); + background: -webkit-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); + background: -moz-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); + box-shadow: 0 0 8px #888; + color: #fff; } -#settingseveryoneitems{ - display:none; +.popup input[type=text] { + width: 100%; + padding: 5px; + box-sizing: border-box; + -moz-box-sizing: border-box; + display:block; + margin-top: 10px; } -#settingswarning{ - cursor: pointer; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; +.popup a { + text-decoration: none; } + +.popup h1 { + font-size: 18px; +} +.popup h2 { + font-size: 15px; +} +.popup p { + margin: 5px 0; +} + +.left_popup { + float: left; + width: 50%; +} + +.right_popup { + float: left; + padding-left: 10px; +} + +#settingsmenu, #importexport, #embed { + position: absolute; + top: 55px; + right: 20px; + display: none; +} + +#settingsmenu .right_menu { + float:none; +} + +.note { + color: #ddd; + font-size: 11px; + font-weight: bold; +} + diff --git a/static/js/pad2.js b/static/js/pad2.js index 00cc0cb25..93fb23563 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -451,10 +451,6 @@ var pad = { $("#widthprefcheck").click(pad.toggleWidthPref); $("#sidebarcheck").click(pad.toggleSidebar); - $("#settingswarning").click(function(){ - $("#settingswarning").hide(); - $("#settingseveryoneitems").show(); - }); pad.myUserInfo = { userId: clientVars.userId, diff --git a/static/pad.html b/static/pad.html index 5117159e7..e66a3d6e4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -139,18 +139,21 @@
        Loading...
        -
        -

        Pad settings

        -
        -

        My view only

        + -
        -
        -

        Import/Export

        - Import from text file, HTML, PDF, Word, ODT or RTF: -

        + + + From 01cacff00862a3d9cfd98aa3ce3db604ca2bc112 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 28 Jan 2012 21:51:25 -0500 Subject: [PATCH 089/265] Convert goToPad to middleware --- node/server.js | 131 +++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 69 deletions(-) diff --git a/node/server.js b/node/server.js index c0d6ce6ad..68b7ab6ab 100644 --- a/node/server.js +++ b/node/server.js @@ -84,6 +84,33 @@ async.waterfall([ next(); }); + + //redirects browser to the pad's sanitized url if needed. otherwise, renders the html + app.param('pad', function (req, res, next, padId) { + //ensure the padname is valid and the url doesn't end with a / + if(!padManager.isValidPadId(padId) || /\/$/.test(req.url)) + { + res.send('Such a padname is forbidden', 404); + } + else + { + padManager.sanitizePadId(padId, function(sanitizedPadId) { + //the pad id was sanitized, so we redirect to the sanitized version + if(sanitizedPadId != padId) + { + var real_path = req.path.replace(/^\/p\/[^\/]+/, '/p/' + sanitizedPadId); + res.header('Location', real_path); + res.send('You should be redirected to ' + real_path + '', 302); + } + //the pad id was fine, so just render it + else + { + next(); + } + }); + } + }); + //load modules that needs a initalized db readOnlyManager = require("./db/ReadOnlyManager"); exporthtml = require("./utils/ExportHtml"); @@ -230,94 +257,60 @@ async.waterfall([ }); }); - //redirects browser to the pad's sanitized url if needed. otherwise, renders the html - function goToPad(req, res, render) { - //ensure the padname is valid and the url doesn't end with a / - if(!padManager.isValidPadId(req.params.pad) || /\/$/.test(req.url)) - { - res.send('Such a padname is forbidden', 404); - } - else - { - padManager.sanitizePadId(req.params.pad, function(padId) { - //the pad id was sanitized, so we redirect to the sanitized version - if(padId != req.params.pad) - { - var real_path = req.path.replace(/^\/p\/[^\/]+/, '/p/' + padId); - res.header('Location', real_path); - res.send('You should be redirected to ' + real_path + '', 302); - } - //the pad id was fine, so just render it - else - { - render(); - } - }); - } - } - //serve pad.html under /p app.get('/p/:pad', function(req, res, next) { - goToPad(req, res, function() { - var filePath = path.normalize(__dirname + "/../static/pad.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); - }); + var filePath = path.normalize(__dirname + "/../static/pad.html"); + res.sendfile(filePath, { maxAge: exports.maxAge }); }); //serve timeslider.html under /p/$padname/timeslider app.get('/p/:pad/timeslider', function(req, res, next) { - goToPad(req, res, function() { - var filePath = path.normalize(__dirname + "/../static/timeslider.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); - }); + var filePath = path.normalize(__dirname + "/../static/timeslider.html"); + res.sendfile(filePath, { maxAge: exports.maxAge }); }); //serve timeslider.html under /p/$padname/timeslider app.get('/p/:pad/:rev?/export/:type', function(req, res, next) { - goToPad(req, res, function() { - var types = ["pdf", "doc", "txt", "html", "odt", "dokuwiki"]; - //send a 404 if we don't support this filetype - if(types.indexOf(req.params.type) == -1) - { - next(); - return; - } - - //if abiword is disabled, and this is a format we only support with abiword, output a message - if(settings.abiword == null && - ["odt", "pdf", "doc"].indexOf(req.params.type) !== -1) - { - res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature"); - return; - } - - res.header("Access-Control-Allow-Origin", "*"); - - hasPadAccess(req, res, function() - { - exportHandler.doExport(req, res, req.params.pad, req.params.type); - }); + var types = ["pdf", "doc", "txt", "html", "odt", "dokuwiki"]; + //send a 404 if we don't support this filetype + if(types.indexOf(req.params.type) == -1) + { + next(); + return; + } + + //if abiword is disabled, and this is a format we only support with abiword, output a message + if(settings.abiword == null && + ["odt", "pdf", "doc"].indexOf(req.params.type) !== -1) + { + res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature"); + return; + } + + res.header("Access-Control-Allow-Origin", "*"); + + hasPadAccess(req, res, function() + { + exportHandler.doExport(req, res, req.params.pad, req.params.type); }); }); //handle import requests app.post('/p/:pad/import', function(req, res, next) { - goToPad(req, res, function() { - //if abiword is disabled, skip handling this request - if(settings.abiword == null) - { - next(); - return; - } - - hasPadAccess(req, res, function() - { - importHandler.doImport(req, res, req.params.pad); - }); + //if abiword is disabled, skip handling this request + if(settings.abiword == null) + { + next(); + return; + } + + hasPadAccess(req, res, function() + { + importHandler.doImport(req, res, req.params.pad); }); }); From 6a4c025e086ef2e6a99ded4c4ab9b4f047febeb4 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 18:12:01 -0800 Subject: [PATCH 090/265] Global exception handler is not registered until the page's controller adds it. It is bad form to register this handler on definition. This would cause problems if, for instance, this module was required by our Node code. --- static/js/pad.js | 2 ++ static/js/pad_utils.js | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/static/js/pad.js b/static/js/pad.js index 172f9323f..e6d8dc9ae 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -401,6 +401,8 @@ var pad = { init: function() { + padutils.setupGlobalExceptionHandler(); + $(document).ready(function() { //start the costum js diff --git a/static/js/pad_utils.js b/static/js/pad_utils.js index 464c5058b..071185a80 100644 --- a/static/js/pad_utils.js +++ b/static/js/pad_utils.js @@ -459,17 +459,25 @@ var padutils = { } }; -//send javascript errors to the server -window.onerror = function test (msg, url, linenumber) -{ - var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, 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"; +var globalExceptionHandler = undefined; +function setupGlobalExceptionHandler() { + //send javascript errors to the server + if (!globalExceptionHandler) { + globalExceptionHandler = function test (msg, url, linenumber) + { + var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, 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); + $.post(url, errObj); - return false; -}; + return false; + }; + window.onerror = globalExceptionHandler; + } +} + +padutils.setupGlobalExceptionHandler = setupGlobalExceptionHandler; padutils.binarySearch = require('/ace2_common').binarySearch; From a408557a0ed84cfda81a0b6414a3cf56d4d88e64 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 15:26:39 -0800 Subject: [PATCH 091/265] Make implicit loading of modules unnecessary. This is one step on the way to simplifying `Minify` and allowing all of the modules within pad.js to be loaded independently in development mode (which is useful for debugging). --- node/utils/Minify.js | 5 ----- static/js/pad.js | 9 +++++++++ static/js/timeslider.js | 6 ++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index ea7834dc1..98774d195 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -306,11 +306,6 @@ function tarCode(filesInOrder, files, write) { write("\n\n\n/*** File: static/js/" + filename + " ***/\n\n\n"); write(isolateJS(files[filename], filename)); } - - for(var i = 0, ii = filesInOrder.length; i < filesInOrder.length; i++) { - var filename = filesInOrder[i]; - write('require(' + JSON.stringify('/' + filename.replace(/^\/+/, '')) + ');\n'); - } } // Wrap the following code in a self executing function and assign exports to diff --git a/static/js/pad.js b/static/js/pad.js index e6d8dc9ae..fb297d4af 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -24,6 +24,15 @@ var socket; +// These jQuery things should create local references, but for now `require()` +// assigns to the global `$` and augments it with plugins. +require('/jquery'); +require('/jquery-ui'); +require('/farbtastic'); +require('/excanvas'); +require('/json2'); +require('/undo-xpopup'); + var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; var padconnectionstatus = require('/pad_connectionstatus').padconnectionstatus; diff --git a/static/js/timeslider.js b/static/js/timeslider.js index 3b49f49ae..939c4c642 100644 --- a/static/js/timeslider.js +++ b/static/js/timeslider.js @@ -20,6 +20,12 @@ * limitations under the License. */ +// These jQuery things should create local references, but for now `require()` +// assigns to the global `$` and augments it with plugins. +require('/jquery'); +require('/json2'); +require('/undo-xpopup'); + function createCookie(name,value,days) { if (days) { From ddcaf0dad6707191e70deaf62bed94857db7827c Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 29 Jan 2012 16:57:06 +0100 Subject: [PATCH 092/265] Moved inline css to pad.css and made popups even more dynamic --- static/css/pad.css | 10 +++++----- static/pad.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 5444800ab..7c479a7fa 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1079,9 +1079,11 @@ margin-top: 1px; } .buttonicon-chat { background-position: 0px -102px; + display: inline-block; } .buttonicon-showusers { background-position: 0px -183px; + display: inline-block; } #usericon @@ -1227,7 +1229,7 @@ label { .popup { font-size: 14px; - width: 400px; + width: 450px; z-index: 500; padding: 10px; border-radius: 6px; @@ -1269,6 +1271,8 @@ label { .right_popup { float: left; + width: 50%; + box-sizing: border-box; padding-left: 10px; } @@ -1279,10 +1283,6 @@ label { display: none; } -#settingsmenu .right_popup { - float:none; -} - .note { color: #ddd; font-size: 11px; diff --git a/static/pad.html b/static/pad.html index 43eea48b6..2d8889b1b 100644 --- a/static/pad.html +++ b/static/pad.html @@ -33,7 +33,7 @@
      1. -
        +
      2. @@ -104,7 +104,7 @@
      3. -
        +
        1
      4. @@ -228,7 +228,7 @@ From 62acab961f02872d1737ecc0a8e8ed2087ddba32 Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 29 Jan 2012 17:03:33 +0100 Subject: [PATCH 093/265] added missing class for settings button --- static/css/pad.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/css/pad.css b/static/css/pad.css index 7c479a7fa..362311fcb 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -1068,6 +1068,9 @@ margin-top: 1px; .buttonicon-clearauthorship { background-position: 0px -86px; } +.buttonicon-settings { + background-position: 0px -436px; +} .buttonicon-import_export { background-position: 0px -68px; } From 7096ce7f1ef8962205e27db49284d440d834c26f Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 29 Jan 2012 18:41:33 +0000 Subject: [PATCH 094/265] Fix #171 IE9 edit issue and #361 IE URL Last Letter issue --- static/js/ace2_inner.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index e28b11e48..977c5cdff 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -3145,11 +3145,12 @@ function OUTER(gscope) // Such a div is what IE 6 creates naturally when you make a blank line // in a document of divs. However, when copy-and-pasted the div will // contain a space, so we note its emptiness with a property. - lineElem.innerHTML = ""; + lineElem.innerHTML = " "; // Frist we set a value that isnt blank // a primitive-valued property survives copy-and-paste setAssoc(lineElem, "shouldBeEmpty", true); // an object property doesn't setAssoc(lineElem, "unpasted", {}); + lineElem.innerHTML = ""; // Then we make it blank.. New line and no space = Awesome :) }; var lineClass = 'ace-line'; result.appendSpan = function(txt, cls) From ac41acd52b38929ee3ed221ca76ffe3a7533321f Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 30 Jan 2012 08:12:14 -0500 Subject: [PATCH 095/265] CSS bugfix to export popup in timeslider --- static/css/timeslider.css | 6 ++---- static/timeslider.html | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/static/css/timeslider.css b/static/css/timeslider.css index 9df408683..6022e2d7c 100644 --- a/static/css/timeslider.css +++ b/static/css/timeslider.css @@ -195,10 +195,8 @@ float:right; color: #222; } -#importexport{ - top:103px; - width:185px; -} +#importexport { top: 118px; } +#importexport .popup { width: 185px; } ul { margin-left: 1.5em; } ul ul { margin-left: 0 !important; } diff --git a/static/timeslider.html b/static/timeslider.html index 886c84201..cbcb3e366 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -188,7 +188,7 @@
        -
        +');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); -var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= -false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); -this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= -{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; -if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, -_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, -{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: -Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= -null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a
        ');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ -a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ -c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); -b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.14"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), -10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- -f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? -e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= -e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, -step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= -e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; -var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: -a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- -d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, -f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, -display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= -e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= -d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); -;/* - * jQuery UI Effects 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.14",save:function(c,a){for(var b=0;b
        ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); -c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, -a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); -a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", -"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* -((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= -e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= -e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h Date: Fri, 3 Feb 2012 21:28:19 +0100 Subject: [PATCH 108/265] rem jQ-UI from pad.js too --- static/js/pad.js | 1 - 1 file changed, 1 deletion(-) diff --git a/static/js/pad.js b/static/js/pad.js index 4fa46ac6b..47b1635b2 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -27,7 +27,6 @@ var socket; // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. require('/jquery'); -require('/jquery-ui'); require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); From f3531f3f6337ec1151739e4a0495acc06a89e0b9 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 21:32:36 +0100 Subject: [PATCH 109/265] fix css --- static/css/pad.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/css/pad.css b/static/css/pad.css index ebaee4577..d6c5a9a43 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -875,7 +875,7 @@ ul#colorpickerswatches li:hover #titlelabel { font-size:13px; - margin:4px 0 0 4px + margin:4px 0 0 4px; position:absolute; } From 79794c0572026217e3558b589e4974e5d2dde9de Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 3 Feb 2012 21:45:25 +0100 Subject: [PATCH 110/265] remove unnecessary module --- static/js/chat.js | 1 - 1 file changed, 1 deletion(-) diff --git a/static/js/chat.js b/static/js/chat.js index b0ad92e0a..bc71219cb 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -21,7 +21,6 @@ */ var padutils = require('/pad_utils').padutils; -var browser = require('/ace2_common').browser; var padcookie = require('/pad_cookie').padcookie; var chat = (function() From a8cc61545cbf66a6fb608927a9f6116ce4226b4d Mon Sep 17 00:00:00 2001 From: 0ip Date: Fri, 3 Feb 2012 22:29:43 +0100 Subject: [PATCH 111/265] Prevent that li.sepereator gets .selected --- static/js/pad_editbar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js index 71053d0c6..9280bc7bc 100644 --- a/static/js/pad_editbar.js +++ b/static/js/pad_editbar.js @@ -190,8 +190,11 @@ var padeditbar = (function() } else { - $("#editbar ul#menu_right li:not(:nth-child(" + (modules.indexOf(moduleName) + 1) + "))").removeClass("selected"); - $("#editbar ul#menu_right li:nth-child(" + (modules.indexOf(moduleName) + 1) + ")").toggleClass("selected"); + var nth_child = modules.indexOf(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"); + } //hide all modules that are not selected and show the selected one for(var i=0;i Date: Fri, 3 Feb 2012 22:52:57 +0100 Subject: [PATCH 112/265] Scroll down --- static/js/chat.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/chat.js b/static/js/chat.js index bc71219cb..e094f93df 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -33,6 +33,7 @@ var chat = (function() { $("#chaticon").hide(); $("#chatbox").show(); + self.scrollDown(); chatMentions = 0; document.title = title; }, From 7075ff6731300a88a9b79a0790096ff70daae8a2 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 4 Feb 2012 18:08:04 +0100 Subject: [PATCH 113/265] get rid of vendor prefixes --- node/utils/tar.json | 1 + static/css/pad.css | 59 ++---- static/js/pad.js | 1 + static/js/prefixfree.js | 419 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+), 47 deletions(-) create mode 100644 static/js/prefixfree.js diff --git a/node/utils/tar.json b/node/utils/tar.json index 8813b776b..aeafe23fb 100644 --- a/node/utils/tar.json +++ b/node/utils/tar.json @@ -21,6 +21,7 @@ , "chat.js" , "excanvas.js" , "farbtastic.js" + , "prefixfree.js" ] , "timeslider.js": [ "jquery.js" diff --git a/static/css/pad.css b/static/css/pad.css index a71c5d594..e407b3a4f 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -15,7 +15,6 @@ iframe {position:absolute;} top: 40px; color: #fff; padding: 5px; - -moz-border-radius: 6px; border-radius: 6px; } @@ -39,10 +38,7 @@ a img #editbar { background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); border-bottom: 1px solid #ccc; height: 32px; overflow: hidden; @@ -53,10 +49,7 @@ a img #editbar ul li { background: #fff; - background: -moz-linear-gradient(#fff, #f0f0f0); - background: -ms-linear-gradient(#fff, #f0f0f0); - background: -o-linear-gradient(#fff, #f0f0f0); - background: -webkit-linear-gradient(#fff, #f0f0f0); + background: linear-gradient(#fff, #f0f0f0); border: 1px solid #ccc; border-radius: 4px; cursor: pointer; @@ -86,10 +79,7 @@ a img #editbar ul li:active { background: #eee; - background: -moz-linear-gradient(#ddd, #fff); - background: -ms-linear-gradient(#ddd, #fff); - background: -o-linear-gradient(#ddd, #fff); - background: -webkit-linear-gradient(#ddd, #fff); + background: linear-gradient(#ddd, #fff); } #editbar ul li.separator @@ -190,7 +180,6 @@ a#backtoprosite { padding-left: 20px; left: 6px; #alertbar { margin-top: 6px; opacity: 0; - filter: alpha(opacity = 0); /* IE */ display: none; position:absolute; left:0; @@ -384,10 +373,7 @@ a#hidetopmsg { position: absolute; right: 5px; bottom: 5px; } #mycolorpickersave, #mycolorpickercancel { background: #fff; - background: -moz-linear-gradient(#fff, #ccc); - background: -ms-linear-gradient(#fff, #ccc); - background: -o-linear-gradient(#fff, #ccc); - background: -webkit-linear-gradient(#fff, #ccc); + background: linear-gradient(#fff, #ccc); border: 1px solid #ccc; border-radius: 4px; font-size:12px; @@ -725,14 +711,7 @@ a#topbarmaximize { text-decoration: none; padding: 50pt; font-size: 20pt; - -moz-border-radius-topleft: 3pt; - -moz-border-radius-topright: 3pt; - -moz-border-radius-bottomleft: 3pt; - -moz-border-radius-bottomright: 3pt; - -webkit-border-top-left-radius: 3pt; - -webkit-border-top-right-radius: 3pt; - -webkit-border-bottom-left-radius: 3pt; - -webkit-border-bottom-right-radius: 3pt; + border-radius: 3pt; } .modaldialog .bigbutton { @@ -953,7 +932,7 @@ position: relative; } .impexpbutton{ - background-image: -moz-linear-gradient(center top , #EEEEEE, white 20%, white 20%); + background-image: linear-gradient(center top , #EEEEEE, white 20%, white 20%); padding:3px; } @@ -1021,7 +1000,6 @@ color: white; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.7); padding: 10px; --moz-border-radius: 6px; border-radius: 6px; opacity:.8; } @@ -1118,14 +1096,12 @@ width:33px !important; #embedreadonlyqr { box-shadow: 0 0 10px #000; border-radius: 3px; - -webkit-transition: all .2s ease-in-out; - -moz-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; } #embedreadonlyqr:hover { cursor: none; - -moz-transform: scale(1.5); - -webkit-transform: scale(1.5); + transform: scale(1.5); } @media screen and (max-width: 960px) { @@ -1166,10 +1142,7 @@ width:33px !important; } #editbar ul#menu_right { background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); width: 100%; overflow: hidden; height: 32px; @@ -1193,10 +1166,7 @@ width:33px !important; border-right: none; border-radius: 0; background: #f7f7f7; - background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%); - background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%); + background: linear-gradient(#f7f7f7, #f1f1f1 80%); border: 0; } #chatbox { @@ -1237,8 +1207,7 @@ label { border-radius: 6px; background: #222; background: rgba(0,0,0,.7); - background: -webkit-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); - background: -moz-linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); + background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,.7) 35px, rgba(0,0,0,.6)); box-shadow: 0 0 8px #888; color: #fff; } @@ -1247,7 +1216,6 @@ label { width: 100%; padding: 5px; box-sizing: border-box; - -moz-box-sizing: border-box; display:block; margin-top: 10px; } @@ -1292,8 +1260,5 @@ label { .selected { background: #eee !important; - background: -webkit-linear-gradient(#EEE, #F0F0F0) !important; - background: -moz-linear-gradient(#EEE, #F0F0F0) !important; - background: -ms-linear-gradient(#EEE, #F0F0F0) !important; - background: -o-linear-gradient(#EEE, #F0F0F0) !important; + background: linear-gradient(#EEE, #F0F0F0) !important; } diff --git a/static/js/pad.js b/static/js/pad.js index 47b1635b2..c7a740cbb 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -31,6 +31,7 @@ require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); require('/undo-xpopup'); +require('prefixfree'); var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; diff --git a/static/js/prefixfree.js b/static/js/prefixfree.js new file mode 100644 index 000000000..1b0d52466 --- /dev/null +++ b/static/js/prefixfree.js @@ -0,0 +1,419 @@ +/** + * StyleFix 1.0.1 + * @author Lea Verou + * MIT license + */ + +(function(){ + +if(!window.addEventListener) { + return; +} + +var self = window.StyleFix = { + link: function(link) { + try { + // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets + if(link.rel !== 'stylesheet' || !link.sheet.cssRules || link.hasAttribute('data-noprefix')) { + return; + } + } + catch(e) { + return; + } + + var url = link.href || link.getAttribute('data-href'), + base = url.replace(/[^\/]+$/, ''), + parent = link.parentNode, + xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + + xhr.onreadystatechange = function() { + if(xhr.readyState === 4) { + var css = xhr.responseText; + + if(css && link.parentNode) { + css = self.fix(css, true, link); + + // Convert relative URLs to absolute, if needed + if(base) { + css = css.replace(/url\((?:'|")?(.+?)(?:'|")?\)/gi, function($0, url) { + if(!/^([a-z]{3,10}:|\/|#)/i.test(url)) { // If url not absolute & not a hash + // May contain sequences like /../ and /./ but those DO work + return 'url("' + base + url + '")'; + } + + return $0; + }); + + // behavior URLs shoudn’t be converted (Issue #19) + css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1'); + } + + var style = document.createElement('style'); + style.textContent = css; + style.media = link.media; + style.disabled = link.disabled; + style.setAttribute('data-href', link.getAttribute('href')); + + parent.insertBefore(style, link); + parent.removeChild(link); + } + } + }; + + xhr.send(null); + + link.setAttribute('data-inprogress', ''); + }, + + styleElement: function(style) { + var disabled = style.disabled; + + style.textContent = self.fix(style.textContent, true, style); + + style.disabled = disabled; + }, + + styleAttribute: function(element) { + var css = element.getAttribute('style'); + + css = self.fix(css, false, element); + + element.setAttribute('style', css); + }, + + process: function() { + // Linked stylesheets + $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); + + // Inline stylesheets + $('style').forEach(StyleFix.styleElement); + + // Inline styles + $('[style]').forEach(StyleFix.styleAttribute); + }, + + register: function(fixer, index) { + (self.fixers = self.fixers || []) + .splice(index === undefined? self.fixers.length : index, 0, fixer); + }, + + fix: function(css, raw) { + for(var i=0; i 3) { + parts.pop(); + + var shorthand = parts.join('-'); + + if(supported(shorthand) && properties.indexOf(shorthand) === -1) { + properties.push(shorthand); + } + } + } + }, + supported = function(property) { + return StyleFix.camelCase(property) in dummy; + } + + // Some browsers have numerical indices for the properties, some don't + if(style.length > 0) { + for(var i=0; i Date: Sat, 4 Feb 2012 18:11:41 +0100 Subject: [PATCH 114/265] add missing slash --- static/js/pad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/pad.js b/static/js/pad.js index c7a740cbb..7eb744a12 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -31,7 +31,7 @@ require('/farbtastic'); require('/excanvas'); JSON = require('/json2'); require('/undo-xpopup'); -require('prefixfree'); +require('/prefixfree'); var chat = require('/chat').chat; var getCollabClient = require('/collab_client').getCollabClient; From eb24404d3d55dd87444c24484e042ce64db3de07 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 4 Feb 2012 18:37:36 +0100 Subject: [PATCH 115/265] automatic prefixfree.js dl --- bin/installDeps.sh | 15 ++ static/js/prefixfree.js | 419 ---------------------------------------- 2 files changed, 15 insertions(+), 419 deletions(-) delete mode 100644 static/js/prefixfree.js diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 8580387db..ab976a66b 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -67,6 +67,21 @@ if [ $DOWNLOAD_JQUERY = "true" ]; then curl -lo static/js/jquery.js http://code.jquery.com/jquery-$NEEDED_VERSION.js || exit 1 fi +echo "Ensure prefixfree is downloaded and up to date..." +DOWNLOAD_PREFIXFREE="true" +NEEDED_VERSION="1.0.4" +if [ -f "static/js/prefixfree.js" ]; then + VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); + + if [ ${VERSION#v} = $NEEDED_VERSION ]; then + DOWNLOAD_PREFIXFREE="false" + fi +fi + +if [ $DOWNLOAD_PREFIXFREE = "true" ]; then + curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.min.js || exit 1 +fi + #Remove all minified data to force node creating it new echo "Clear minfified cache..." rm -f var/minified* diff --git a/static/js/prefixfree.js b/static/js/prefixfree.js deleted file mode 100644 index 1b0d52466..000000000 --- a/static/js/prefixfree.js +++ /dev/null @@ -1,419 +0,0 @@ -/** - * StyleFix 1.0.1 - * @author Lea Verou - * MIT license - */ - -(function(){ - -if(!window.addEventListener) { - return; -} - -var self = window.StyleFix = { - link: function(link) { - try { - // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets - if(link.rel !== 'stylesheet' || !link.sheet.cssRules || link.hasAttribute('data-noprefix')) { - return; - } - } - catch(e) { - return; - } - - var url = link.href || link.getAttribute('data-href'), - base = url.replace(/[^\/]+$/, ''), - parent = link.parentNode, - xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - - xhr.onreadystatechange = function() { - if(xhr.readyState === 4) { - var css = xhr.responseText; - - if(css && link.parentNode) { - css = self.fix(css, true, link); - - // Convert relative URLs to absolute, if needed - if(base) { - css = css.replace(/url\((?:'|")?(.+?)(?:'|")?\)/gi, function($0, url) { - if(!/^([a-z]{3,10}:|\/|#)/i.test(url)) { // If url not absolute & not a hash - // May contain sequences like /../ and /./ but those DO work - return 'url("' + base + url + '")'; - } - - return $0; - }); - - // behavior URLs shoudn’t be converted (Issue #19) - css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1'); - } - - var style = document.createElement('style'); - style.textContent = css; - style.media = link.media; - style.disabled = link.disabled; - style.setAttribute('data-href', link.getAttribute('href')); - - parent.insertBefore(style, link); - parent.removeChild(link); - } - } - }; - - xhr.send(null); - - link.setAttribute('data-inprogress', ''); - }, - - styleElement: function(style) { - var disabled = style.disabled; - - style.textContent = self.fix(style.textContent, true, style); - - style.disabled = disabled; - }, - - styleAttribute: function(element) { - var css = element.getAttribute('style'); - - css = self.fix(css, false, element); - - element.setAttribute('style', css); - }, - - process: function() { - // Linked stylesheets - $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); - - // Inline stylesheets - $('style').forEach(StyleFix.styleElement); - - // Inline styles - $('[style]').forEach(StyleFix.styleAttribute); - }, - - register: function(fixer, index) { - (self.fixers = self.fixers || []) - .splice(index === undefined? self.fixers.length : index, 0, fixer); - }, - - fix: function(css, raw) { - for(var i=0; i 3) { - parts.pop(); - - var shorthand = parts.join('-'); - - if(supported(shorthand) && properties.indexOf(shorthand) === -1) { - properties.push(shorthand); - } - } - } - }, - supported = function(property) { - return StyleFix.camelCase(property) in dummy; - } - - // Some browsers have numerical indices for the properties, some don't - if(style.length > 0) { - for(var i=0; i Date: Sat, 4 Feb 2012 18:46:43 +0100 Subject: [PATCH 116/265] fixes automatic update --- .gitignore | 3 ++- bin/installDeps.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 32f9ea7d7..6b1e54c64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules settings.json static/js/jquery.js +static/js/prefixfree.js APIKEY.txt bin/abiword.exe bin/node.exe @@ -8,4 +9,4 @@ etherpad-lite-win.zip var/dirty.db bin/convertSettings.json *~ -*.patch \ No newline at end of file +*.patch diff --git a/bin/installDeps.sh b/bin/installDeps.sh index ab976a66b..4892f3ebb 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -73,13 +73,13 @@ NEEDED_VERSION="1.0.4" if [ -f "static/js/prefixfree.js" ]; then VERSION=$(cat static/js/prefixfree.js | grep "PrefixFree" | grep -o "[0-9].[0-9].[0-9]"); - if [ ${VERSION#v} = $NEEDED_VERSION ]; then + if [ $VERSION = $NEEDED_VERSION ]; then DOWNLOAD_PREFIXFREE="false" fi fi if [ $DOWNLOAD_PREFIXFREE = "true" ]; then - curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.min.js || exit 1 + curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1 fi #Remove all minified data to force node creating it new From 17e9cf71da7c144efb657d8414f5496d9501b845 Mon Sep 17 00:00:00 2001 From: elijah Date: Sat, 4 Feb 2012 15:22:25 -0800 Subject: [PATCH 117/265] use english spelling: replace costumStart with customStart. --- static/custom/js.template | 4 ++-- static/index.html | 4 ++-- static/js/pad.js | 4 ++-- static/js/timeslider.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) 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/pad.js b/static/js/pad.js index 7eb744a12..85d42f0b9 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -414,8 +414,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/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("/"); From 200346ee5de6b8df6004008fb2c68b74417aa123 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 5 Feb 2012 14:23:01 +0000 Subject: [PATCH 118/265] Allow parameter to be passed to always show cha ton side of screen --- static/js/pad.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/js/pad.js b/static/js/pad.js index 7eb744a12..4ed359ecf 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() From 7a03405bb01921b5f3488ac51ee90d8596677513 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 5 Feb 2012 13:27:27 -0800 Subject: [PATCH 119/265] Fix version check for jQuery 1.7.1 download. This corrects 3d108d6dceaac78e2e8395620d80b10f88b766d5, which caused jQuery's version to mismatch and installDeps to download a new version every run. --- bin/installDeps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 2a505f826..b11c09ac5 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" From 3fb62956b9c004ebf412382d933b2c78e87fd545 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 5 Feb 2012 11:13:43 -0800 Subject: [PATCH 120/265] Plugins are injected and no longer exist in the global scope. --- static/js/ace.js | 9 +++++++++ static/js/contentcollector.js | 17 ++--------------- static/js/domline.js | 17 ++--------------- static/js/domline_client.js | 17 ++--------------- static/js/linestylefilter.js | 27 +++------------------------ static/js/linestylefilter_client.js | 27 +++------------------------ static/js/plugins.js | 2 +- 7 files changed, 22 insertions(+), 94 deletions(-) diff --git a/static/js/ace.js b/static/js/ace.js index 6854b1142..9efb5d74a 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -337,6 +337,15 @@ function Ace2Editor() $$INCLUDE_JS("../static/js/domline.js"); $$INCLUDE_JS("../static/js/ace2_inner.js"); pushRequireScriptTo(iframeHTML); + // Inject my plugins into my child. + iframeHTML.push('\ +\ +'); pushScriptTagsFor(iframeHTML, includedJS); iframeHTML.push(''); 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..d89eeb464 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -26,12 +26,7 @@ // requires: plugins // requires: undefined -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; var domline = {}; domline.noop = function() @@ -148,15 +143,7 @@ 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", { domline: domline, diff --git a/static/js/domline_client.js b/static/js/domline_client.js index b999e3589..095307141 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -25,12 +25,7 @@ // requires: plugins // requires: undefined -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; var domline = {}; domline.noop = function() @@ -147,15 +142,7 @@ 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", { domline: domline, diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index fa1b40dee..6bb09f07b 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -29,12 +29,7 @@ // requires: undefined var Changeset = require('/easysync2').Changeset -var plugins = undefined; -try { - plugins = require('/plugins').plugins; -} catch (e) { - // silence -} +var plugins = require('/plugins').plugins; var linestylefilter = {}; @@ -59,15 +54,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,15 +299,7 @@ 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, diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index 7ff5bef41..8f1a6bafd 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -27,12 +27,7 @@ // 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 linestylefilter = {}; @@ -57,15 +52,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,15 +297,7 @@ 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, diff --git a/static/js/plugins.js b/static/js/plugins.js index ce3ec9bd7..963f055cf 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}()); From b1d871d0fddbd08e627ffdfc0d559eb6d370d90f Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 17:05:29 -0800 Subject: [PATCH 121/265] Defer socket setup until initialization and on document ready. Code at the top level of a module should be related to definition only. Things that execute code should be inside of initialization methods. All evidence suggests that the binding to `window.onload` was arbitrary, and that this can be done as soon as the document is ready with no ill-effects. --- static/js/collab_client.js | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) 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) From f010f3ae9d2ff12be4ff666a1d44756dbe521268 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 22 Jan 2012 16:42:07 -0800 Subject: [PATCH 122/265] Remove redundant line. --- node/server.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/node/server.js b/node/server.js index 68b7ab6ab..a6a57497a 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"); From 3678625c7c5f944edccacb0f5b7f63eb164c649f Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 31 Jan 2012 21:20:33 -0800 Subject: [PATCH 123/265] Remove dependencies on native `map`. --- static/js/ace.js | 13 ------------- static/js/domline.js | 5 +++-- static/js/domline_client.js | 5 +++-- static/js/linestylefilter.js | 3 ++- static/js/linestylefilter_client.js | 3 ++- static/js/plugins.js | 10 ++++++---- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/static/js/ace.js b/static/js/ace.js index 9efb5d74a..4cad6b4f7 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -371,19 +371,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/domline.js b/static/js/domline.js index d89eeb464..8d8c2ea9e 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -27,6 +27,7 @@ // requires: undefined var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -145,10 +146,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) 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 095307141..87b6ed558 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -26,6 +26,7 @@ // requires: undefined var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -144,10 +145,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) 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 6bb09f07b..d0b5bc6e8 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -30,6 +30,7 @@ var Changeset = require('/easysync2').Changeset var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -305,7 +306,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) 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 8f1a6bafd..f057e21a2 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -28,6 +28,7 @@ var Changeset = require('/easysync2_client').Changeset var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -303,7 +304,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) linestylefilter: linestylefilter, browser: browser }); - hookFilters.map(function(hookFilter) + map(hookFilters, function(hookFilter) { func = hookFilter(lineText, func); }); diff --git a/static/js/plugins.js b/static/js/plugins.js index 963f055cf..3e226eba1 100644 --- a/static/js/plugins.js +++ b/static/js/plugins.js @@ -25,10 +25,12 @@ var 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 || ""); } }; From e68413d9986f099ff855c9790d1eda2412e169ff Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 22 Jan 2012 18:29:00 -0800 Subject: [PATCH 124/265] Extract Ace.js file generation. --- node/utils/Minify.js | 135 ++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 98774d195..44ae88c08 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -74,7 +74,6 @@ function _handle(req, res, jsFilename, jsFiles) { if(settings.minify) { var fileValues = {}; - var embeds = {}; var latestModification = 0; async.series([ @@ -145,77 +144,20 @@ function _handle(req, res, jsFilename, jsFiles) { { async.forEach(jsFiles, function (item, callback) { - fs.readFile(JS_DIR + item, "utf-8", function(err, data) - { + if (item == 'ace.js') { + getAceFile(handleFile); + } else { + fs.readFile(JS_DIR + item, "utf-8", handleFile); + } + + function handleFile(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'; - } - - callback(); - }); - }, //put all together and write it into a file function(callback) { @@ -295,6 +237,65 @@ function _handle(req, res, jsFilename, jsFiles) { } } +// 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 = []; + } + + 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 { + fs.readFile(ROOT_DIR + filename, "utf8", function (error, data) { + handleEmbed(error, isolateJS(data, shortFilename)); + }); + } + } 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'; From ebb5055ce81bd3d279100a5af230728687f92a10 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 16:24:11 -0800 Subject: [PATCH 125/265] Extract file retrieval. --- node/utils/Minify.js | 77 +++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 44ae88c08..5deaa1330 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -73,7 +73,7 @@ function _handle(req, res, jsFilename, jsFiles) { //minifying is enabled if(settings.minify) { - var fileValues = {}; + var result = undefined; var latestModification = 0; async.series([ @@ -142,30 +142,20 @@ function _handle(req, res, jsFilename, jsFiles) { //load all js files function (callback) { - async.forEach(jsFiles, function (item, callback) - { - if (item == 'ace.js') { - getAceFile(handleFile); - } else { - fs.readFile(JS_DIR + item, "utf-8", handleFile); - } + var values = []; + tarCode( + jsFiles + , function (content) {values.push(content)} + , function (err) { + if(ERR(err)) return; - function handleFile(err, data) - { - if(ERR(err, callback)) return; - fileValues[item] = data; - callback(); - } - }, callback); + 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) @@ -213,25 +203,11 @@ 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(); }); } @@ -301,12 +277,25 @@ 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) { + async.forEach(jsFiles, function (item, callback){ + if (item == 'ace.js') { + getAceFile(handleFile); + } else { + fs.readFile(JS_DIR + item, "utf8", handleFile); + } + + function handleFile(err, data) { + if(ERR(err, callback)) return; + write("\n\n\n/*** File: static/js/" + item + " ***/\n\n\n"); + if (settings.minify) { + write(compressJS([isolateJS(data, item)]) + ';\n'); + } else { + write(isolateJS(data, item)); + } + callback(); + } + }, callback); } // Wrap the following code in a self executing function and assign exports to From ddc74cd0f13afd99d1276a942d0afdd221dba4d9 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 31 Jan 2012 14:03:10 -0800 Subject: [PATCH 126/265] Make the comment a part of the module. --- node/utils/Minify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 5deaa1330..e025e927e 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -287,7 +287,7 @@ function tarCode(jsFiles, write, callback) { function handleFile(err, data) { if(ERR(err, callback)) return; - write("\n\n\n/*** File: static/js/" + item + " ***/\n\n\n"); + data = ("\n\n\n/*** File: static/js/" + item + " ***/\n\n\n") + data; if (settings.minify) { write(compressJS([isolateJS(data, item)]) + ';\n'); } else { From 458b5a4f03b081a8abac68f04999f65c4cf442d3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 31 Jan 2012 14:29:48 -0800 Subject: [PATCH 127/265] Combine tar and isolate, so that everything is done in one definition. --- node/utils/Minify.js | 46 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index e025e927e..b2c98d528 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -278,37 +278,41 @@ function requireDefinition() { } function tarCode(jsFiles, write, callback) { - async.forEach(jsFiles, function (item, callback){ - if (item == 'ace.js') { + write('require.define({'); + var initialEntry = true; + async.forEach(jsFiles, function (filename, callback){ + if (filename == 'ace.js') { getAceFile(handleFile); } else { - fs.readFile(JS_DIR + item, "utf8", handleFile); + fs.readFile(JS_DIR + filename, "utf8", handleFile); } function handleFile(err, data) { if(ERR(err, callback)) return; - data = ("\n\n\n/*** File: static/js/" + item + " ***/\n\n\n") + data; - if (settings.minify) { - write(compressJS([isolateJS(data, item)]) + ';\n'); + var srcPath = JSON.stringify('/' + filename); + var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, '')); + if (!initialEntry) { + write('\n,'); } else { - write(isolateJS(data, item)); + 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(); } - }, callback); -} - -// 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 () { + write('});\n'); + callback(); + }); } function compressJS(values) From 348e7ef1d5e1eb38ab76523cbd6e5fdc1b36adca Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 31 Jan 2012 00:12:10 -0800 Subject: [PATCH 128/265] Define packaging for iframe JS in the same way as pad.js and timeslider.js. --- node/utils/Minify.js | 12 ++++++++--- node/utils/tar.json | 14 +++++++++++++ static/js/ace.js | 48 ++++++++++++++------------------------------ 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index b2c98d528..c078c5c66 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -239,9 +239,15 @@ function getAceFile(callback) { // the kernel isn’t actually on the file system. handleEmbed(null, requireDefinition()); } else { - fs.readFile(ROOT_DIR + filename, "utf8", function (error, data) { - handleEmbed(error, isolateJS(data, shortFilename)); - }); + var contents = ''; + tarCode(tar[shortFilename] || shortFilename + , function (content) { + contents += content; + } + , function () { + handleEmbed(null, contents); + } + ); } } else { fs.readFile(ROOT_DIR + filename, "utf8", handleEmbed); 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/static/js/ace.js b/static/js/ace.js index 4cad6b4f7..4a3137276 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -228,29 +228,23 @@ function Ace2Editor() buffer.push('\ '); - pushScriptTagsFor(iframeHTML, includedJS); + pushScriptsTo(iframeHTML); iframeHTML.push(''); iframeHTML.push(' '); From 4bf9b0c8054504b9560cb0b24fcf061f6fa05d6d Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 30 Jan 2012 21:37:39 -0800 Subject: [PATCH 129/265] Always include the require kernel. --- node/utils/Minify.js | 1 + static/js/ace.js | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index c078c5c66..859ee07ae 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -223,6 +223,7 @@ function getAceFile(callback) { if (!settings.minify) { founds = []; } + founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")'); data += ';\n'; data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n'; diff --git a/static/js/ace.js b/static/js/ace.js index 4a3137276..3fdfa05ec 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -217,15 +217,11 @@ 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'; if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) { buffer.push(' @@ -297,14 +294,15 @@
        diff --git a/static/timeslider.html b/static/timeslider.html index cbcb3e366..fc8e2d4e3 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -205,13 +205,12 @@ From 762d39f009859f276d7683ad1113fc7032319160 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Tue, 31 Jan 2012 22:32:46 -0800 Subject: [PATCH 131/265] Move scripts to the bottom of the page. --- static/pad.html | 11 +++++------ static/timeslider.html | 14 ++++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/static/pad.html b/static/pad.html index b8d48028d..48892e0f4 100644 --- a/static/pad.html +++ b/static/pad.html @@ -11,11 +11,6 @@ - - - - -
        - + + + + - - - - - @@ -203,7 +197,11 @@
        - + + + +'); + iframeHTML.push('\ -'); - pushScriptsTo(iframeHTML); - + iframeHTML.push('require.define("/plugins", null);'); + iframeHTML.push('require.define("/plugins.js", function (require, exports, module) {'); + iframeHTML.push('module.exports = parent.parent.require("/plugins");'); + iframeHTML.push('});'); + iframeHTML.push('<\/script>'); + + // Require ace2 + iframeHTML.push(''); + iframeHTML.push(' -
        -
        New Pad

        or create/open a Pad with the name
        -
        +
        +
        +
        New Pad
        +
        or create/open a Pad with the name
        + - - + + +
        + - + - + '); - iframeHTML.push(''); - iframeHTML.push('\ +'); + pushScriptsTo(iframeHTML); + iframeHTML.push(''); iframeHTML.push(' '); - editor.iframeHTML = iframeHTML.join('\n'); - // Expose myself to global for my child frame. var thisFunctionsName = "ChildAccessibleAce2Editor"; (function () {return this}())[thisFunctionsName] = Ace2Editor; - - var outerScript = 'editorId = "' + info.id + '"; editorInfo = parent.' + thisFunctionsName + '.registry[editorId]; ' + - 'window.onload = function()' + - '{ window.onload = null; setTimeout' + '(function() ' + - '{ var iframe = document.createElement("IFRAME"); ' + - 'iframe.scrolling = "no"; var outerdocbody = document.getElementById("outerdocbody"); ' + - 'iframe.frameBorder = 0; iframe.allowTransparency = true; ' + // for IE - 'outerdocbody.insertBefore(iframe, outerdocbody.firstChild); ' + - 'iframe.ace_outerWin = window; ' + - 'var doc = iframe.contentWindow.document; doc.open();doc.write(editorInfo.editor.iframeHTML); doc.close();'+ - 'readyFunc = function() { editorInfo.onEditorReady(); readyFunc = null; editorInfo = null; };' + - '}, 0); }'; - - - // Build HTML of editor iFrame; - var outerHTML = [doctype, '']; - outerHTML.push(''); - outerHTML.push(''); - outerHTML.push(''] + + var includedCSS = []; + var $$INCLUDE_CSS = function(filename) {includedCSS.push(filename)}; + $$INCLUDE_CSS("../static/css/iframe_editor.css"); + $$INCLUDE_CSS("../static/css/pad.css"); + $$INCLUDE_CSS("../static/custom/pad.css"); + pushStyleTagsFor(outerHTML, includedCSS); // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // (throbs busy while typing) @@ -244,7 +295,6 @@ function Ace2Editor() document.getElementById(containerId).appendChild(outerFrame); var editorDocument = outerFrame.contentWindow.document; - editorDocument.open(); editorDocument.write(outerHTML.join('')); From c3f728b2ed8592973bfca992485bb11e1678f089 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 26 Feb 2012 16:13:07 +0100 Subject: [PATCH 235/265] Revert "drop embedding of JS/CSS files in ace.js. May result in a little performance drop but makes code much smaller" This reverts commit 9ede14a546731e692640a408c2b5bdb07d2c2c59. --- node/utils/Minify.js | 74 +++++++++++++++++++- static/js/ace.js | 158 ++++++++++++++++++++++++++++--------------- 2 files changed, 176 insertions(+), 56 deletions(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index baeaee688..859ee07ae 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -213,6 +213,72 @@ function _handle(req, res, jsFilename, jsFiles) { } } +// 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'; @@ -222,8 +288,12 @@ function tarCode(jsFiles, write, callback) { write('require.define({'); var initialEntry = true; async.forEach(jsFiles, function (filename, callback){ - fs.readFile(JS_DIR + filename, "utf8", handleFile); - + if (filename == 'ace.js') { + getAceFile(handleFile); + } else { + fs.readFile(JS_DIR + filename, "utf8", handleFile); + } + function handleFile(err, data) { if(ERR(err, callback)) return; var srcPath = JSON.stringify('/' + filename); diff --git a/static/js/ace.js b/static/js/ace.js index 63b1e61fe..6c7bb84e2 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -133,6 +133,74 @@ function Ace2Editor() return info.ace_getUnhandledErrors(); }; + + + function sortFilesByEmbeded(files) { + var embededFiles = []; + var remoteFiles = []; + + if (Ace2Editor.EMBEDED) { + for (var i = 0, ii = files.length; i < ii; i++) { + var file = files[i]; + if (Object.prototype.hasOwnProperty.call(Ace2Editor.EMBEDED, file)) { + embededFiles.push(file); + } else { + remoteFiles.push(file); + } + } + } else { + remoteFiles = files; + } + + return {embeded: embededFiles, remote: remoteFiles}; + } + function pushRequireScriptTo(buffer) { + 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(''); - iframeHTML.push(''); - iframeHTML.push('\ +'); + pushScriptsTo(iframeHTML); + iframeHTML.push(''); iframeHTML.push(' '); - editor.iframeHTML = iframeHTML.join('\n'); - // Expose myself to global for my child frame. var thisFunctionsName = "ChildAccessibleAce2Editor"; (function () {return this}())[thisFunctionsName] = Ace2Editor; - - var outerScript = 'editorId = "' + info.id + '"; editorInfo = parent.' + thisFunctionsName + '.registry[editorId]; ' + - 'window.onload = function()' + - '{ window.onload = null; setTimeout' + '(function() ' + - '{ var iframe = document.createElement("IFRAME"); ' + - 'iframe.scrolling = "no"; var outerdocbody = document.getElementById("outerdocbody"); ' + - 'iframe.frameBorder = 0; iframe.allowTransparency = true; ' + // for IE - 'outerdocbody.insertBefore(iframe, outerdocbody.firstChild); ' + - 'iframe.ace_outerWin = window; ' + - 'var doc = iframe.contentWindow.document; doc.open();doc.write(editorInfo.editor.iframeHTML); doc.close();'+ - 'readyFunc = function() { editorInfo.onEditorReady(); readyFunc = null; editorInfo = null; };' + - '}, 0); }'; - - - // Build HTML of editor iFrame; - var outerHTML = [doctype, '']; - outerHTML.push(''); - outerHTML.push(''); - outerHTML.push(''] + + var includedCSS = []; + var $$INCLUDE_CSS = function(filename) {includedCSS.push(filename)}; + $$INCLUDE_CSS("../static/css/iframe_editor.css"); + $$INCLUDE_CSS("../static/css/pad.css"); + $$INCLUDE_CSS("../static/custom/pad.css"); + pushStyleTagsFor(outerHTML, includedCSS); // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // (throbs busy while typing) @@ -244,7 +295,6 @@ function Ace2Editor() document.getElementById(containerId).appendChild(outerFrame); var editorDocument = outerFrame.contentWindow.document; - editorDocument.open(); editorDocument.write(outerHTML.join('')); From 00c3281a0230cec6bbafd64bcd680974b97e2a03 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 26 Feb 2012 19:59:02 +0100 Subject: [PATCH 236/265] Forbid colons, this Fixes #301 --- node/db/PadManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node/db/PadManager.js b/node/db/PadManager.js index 231aa901f..126826123 100644 --- a/node/db/PadManager.js +++ b/node/db/PadManager.js @@ -43,7 +43,8 @@ var globalPads = { * time, and allow us to "play back" these changes so legacy padIds can be found. */ var padIdTransforms = [ - [/\s+/g, '_'] + [/\s+/g, '_'], + [/:+/g, '_'] ]; /** From 9fe4318e77ea348e3ebd287ede7cc3f41a1191c0 Mon Sep 17 00:00:00 2001 From: Constantin Jucovschi Date: Sun, 26 Feb 2012 18:59:11 +0000 Subject: [PATCH 237/265] more doc update --- static/js/Changeset.js | 174 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 8 deletions(-) diff --git a/static/js/Changeset.js b/static/js/Changeset.js index 42a8f0dc1..81c0c81b2 100644 --- a/static/js/Changeset.js +++ b/static/js/Changeset.js @@ -627,7 +627,11 @@ exports.stringAssembler = function () { }; }; -// "lines" need not be an array as long as it supports certain calls (lines_foo inside). +/** + * This class allows to iterate and modify texts which have several lines + * It is used for applying Changesets on arrays of lines + * Note from prev docs: "lines" need not be an array as long as it supports certain calls (lines_foo inside). + */ exports.textLinesMutator = function (lines) { // Mutates lines, an array of strings, in place. // Mutation operations have the same constraints as exports operations @@ -882,6 +886,21 @@ exports.textLinesMutator = function (lines) { return self; }; +/** + * 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 + * advances. When opX.opcode = 0, iterator X advances to + * next element + * func has signature f(op1, op2, opOut) + * op1 - current operation of the first iterator + * op2 - current operation of the second iterator + * opOut - result operator to be put into Changeset + * @return {string} the integrated changeset + */ exports.applyZip = function (in1, idx1, in2, idx2, func) { var iter1 = exports.opIterator(in1, idx1); var iter2 = exports.opIterator(in2, idx2); @@ -975,6 +994,11 @@ exports.applyToText = function (cs, str) { return assem.toString(); }; +/** + * applies a changeset on an array of lines + * @param CS {Changeset} the changeset to be applied + * @param lines The lines to which the changeset needs to be applied + */ exports.mutateTextLines = function (cs, lines) { var unpacked = exports.unpack(cs); var csIter = exports.opIterator(unpacked.ops); @@ -997,6 +1021,13 @@ exports.mutateTextLines = function (cs, lines) { mut.close(); }; +/** + * 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 + */ exports.composeAttributes = function (att1, att2, resultIsMutation, pool) { // att1 and att2 are strings like "*3*f*1c", asMutation is a boolean. // Sometimes attribute (key,value) pairs are treated as attribute presence @@ -1054,6 +1085,10 @@ exports.composeAttributes = function (att1, att2, resultIsMutation, pool) { return buf.toString(); }; +/** + * 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 // attribution string or the earlier of two exportss being composed. @@ -1140,6 +1175,12 @@ exports._slicerZipperFunc = function (attOp, csOp, opOut, pool) { } }; +/** + * Applies a Changeset to the attribs string of a AText. + * @param cs {string} Changeset + * @param astr {string} the attribs string of a AText + * @param pool {AttribsPool} the attibutes pool + */ exports.applyToAttribution = function (cs, astr, pool) { var unpacked = exports.unpack(cs); @@ -1248,6 +1289,11 @@ exports.mutateAttributionLines = function (cs, lines, pool) { //dmesg("-> "+lines.toSource()); }; +/** + * joins several Attribution lines + * @param theAlines collection of Attribution lines + * @returns {string} joined Attribution lines + */ exports.joinAttributionLines = function (theAlines) { var assem = exports.mergingOpAssembler(); for (var i = 0; i < theAlines.length; i++) { @@ -1298,10 +1344,20 @@ exports.splitAttributionLines = function (attrOps, text) { return lines; }; +/** + * splits text into lines + * @param {string} text to be splitted + */ exports.splitTextLines = function (text) { return text.match(/[^\n]*(?:\n|[^\n]$)/g); }; +/** + * compose two Changesets + * @param cs1 {Changeset} first Changeset + * @param cs2 {Changeset} second Changeset + * @param pool {AtribsPool} Attribs pool + */ exports.compose = function (cs1, cs2, pool) { var unpacked1 = exports.unpack(cs1); var unpacked2 = exports.unpack(cs2); @@ -1344,10 +1400,14 @@ exports.compose = function (cs1, cs2, pool) { return exports.pack(len1, len3, newOps, bankAssem.toString()); }; +/** + * 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 pool {AttribPool} Attribute pool + */ exports.attributeTester = function (attribPair, 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. if (!pool) { return never; } @@ -1366,10 +1426,27 @@ exports.attributeTester = function (attribPair, pool) { } }; +/** + * creates the identity Changeset of length N + * @param N {int} length of the identity changeset + */ exports.identity = function (N) { return exports.pack(N, 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 + * for the new text. + * @param oldFullText {string} old text + * @param spliecStart {int} where splicing starts + * @param numRemoved {int} number of characters to be removed + * @param newText {string} string to be inserted + * @param optNewTextAPairs {string} new pairs to be inserted + * @param pool {AttribPool} Attribution Pool + */ exports.makeSplice = function (oldFullText, spliceStart, numRemoved, newText, optNewTextAPairs, pool) { var oldLen = oldFullText.length; @@ -1390,8 +1467,14 @@ exports.makeSplice = function (oldFullText, spliceStart, numRemoved, newText, op return exports.pack(oldLen, newLen, assem.toString(), newText); }; +/** + * Transforms a changeset into a list of splices in the form + * [startChar, endChar, newText] meaning replace text from + * startChar to endChar with newText + * @param cs Changeset + */ exports.toSplices = function (cs) { - // get a list of splices, [startChar, endChar, newText] + // var unpacked = exports.unpack(cs); var splices = []; @@ -1421,6 +1504,9 @@ exports.toSplices = function (cs) { return splices; }; +/** + * + */ exports.characterRangeFollow = function (cs, startChar, endChar, insertionsAfter) { var newStartChar = startChar; var newEndChar = endChar; @@ -1465,6 +1551,14 @@ exports.characterRangeFollow = function (cs, startChar, endChar, insertionsAfter return [newStartChar, newEndChar]; }; +/** + * Iterate over attributes in a changeset and move them from + * oldPool to newPool + * @param cs {Changeset} Chageset/attribution string to be iterated over + * @param oldPool {AttribPool} old attributes pool + * @param newPool {AttribPool} new attributes pool + * @return {string} the new Changeset + */ exports.moveOpsToNewPool = function (cs, oldPool, newPool) { // works on exports or attribution string var dollarPos = cs.indexOf('$'); @@ -1482,13 +1576,22 @@ exports.moveOpsToNewPool = function (cs, oldPool, newPool) { }) + fromDollar; }; +/** + * create an attribution inserting a text + * @param text {string} text to be inserted + */ exports.makeAttribution = function (text) { var assem = exports.smartOpAssembler(); assem.appendOpWithText('+', text); return assem.toString(); }; -// callable on a exports, attribution string, or attribs property of an op +/** + * Iterates over attributes in exports, attribution string, or attribs property of an op + * 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) { @@ -1502,12 +1605,21 @@ 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. +/** + * Filter attributes which should remain in a Changeset + * 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 + * 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 + */ exports.mapAttribNumbers = function (cs, func) { var dollarPos = cs.indexOf('$'); if (dollarPos < 0) { @@ -1542,6 +1654,12 @@ exports.makeAText = function (text, attribs) { }; }; +/** + * Apply a Changeset to a AText + * @param cs {Changeset} Changeset to be applied + * @param atext {AText} + * @param pool {AttribPool} Attribute Pool to add to + */ exports.applyToAText = function (cs, atext, pool) { return { text: exports.applyToText(cs, atext.text), @@ -1549,6 +1667,10 @@ exports.applyToAText = function (cs, atext, pool) { }; }; +/** + * Clones a AText structure + * @param atext {AText} + */ exports.cloneAText = function (atext) { return { text: atext.text, @@ -1556,11 +1678,20 @@ exports.cloneAText = function (atext) { }; }; +/** + * Copies a AText structure from atext1 to atext2 + * @param atext {AText} + */ exports.copyAText = function (atext1, atext2) { atext2.text = atext1.text; atext2.attribs = atext1.attribs; }; +/** + * Append the set of operations from atext to an assembler + * @param atext {AText} + * @param assem Assembler like smartOpAssembler + */ exports.appendATextToAssembler = function (atext, assem) { // intentionally skips last newline char of atext var iter = exports.opIterator(atext.attribs); @@ -1594,6 +1725,11 @@ exports.appendATextToAssembler = function (atext, assem) { } }; +/** + * Creates a clone of a Changeset and it's APool + * @param cs {Changeset} + * @param pool {AtributePool} + */ exports.prepareForWire = function (cs, pool) { var newPool = AttributePoolFactory.createAttributePool();; var newCs = exports.moveOpsToNewPool(cs, pool, newPool); @@ -1603,15 +1739,32 @@ exports.prepareForWire = function (cs, pool) { }; }; +/** + * Checks if a changeset s the identity changeset + */ exports.isIdentity = function (cs) { var unpacked = exports.unpack(cs); return unpacked.ops == "" && unpacked.oldLen == unpacked.newLen; }; +/** + * 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 + */ exports.opAttributeValue = function (op, key, pool) { return exports.attribsAttributeValue(op.attribs, key, pool); }; +/** + * 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 + */ exports.attribsAttributeValue = function (attribs, key, pool) { var value = ''; if (attribs) { @@ -1624,6 +1777,11 @@ exports.attribsAttributeValue = function (attribs, key, pool) { return value; }; +/** + * Creates a Changeset builder for a string with initial + * length oldLen. Allows to add/remove parts of it + * @param oldLen {int} Old length + */ exports.builder = function (oldLen) { var assem = exports.smartOpAssembler(); var o = exports.newOp(); From 4dc86f338224dff193f2bfe131a66e893dee2550 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 26 Feb 2012 21:26:42 +0000 Subject: [PATCH 238/265] fix #507 import showing when it shouldnt --- static/js/pad_impexp.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 6fe42c705..130281bfa 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -257,6 +257,7 @@ var padimpexp = (function() $("#exportworda").remove(); $("#exportpdfa").remove(); $("#exportopena").remove(); + $(".importformdiv").remove(); $("#import").html("Import is not available. To enable import please install abiword"); } else if(clientVars.abiwordAvailable == "withoutPDF") From ed8aff22d431dc80926300a019bc9e0439e99370 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 00:22:53 +0100 Subject: [PATCH 239/265] restart abiword on crash and give the user feedback about bad import files --- node/handler/ImportHandler.js | 22 +++++++--- node/utils/Abiword.js | 83 ++++++++++++++++++----------------- static/js/pad_impexp.js | 65 +++++++-------------------- 3 files changed, 75 insertions(+), 95 deletions(-) diff --git a/node/handler/ImportHandler.js b/node/handler/ImportHandler.js index 06a2ce5ca..3dccb8af4 100644 --- a/node/handler/ImportHandler.js +++ b/node/handler/ImportHandler.js @@ -115,7 +115,15 @@ exports.doImport = function(req, res, padId) { var randNum = Math.floor(Math.random()*0xFFFFFFFF); destFile = tempDirectory + "eplite_import_" + randNum + ".txt"; - abiword.convertFile(srcFile, destFile, "txt", callback); + abiword.convertFile(srcFile, destFile, "txt", function(err){ + //catch convert errors + if(err){ + console.warn("Converting Error:", err); + return callback("convertFailed"); + } else { + callback(); + } + }); }, //get the pad object @@ -176,16 +184,18 @@ exports.doImport = function(req, res, padId) } ], function(err) { - //the upload failed, there is nothing we can do, send a 500 - if(err == "uploadFailed") + var status = "ok"; + + //check for known errors and replace the status + if(err == "uploadFailed" || err == "convertFailed") { - res.send(500); - return; + status = err; + err = null; } ERR(err); //close the connection - res.send("ok"); + res.send("", 200); }); } diff --git a/node/utils/Abiword.js b/node/utils/Abiword.js index c53a6ab37..27138e648 100644 --- a/node/utils/Abiword.js +++ b/node/utils/Abiword.js @@ -53,7 +53,7 @@ if(os.type().indexOf("Windows") > -1) abiword.on('exit', function (code) { if(code != 0) { - throw "Abiword died with exit code " + code; + return callback("Abiword died with exit code " + code); } if(stdoutBuffer != "") @@ -75,52 +75,54 @@ if(os.type().indexOf("Windows") > -1) else { //spawn the abiword process - var abiword = spawn(settings.abiword, ["--plugin", "AbiCommand"]); - - //append error messages to the buffer - abiword.stderr.on('data', function (data) - { - stdoutBuffer += data.toString(); - }); - - //throw exceptions if abiword is dieing - abiword.on('exit', function (code) - { - throw "Abiword died with exit code " + code; - }); - - //delegate the processing of stdout to a other function - abiword.stdout.on('data',onAbiwordStdout); - + var abiword; var stdoutCallback = null; - var stdoutBuffer = ""; - var firstPrompt = true; + var spawnAbiword = function (){ + abiword = spawn(settings.abiword, ["--plugin", "AbiCommand"]); + var stdoutBuffer = ""; + var firstPrompt = true; - function onAbiwordStdout(data) - { - //add data to buffer - stdoutBuffer+=data.toString(); - - //we're searching for the prompt, cause this means everything we need is in the buffer - if(stdoutBuffer.search("AbiWord:>") != -1) + //append error messages to the buffer + abiword.stderr.on('data', function (data) { - //filter the feedback message - var err = stdoutBuffer.search("OK") != -1 ? null : stdoutBuffer; + stdoutBuffer += data.toString(); + }); + + //abiword died, let's restart abiword and return an error with the callback + abiword.on('exit', function (code) + { + spawnAbiword(); + stdoutCallback("Abiword died with exit code " + code); + }); + + //delegate the processing of stdout to a other function + abiword.stdout.on('data',function (data) + { + //add data to buffer + stdoutBuffer+=data.toString(); - //reset the buffer - stdoutBuffer = ""; - - //call the callback with the error message - //skip the first prompt - if(stdoutCallback != null && !firstPrompt) + //we're searching for the prompt, cause this means everything we need is in the buffer + if(stdoutBuffer.search("AbiWord:>") != -1) { - stdoutCallback(err); - stdoutCallback = null; + //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) + { + stdoutCallback(err); + stdoutCallback = null; + } + + firstPrompt = false; } - - firstPrompt = false; - } + }); } + spawnAbiword(); doConvertTask = function(task, callback) { @@ -130,6 +132,7 @@ else stdoutCallback = function (err) { callback(); + console.log("queue continue"); task.callback(err); }; } diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 6fe42c705..7ec0b3442 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -95,11 +95,6 @@ var padimpexp = (function() }, 0); $('#importarrow').stop(true, true).hide(); $('#importstatusball').show(); - - $("#import .importframe").load(function() - { - importDone(); - }); } return ret; } @@ -107,8 +102,6 @@ var padimpexp = (function() function importFailed(msg) { importErrorMessage(msg); - importDone(); - addImportFrames(); } function importDone() @@ -120,6 +113,7 @@ var padimpexp = (function() }, 0); $('#importstatusball').hide(); importClearTimeout(); + addImportFrames(); } function importClearTimeout() @@ -131,11 +125,19 @@ var padimpexp = (function() } } - function importErrorMessage(msg) + function importErrorMessage(status) { + var msg=""; + + if(status === "convertFailed"){ + msg = "We were not able to import this file. Please use a different document format or copy paste manually"; + } else if(status === "uploadFailed"){ + msg = "The upload failed, please try again"; + } + function showError(fade) { - $('#importmessagefail').html('Import failed: ' + (msg || 'Please try a different file.'))[(fade ? "fadeIn" : "show")](); + $('#importmessagefail').html('Import failed: ' + (msg || 'Please copy paste'))[(fade ? "fadeIn" : "show")](); } if ($('#importexport .importmessage').is(':visible')) @@ -175,39 +177,6 @@ var padimpexp = (function() importDone(); } - function importApplicationSuccessful(data, textStatus) - { - if (data.substr(0, 2) == "ok") - { - if ($('#importexport .importmessage').is(':visible')) - { - $('#importexport .importmessage').hide(); - } - $('#importmessagesuccess').html('Import successful!').show(); - $('#importformfilediv').hide(); - window.setTimeout(function() - { - $('#importmessagesuccess').fadeOut("slow", function() - { - $('#importformfilediv').show(); - }); - if (hidePanelCall) - { - hidePanelCall(); - } - }, 3000); - } - else if (data.substr(0, 4) == "fail") - { - importErrorMessage("Couldn't update pad contents. This can happen if your web browser has \"cookies\" disabled."); - } - else if (data.substr(0, 4) == "msg:") - { - importErrorMessage(data.substr(4)); - } - importDone(); - } - ///// export function cantExport() @@ -290,16 +259,14 @@ var padimpexp = (function() $('#importform').submit(fileInputSubmit); $('.disabledexport').click(cantExport); }, - handleFrameCall: function(callName, argsArray) + handleFrameCall: function(status) { - if (callName == 'importFailed') + if (status !== "ok") { - importFailed(argsArray[0]); - } - else if (callName == 'importSuccessful') - { - importSuccessful(argsArray[0]); + importFailed(status); } + + importDone(); }, disable: function() { From 973aad5c96e5731ad6891f0d507b630d76c63c1b Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 14:13:47 +0100 Subject: [PATCH 240/265] Fix doesPadExist check --- node/db/PadManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/db/PadManager.js b/node/db/PadManager.js index 126826123..4e3a31999 100644 --- a/node/db/PadManager.js +++ b/node/db/PadManager.js @@ -115,7 +115,7 @@ exports.doesPadExists = function(padId, callback) db.get("pad:"+padId, function(err, value) { if(ERR(err, callback)) return; - callback(null, value != null); + callback(null, value != null && value.atext); }); } From 0c770526982104d392284c4b1e2612794bf09e67 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 14:20:33 +0100 Subject: [PATCH 241/265] Fixed #299 and #338 --- node/handler/ImportHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/handler/ImportHandler.js b/node/handler/ImportHandler.js index 3dccb8af4..ed5eb05ee 100644 --- a/node/handler/ImportHandler.js +++ b/node/handler/ImportHandler.js @@ -82,7 +82,7 @@ exports.doImport = function(req, res, padId) //this allows us to accept source code files like .c or .java function(callback) { - var fileEnding = srcFile.split(".")[1].toLowerCase(); + var fileEnding = (srcFile.split(".")[1] || "").toLowerCase(); var knownFileEndings = ["txt", "doc", "docx", "pdf", "odt", "html", "htm"]; //find out if this is a known file ending From c54d47e1c6d141a3059939ff57d42b2b3ff985a6 Mon Sep 17 00:00:00 2001 From: Stefan 'Gared Date: Mon, 27 Feb 2012 15:24:36 +0000 Subject: [PATCH 242/265] Added cookie to save option showing author colors --- static/js/pad.js | 16 +++++++++++++++- static/js/pad_editor.js | 1 + static/pad.html | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/static/js/pad.js b/static/js/pad.js index d6bb4c717..426050987 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -282,7 +282,7 @@ function handshake() pad.changeViewOption('showLineNumbers', false); } - // If the noColors value is set to true then we need to hide the backround colors on the ace spans + // If the noColors value is set to true then we need to hide the background colors on the ace spans if (settings.noColors == true) { pad.changeViewOption('noColors', true); @@ -488,6 +488,9 @@ var pad = { chat.stickToScreen(true); // stick it to the screen $('#options-stickychat').prop("checked", true); // set the checkbox to on } + if(padcookie.getPref("showAuthorshipColors") == false){ + pad.changeViewOption('showAuthorColors', false); + } } }, dispose: function() @@ -752,6 +755,7 @@ var pad = { // pad.determineSidebarVisibility(isConnected && !isInitialConnect); pad.determineChatVisibility(isConnected && !isInitialConnect); + pad.determineAuthorshipColorsVisibility(); }, /* determineSidebarVisibility: function(asNowConnectedFeedback) @@ -781,6 +785,16 @@ var pad = { $('#options-stickychat').prop("checked", false); // set the checkbox for off } }, + determineAuthorshipColorsVisibility: function(){ + var authColCookie = padcookie.getPref('showAuthorshipColors'); + if (authColCookie){ + pad.changeViewOption('showAuthorColors', true); + $('#options-colorscheck').prop("checked", true); + } + else { + $('#options-colorscheck').prop("checked", false); + } + }, handleCollabAction: function(action) { if (action == "commitPerformed") diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index e838ae040..3dd67544d 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -69,6 +69,7 @@ var padeditor = (function() }); padutils.bindCheckboxChange($("#options-colorscheck"), function() { + padcookie.setPref('showAuthorshipColors', padutils.getCheckbox("#options-colorscheck")); pad.changeViewOption('showAuthorColors', padutils.getCheckbox("#options-colorscheck")); }); $("#viewfontmenu").change(function() diff --git a/static/pad.html b/static/pad.html index ea0ad6f3a..6f9665507 100644 --- a/static/pad.html +++ b/static/pad.html @@ -140,7 +140,7 @@

        - +

        From d00be5b8172af29e78e11b219b3a3ea5ef59611d Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 17:33:27 +0100 Subject: [PATCH 243/265] Removed all window.unload event handlers. This kind of fixes #200 --- static/js/ace2_inner.js | 1 - static/js/collab_client.js | 7 ------- static/js/pad.js | 28 ++++++++++++++-------------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 2418b3843..71f7d20f8 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -4654,7 +4654,6 @@ function Ace2Inner(){ function bindTheEventHandlers() { - bindEventHandler(window, "unload", teardown); bindEventHandler(document, "keydown", handleKeyEvent); bindEventHandler(document, "keypress", handleKeyEvent); bindEventHandler(document, "keyup", handleKeyEvent); diff --git a/static/js/collab_client.js b/static/js/collab_client.js index ec575fe0a..bb68f6040 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -84,13 +84,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) {} }; - $(window).bind("unload", function() - { - if (getSocket()) - { - setChannelState("DISCONNECTED", "unload"); - } - }); if ($.browser.mozilla) { // Prevent "escape" from taking effect and canceling a comet connection; diff --git a/static/js/pad.js b/static/js/pad.js index d6bb4c717..058213ce5 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -164,7 +164,8 @@ function handshake() //connect socket = pad.socket = io.connect(url, { resource: resource, - 'max reconnection attempts': 3 + 'max reconnection attempts': 3, + 'sync disconnect on unload' : false }); function sendClientReady(isReconnect) @@ -222,15 +223,19 @@ function handshake() sendClientReady(true); }); - socket.on('disconnect', function () { - function disconnectEvent() - { - pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout"); + socket.on('disconnect', function (reason) { + if(reason == "booted"){ + pad.collabClient.setChannelState("DISCONNECTED"); + } else { + function disconnectEvent() + { + pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout"); + } + + pad.collabClient.setChannelState("RECONNECTING"); + + disconnectTimeout = setTimeout(disconnectEvent, 10000); } - - pad.collabClient.setChannelState("RECONNECTING"); - - disconnectTimeout = setTimeout(disconnectEvent, 10000); }); var receivedClientVars = false; @@ -396,11 +401,6 @@ var pad = { getParams(); handshake(); }); - - $(window).unload(function() - { - pad.dispose(); - }); }, _afterHandshake: function() { From 5888f5ff7d0215d47c9622afef80497132922b3f Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 19:13:25 +0100 Subject: [PATCH 244/265] @cweider, only Chuck Norris can compute in json files --- settings.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.json.template b/settings.json.template index 57bc5711b..94a60fd40 100644 --- a/settings.json.template +++ b/settings.json.template @@ -41,7 +41,7 @@ /* How long may clients use served javascript code? Without versioning this is may cause problems during deployment. */ - "maxAge" : 1000*60*60*6, // 6 hours + "maxAge" : 21600000, // 6 hours /* This is the path to the Abiword executable. Setting it to null, disables abiword. Abiword is needed to enable the import/export of pads*/ From 599c8c7c12870325f58e1b9ab6a916ed1473421f Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 27 Feb 2012 19:46:30 +0100 Subject: [PATCH 245/265] update dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 35c3028a1..3231eb6ca 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,11 @@ "require-kernel" : "1.0.3", "socket.io" : "0.8.7", "ueberDB" : "0.1.7", - "async" : "0.1.15", - "express" : "2.5.0", + "async" : "0.1.18", + "express" : "2.5.8", "clean-css" : "0.3.2", "uglify-js" : "1.2.5", - "formidable" : "1.0.7", + "formidable" : "1.0.9", "log4js" : "0.4.1", "jsdom-nocontextifiy" : "0.2.10", "async-stacktrace" : "0.0.2" From 5bfde917b074234755a46e55e534a7a70bd5e19f Mon Sep 17 00:00:00 2001 From: 0ip Date: Mon, 27 Feb 2012 22:04:03 +0100 Subject: [PATCH 246/265] revert viewport to fix #508 --- static/index.html | 2 +- static/pad.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index da24a7a7c..8e0b02a97 100644 --- a/static/index.html +++ b/static/index.html @@ -4,7 +4,7 @@ Etherpad Lite - + + +

        @@ -218,11 +188,9 @@
        -
        - - Chat -
        -
        +
        + Chat + 0
        @@ -308,4 +276,4 @@ }()); - + \ No newline at end of file From b507f48a341517287eadffe066aa1b20ea761729 Mon Sep 17 00:00:00 2001 From: 0ip Date: Tue, 28 Feb 2012 21:37:10 +0100 Subject: [PATCH 252/265] typos --- static/css/pad.css | 1 - static/pad.html | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/static/css/pad.css b/static/css/pad.css index 2b6136656..fe188e474 100644 --- a/static/css/pad.css +++ b/static/css/pad.css @@ -813,7 +813,6 @@ ul#colorpickerswatches li:hover border: 1px solid #BBBBBB; width: 100%; float:right; - vertical-align: middle; } #chaticon diff --git a/static/pad.html b/static/pad.html index 30836f81c..4c6d4d8cf 100644 --- a/static/pad.html +++ b/static/pad.html @@ -53,13 +53,13 @@