From 49061175c9557b14132e95df5ad4959edf18af4f Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 22 Jan 2012 13:30:25 +0100 Subject: [PATCH 01/33] Text color changes based on author color --- static/js/ace2_inner.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index ec0d5dc45..6e61ac932 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -207,12 +207,22 @@ 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 228543a30e897e5391563da419233c7beb82ec04 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 23 Jan 2012 18:40:54 +0100 Subject: [PATCH 02/33] 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 03/33] 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 04/33] 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 05/33] 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 06/33] 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 07/33] 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 08/33] 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 09/33] 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 10/33] 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 11/33] 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 12/33] 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 13/33] 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 14/33] 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 15/33] 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 26/33] 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 27/33] 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 28/33] 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 29/33] 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 30/33] 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 31/33] 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 32/33] 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 @@
      -
      +