From 0e7cb78ec2f06d2dff0df85605936c1f2d708472 Mon Sep 17 00:00:00 2001 From: Patrick Rauscher Date: Sat, 7 Apr 2012 00:33:24 +0000 Subject: [PATCH 01/82] Allow disabling Passwords by setting them to an empty string --- src/node/db/API.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index 09cc95af..37fd3f16 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -431,7 +431,7 @@ exports.setPassword = function(padID, password, callback) if(ERR(err, callback)) return; //set the password - pad.setPassword(password); + pad.setPassword(password == "" ? null : password); callback(); }); From f4be70c45e5f9b0197a656b9a398e842d4378cda Mon Sep 17 00:00:00 2001 From: Edy Date: Thu, 12 Apr 2012 20:24:38 +0200 Subject: [PATCH 02/82] add more blocks to pad.html ... to allow plugins to be more flexible extending etherpad --- src/templates/pad.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/templates/pad.html b/src/templates/pad.html index 91583b36..b9c77ea4 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -18,6 +18,7 @@ + <% e.begin_block("body"); %>
@@ -118,6 +119,7 @@
@@ -271,7 +282,8 @@ <% e.end_block(); %> - + <% e.end_block(); %> + <% e.begin_block("scripts"); %> From f809b0d6c8c4c9f3d1f9ae7b8e36cdf7af117bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 12:03:11 +0200 Subject: [PATCH 03/82] removing de-facto noop --- src/static/js/ace.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 6ea2938b..0b115262 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -239,14 +239,6 @@ require.setGlobalKeyPath("require");\n\ iframeHTML: iframeHTML }); - // For compatability's sake transform in and out. - for (var i = 0, ii = iframeHTML.length; i < ii; i++) { - iframeHTML[i] = JSON.stringify(iframeHTML[i]); - } - for (var i = 0, ii = iframeHTML.length; i < ii; i++) { - iframeHTML[i] = JSON.parse(iframeHTML[i]); - } - // calls to these functions ($$INCLUDE_...) are replaced when this file is processed // and compressed, putting the compressed code from the named file directly into the // source here. From 23bbe4ab5a7dcfad0cfe3e4f4a30f4e426aed15e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 12:03:38 +0200 Subject: [PATCH 04/82] undo-xpopup seems to be unused --- src/node/utils/tar.json | 2 -- src/static/js/pad.js | 1 - src/static/js/timeslider.js | 1 - src/static/js/undo-xpopup.js | 34 ---------------------------------- 4 files changed, 38 deletions(-) delete mode 100644 src/static/js/undo-xpopup.js diff --git a/src/node/utils/tar.json b/src/node/utils/tar.json index 5c1abac5..e691334d 100644 --- a/src/node/utils/tar.json +++ b/src/node/utils/tar.json @@ -6,7 +6,6 @@ , "pad.js" , "ace2_common.js" , "pad_utils.js" - , "undo-xpopup.js" , "json2.js" , "pad_cookie.js" , "pad_editor.js" @@ -27,7 +26,6 @@ "jquery.js" , "underscore.js" , "security.js" - , "undo-xpopup.js" , "json2.js" , "colorutils.js" , "draggable.js" diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 3a1c1633..5826823c 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -30,7 +30,6 @@ require('./jquery'); require('./farbtastic'); require('./excanvas'); JSON = require('./json2'); -require('./undo-xpopup'); var chat = require('./chat').chat; var getCollabClient = require('./collab_client').getCollabClient; diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 438b1695..fd70a532 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -24,7 +24,6 @@ // assigns to the global `$` and augments it with plugins. require('./jquery'); JSON = require('./json2'); -require('./undo-xpopup'); var createCookie = require('./pad_utils').createCookie; var readCookie = require('./pad_utils').readCookie; diff --git a/src/static/js/undo-xpopup.js b/src/static/js/undo-xpopup.js deleted file mode 100644 index e733f3ea..00000000 --- a/src/static/js/undo-xpopup.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This code is mostly from the old Etherpad. Please help us to comment this code. - * This helps other people to understand this code better and helps them to improve it. - * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED - */ - -/** - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS-IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -if (window._orig_windowOpen) -{ - window.open = _orig_windowOpen; -} -if (window._orig_windowSetTimeout) -{ - window.setTimeout = _orig_windowSetTimeout; -} -if (window._orig_windowSetInterval) -{ - window.setInterval = _orig_windowSetInterval; -} From e661f653b194bb04211259867b1bfca0cb3fd00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 12:15:09 +0200 Subject: [PATCH 05/82] sharebox and Feedback are not used. Removing them --- src/static/css/pad.css | 21 +-- src/static/js/pad_modals.js | 301 ------------------------------------ 2 files changed, 1 insertion(+), 321 deletions(-) diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 2ce8dbb6..948f0245 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -883,15 +883,6 @@ down on the page in IE. Strange but it works! */ line-height: 18px; padding: 2px; } -#sharebox-send { - float: right; - background-repeat: no-repeat; - background-image: url(static/img/sharebox4.gif); - display: block; - width: 87px; - height: 22px; - background-position: -383px -289px; -} #viewbarcontents { display: none } @@ -949,17 +940,7 @@ down on the page in IE. Strange but it works! */ .sidebarchecked { background-position: -1px -67px } -#feedbackbutton { - display: block; - position: absolute; - width: 68px; - height: 0; - padding-top: 17px; - overflow: hidden; - background: url(static/img/bottomareagfx.gif); - top: 5px; - right: 220px; -} + #modaloverlay { z-index: 500; display: none; diff --git a/src/static/js/pad_modals.js b/src/static/js/pad_modals.js index 0dd281bb..480074c5 100644 --- a/src/static/js/pad_modals.js +++ b/src/static/js/pad_modals.js @@ -20,165 +20,13 @@ * limitations under the License. */ -var padutils = require('./pad_utils').padutils; -var paddocbar = require('./pad_docbar').paddocbar; - var padmodals = (function() { - -/*var clearFeedbackEmail = function() {}; - function clearFeedback() { - clearFeedbackEmail(); - $("#feedbackbox-message").val(''); - } - - var sendingFeedback = false; - function setSendingFeedback(v) { - v = !! v; - if (sendingFeedback != v) { - sendingFeedback = v; - if (v) { - $("#feedbackbox-send").css('opacity', 0.75); - } - else { - $("#feedbackbox-send").css('opacity', 1); - } - } - }*/ - - var sendingInvite = false; - - function setSendingInvite(v) - { - v = !! v; - if (sendingInvite != v) - { - sendingInvite = v; - if (v) - { - $(".sharebox-send").css('opacity', 0.75); - } - else - { - $("#sharebox-send").css('opacity', 1); - } - } - } - - var clearShareBoxTo = function() - {}; - - function clearShareBox() - { - clearShareBoxTo(); - } - var pad = undefined; var self = { init: function(_pad) { pad = _pad; - - self.initFeedback(); - self.initShareBox(); - }, - initFeedback: function() - { -/*var emailField = $("#feedbackbox-email"); - clearFeedbackEmail = - padutils.makeFieldLabeledWhenEmpty(emailField, '(your email address)').clear; - clearFeedback();*/ - - $("#feedbackbox-hide").click(function() - { - self.hideModal(); - }); -/*$("#feedbackbox-send").click(function() { - self.sendFeedbackEmail(); - });*/ - - $("#feedbackbutton").click(function() - { - self.showFeedback(); - }); - }, - initShareBox: function() - { - $("#sharebutton").click(function() - { - self.showShareBox(); - }); - $("#sharebox-hide").click(function() - { - self.hideModal(); - }); - $("#sharebox-send").click(function() - { - self.sendInvite(); - }); - - $("#sharebox-url").click(function() - { - $("#sharebox-url").focus().select(); - }); - - clearShareBoxTo = padutils.makeFieldLabeledWhenEmpty($("#sharebox-to"), "(email addresses)").clear; - clearShareBox(); - - $("#sharebox-subject").val(self.getDefaultShareBoxSubjectForName(pad.getUserName())); - $("#sharebox-message").val(self.getDefaultShareBoxMessageForName(pad.getUserName())); - - $("#sharebox-stripe .setsecurity").click(function() - { - self.hideModal(); - paddocbar.setShownPanel('security'); - }); - }, - getDefaultShareBoxMessageForName: function(name) - { - return (name || "Somebody") + " has shared an EtherPad document with you." + "\n\n" + "View it here:\n\n" + padutils.escapeHtml($(".sharebox-url").val() + "\n"); - }, - getDefaultShareBoxSubjectForName: function(name) - { - return (name || "Somebody") + " invited you to an EtherPad document"; - }, - relayoutWithBottom: function(px) - { - $("#modaloverlay").height(px); - $("#sharebox").css('left', Math.floor(($(window).width() - $("#sharebox").outerWidth()) / 2)); - $("#feedbackbox").css('left', Math.floor(($(window).width() - $("#feedbackbox").outerWidth()) / 2)); - }, - showFeedback: function() - { - self.showModal("#feedbackbox"); - }, - showShareBox: function() - { - // when showing the dialog, if it still says "Somebody" invited you - // then we fill in the updated username if there is one; - // otherwise, we don't touch it, perhaps the user is happy with it - var msgbox = $("#sharebox-message"); - if (msgbox.val() == self.getDefaultShareBoxMessageForName(null)) - { - msgbox.val(self.getDefaultShareBoxMessageForName(pad.getUserName())); - } - var subjBox = $("#sharebox-subject"); - if (subjBox.val() == self.getDefaultShareBoxSubjectForName(null)) - { - subjBox.val(self.getDefaultShareBoxSubjectForName(pad.getUserName())); - } - - if (pad.isPadPublic()) - { - $("#sharebox-stripe").get(0).className = 'sharebox-stripe-public'; - } - else - { - $("#sharebox-stripe").get(0).className = 'sharebox-stripe-private'; - } - - self.showModal("#sharebox", 500); - $("#sharebox-url").focus().select(); }, showModal: function(modalId, duration) { @@ -218,155 +66,6 @@ var padmodals = (function() $("#modaloverlay").hide(); }); }, - hideFeedbackLaterIfNoOtherInteraction: function() - { - return padutils.getCancellableAction('hide-feedbackbox', function() - { - self.hideModal(); - }); - }, - hideShareboxLaterIfNoOtherInteraction: function() - { - return padutils.getCancellableAction('hide-sharebox', function() - { - self.hideModal(); - }); - }, -/* sendFeedbackEmail: function() { - if (sendingFeedback) { - return; - } - var message = $("#feedbackbox-message").val(); - if (! message) { - return; - } - var email = ($("#feedbackbox-email").hasClass('editempty') ? '' : - $("#feedbackbox-email").val()); - var padId = pad.getPadId(); - var username = pad.getUserName(); - setSendingFeedback(true); - $("#feedbackbox-response").html("Sending...").get(0).className = ''; - $("#feedbackbox-response").show(); - $.ajax({ - type: 'post', - url: '/ep/pad/feedback', - data: { - feedback: message, - padId: padId, - username: username, - email: email - }, - success: success, - error: error - }); - var hideCall = self.hideFeedbackLaterIfNoOtherInteraction(); - function success(msg) { - setSendingFeedback(false); - clearFeedback(); - $("#feedbackbox-response").html("Thanks for your feedback").get(0).className = 'goodresponse'; - $("#feedbackbox-response").show(); - window.setTimeout(function() { - $("#feedbackbox-response").fadeOut('slow', function() { - hideCall(); - }); - }, 1500); - } - function error(e) { - setSendingFeedback(false); - $("#feedbackbox-response").html("Could not send feedback. Please email us at feedback"+"@"+"etherpad.com instead.").get(0).className = 'badresponse'; - $("#feedbackbox-response").show(); - } - },*/ - sendInvite: function() - { - if (sendingInvite) - { - return; - } - if (!pad.isFullyConnected()) - { - displayErrorMessage("Error: Connection to the server is down or flaky."); - return; - } - var message = $("#sharebox-message").val(); - if (!message) - { - displayErrorMessage("Please enter a message body before sending."); - return; - } - var emails = ($("#sharebox-to").hasClass('editempty') ? '' : $("#sharebox-to").val()) || ''; - // find runs of characters that aren't obviously non-email punctuation - var emailArray = emails.match(/[^\s,:;<>\"\'\/\(\)\[\]{}]+/g) || []; - if (emailArray.length == 0) - { - displayErrorMessage('Please enter at least one "To:" address.'); - $("#sharebox-to").focus().select(); - return; - } - for (var i = 0; i < emailArray.length; i++) - { - var addr = emailArray[i]; - if (!addr.match(/^[\w\.\_\+\-]+\@[\w\_\-]+\.[\w\_\-\.]+$/)) - { - displayErrorMessage('"' + padutils.escapeHtml(addr) + '" does not appear to be a valid email address.'); - return; - } - } - var subject = $("#sharebox-subject").val(); - if (!subject) - { - subject = self.getDefaultShareBoxSubjectForName(pad.getUserName()); - $("#sharebox-subject").val(subject); // force the default subject - } - - var padId = pad.getPadId(); - var username = pad.getUserName(); - setSendingInvite(true); - $("#sharebox-response").html("Sending...").get(0).className = ''; - $("#sharebox-response").show(); - $.ajax( - { - type: 'post', - url: '/ep/pad/emailinvite', - data: { - message: message, - toEmails: emailArray.join(','), - subject: subject, - username: username, - padId: padId - }, - success: success, - error: error - }); - var hideCall = self.hideShareboxLaterIfNoOtherInteraction(); - - function success(msg) - { - setSendingInvite(false); - $("#sharebox-response").html("Email invitation sent!").get(0).className = 'goodresponse'; - $("#sharebox-response").show(); - window.setTimeout(function() - { - $("#sharebox-response").fadeOut('slow', function() - { - hideCall(); - }); - }, 1500); - } - - function error(e) - { - setSendingFeedback(false); - $("#sharebox-response").html("An error occurred; no email was sent.").get(0).className = 'badresponse'; - $("#sharebox-response").show(); - } - - function displayErrorMessage(msgHtml) - { - $("#sharebox-response").html(msgHtml).get(0).className = 'badresponse'; - $("#sharebox-response").show(); - } - } }; return self; }()); From 07ee836946412ec0f49a5c87152d17e6446e3828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 12:19:09 +0200 Subject: [PATCH 06/82] set view zoom is unused --- src/static/css/pad.css | 4 +--- src/static/js/pad_editor.js | 31 ------------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 948f0245..d184214c 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -894,9 +894,7 @@ down on the page in IE. Strange but it works! */ line-height: 20px; width: auto; } -#viewzoommenu { - width: 65px -} + #bottomarea { height: 28px; overflow: hidden; diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js index b8a4ea0e..84c2e027 100644 --- a/src/static/js/pad_editor.js +++ b/src/static/js/pad_editor.js @@ -58,7 +58,6 @@ var padeditor = (function() self.setViewOptions(initialViewOptions); // view bar - self.initViewZoom(); $("#viewbarcontents").show(); }, initViewOptions: function() @@ -105,36 +104,6 @@ var padeditor = (function() self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif")); $("#viewfontmenu").val(v ? "monospace" : "normal"); }, - initViewZoom: function() - { - var viewZoom = Number(padcookie.getPref('viewZoom')); - if ((!viewZoom) || isNaN(viewZoom)) - { - viewZoom = 100; - } - self.setViewZoom(viewZoom); - $("#viewzoommenu").change(function(evt) - { - // strip initial 'z' from val - self.setViewZoom(Number($("#viewzoommenu").val().substring(1))); - }); - }, - setViewZoom: function(percent) - { - if (!(percent >= 50 && percent <= 1000)) - { - // percent is out of sane range or NaN (which fails comparisons) - return; - } - - self.viewZoom = percent; - $("#viewzoommenu").val('z' + percent); - - var baseSize = 13; - self.ace.setProperty('textsize', Math.round(baseSize * self.viewZoom / 100)); - - padcookie.setPref('viewZoom', percent); - }, dispose: function() { if (self.ace) From ab7f7506b96392cda68272549df1ce3e4eabbbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 13:32:43 +0200 Subject: [PATCH 07/82] removed unused functions in collab_client --- src/static/js/collab_client.js | 105 --------------------------------- 1 file changed, 105 deletions(-) diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 18e3616b..f7e2a07a 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -189,95 +189,15 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) function setUpSocket() { - //oldSocketId = String(Math.floor(Math.random()*1e12)); - //socketId = String(Math.floor(Math.random()*1e12)); -/*socket = new io.Socket(); - socket.connect();*/ - - //socket.on('connect', function(){ hiccupCount = 0; setChannelState("CONNECTED"); -/*var msg = { type:"CLIENT_READY", roomType:'padpage', - roomName:'padpage/'+globalPadId, - data: { - lastRev:rev, - userInfo:userSet[userId], - stats: getStats() } }; - if (oldSocketId) { - msg.data.isReconnectOf = oldSocketId; - msg.data.isCommitPending = (state == "COMMITTING"); - } - sendMessage(msg);*/ doDeferredActions(); initialStartConnectTime = +new Date(); - // }); -/*socket.on('message', function(obj){ - if(window.console) - console.log(obj); - handleMessageFromServer(obj); - });*/ - -/*var success = false; - callCatchingErrors("setUpSocket", function() { - appLevelDisconnectReason = null; - - var oldSocketId = socketId; - socketId = String(Math.floor(Math.random()*1e12)); - socket = new WebSocket(socketId); - socket.onmessage = wrapRecordingErrors("socket.onmessage", handleMessageFromServer); - socket.onclosed = wrapRecordingErrors("socket.onclosed", handleSocketClosed); - socket.onopen = wrapRecordingErrors("socket.onopen", function() { - hiccupCount = 0; - setChannelState("CONNECTED"); - var msg = { type:"CLIENT_READY", roomType:'padpage', - roomName:'padpage/'+globalPadId, - data: { - lastRev:rev, - userInfo:userSet[userId], - stats: getStats() } }; - if (oldSocketId) { - msg.data.isReconnectOf = oldSocketId; - msg.data.isCommitPending = (state == "COMMITTING"); - } - sendMessage(msg); - doDeferredActions(); - }); - socket.onhiccup = wrapRecordingErrors("socket.onhiccup", handleCometHiccup); - socket.onlogmessage = dmesg; - socket.connect(); - success = true; - }); - if (success) { - initialStartConnectTime = +new Date(); - } - else { - abandonConnection("initsocketfail"); - }*/ } var hiccupCount = 0; - function handleCometHiccup(params) - { - dmesg("HICCUP (connected:" + ( !! params.connected) + ")"); - var connectedNow = params.connected; - if (!connectedNow) - { - hiccupCount++; - // skip first "cut off from server" notification - if (hiccupCount > 1) - { - setChannelState("RECONNECTING"); - } - } - else - { - hiccupCount = 0; - setChannelState("CONNECTED"); - } - } - function sendMessage(msg) { getSocket().json.send( @@ -678,29 +598,4 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) return self; } -function selectElementContents(elem) -{ - if ($.browser.msie) - { - var range = document.body.createTextRange(); - range.moveToElementText(elem); - range.select(); - } - else - { - if (window.getSelection) - { - var browserSelection = window.getSelection(); - if (browserSelection) - { - var range = document.createRange(); - range.selectNodeContents(elem); - browserSelection.removeAllRanges(); - browserSelection.addRange(range); - } - } - } -} - exports.getCollabClient = getCollabClient; -exports.selectElementContents = selectElementContents; From 709a3b1dbec44488c381fc85ebdf270d5ad0e7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 13:34:35 +0200 Subject: [PATCH 08/82] removing debug code in collab_client.js --- src/static/js/collab_client.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index f7e2a07a..437942c8 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -302,13 +302,11 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) { userSet[id] = userInfo; callbacks.onUpdateUserInfo(userInfo); - dmesgUsers(); } else { userSet[id] = userInfo; callbacks.onUserJoin(userInfo); - dmesgUsers(); } tellAceActiveAuthorInfo(userInfo); } @@ -321,7 +319,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) delete userSet[userInfo.userId]; fadeAceAuthorInfo(userInfo); callbacks.onUserLeave(userInfo); - dmesgUsers(); } } else if (msg.type == "DISCONNECT_REASON") @@ -405,11 +402,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) } } - function dmesgUsers() - { - //pad.dmesg($.map(getConnectedUsers(), function(u) { return u.userId.slice(-2); }).join(',')); - } - function setChannelState(newChannelState, moreInfo) { if (newChannelState != channelState) From 8593b1905c51e2be8aec630ea13586301c6f0b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 14:24:44 +0200 Subject: [PATCH 09/82] getRepHTML seems to be unused. Removing --- src/static/js/ace2_inner.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 6e5f07bc..0e15195c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3749,24 +3749,6 @@ function Ace2Inner(){ setSelection(selection); } - function getRepHTML() - { - return _.map(rep.lines.slice(), function(entry) - { - var text = entry.text; - var content; - if (text.length === 0) - { - content = '--'; - } - else - { - content = htmlPrettyEscape(text); - } - return '
' + content + '
'; - }).join(''); - } - function nodeMaxIndex(nd) { if (isNodeText(nd)) return nd.nodeValue.length; From 89ab73c8683f4473671162bda5f1774d9645ca6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 14:25:07 +0200 Subject: [PATCH 10/82] removing commented out functions from cssmanager.js --- src/static/js/cssmanager.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/static/js/cssmanager.js b/src/static/js/cssmanager.js index 46075e57..952388b7 100644 --- a/src/static/js/cssmanager.js +++ b/src/static/js/cssmanager.js @@ -40,21 +40,8 @@ function makeCSSManager(emptyStylesheetTitle, top) } return null; } - -/*function getSheetTagByTitle(title) { - var allStyleTags = document.getElementsByTagName("style"); - for(var i=0;i Date: Fri, 20 Apr 2012 15:12:20 +0200 Subject: [PATCH 11/82] removing Minify.js.rej --- src/node/utils/Minify.js.rej | 513 ----------------------------------- 1 file changed, 513 deletions(-) delete mode 100644 src/node/utils/Minify.js.rej diff --git a/src/node/utils/Minify.js.rej b/src/node/utils/Minify.js.rej deleted file mode 100644 index f09f49dc..00000000 --- a/src/node/utils/Minify.js.rej +++ /dev/null @@ -1,513 +0,0 @@ -/** - * This Module manages all /minified/* requests. It controls the - * minification && compression of Javascript and CSS. - */ - -/* - * 2011 Peter 'Pita' Martischka (Primary Technology Ltd) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS-IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var ERR = require("async-stacktrace"); -var settings = require('./Settings'); -var async = require('async'); -var fs = require('fs'); -var cleanCSS = require('clean-css'); -var jsp = require("uglify-js").parser; -var pro = require("uglify-js").uglify; -var path = require('path'); -var RequireKernel = require('require-kernel'); -var server = require('../server'); - -<<<<<<< HEAD -var ROOT_DIR = path.normalize(__dirname + "/../" ); -var JS_DIR = ROOT_DIR + '../static/js/'; -var CSS_DIR = ROOT_DIR + '../static/css/'; -var CACHE_DIR = path.join(settings.root, 'var'); -======= -var ROOT_DIR = path.normalize(__dirname + "/../../static/"); ->>>>>>> pita -var TAR_PATH = path.join(__dirname, 'tar.json'); -var tar = JSON.parse(fs.readFileSync(TAR_PATH, 'utf8')); - -// Rewrite tar to include modules with no extensions and proper rooted paths. -exports.tar = {}; -for (var key in tar) { - exports.tar['/' + key] = - tar[key].map(function (p) {return '/' + p}).concat( - tar[key].map(function (p) {return '/' + p.replace(/\.js$/, '')}) - ); -} - -/** - * creates the minifed javascript for the given minified name - * @param req the Express request - * @param res the Express response - */ -exports.minify = function(req, res, next) -{ -<<<<<<< HEAD - var jsFilename = req.params[0]; - - //choose the js files we need - var jsFiles = undefined; - if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) { - jsFiles = tar[jsFilename]; - } else { - /* Not in tar list, but try anyways, if it fails, pass to `next`. - Actually try, not check in filesystem here because - we don't want to duplicate the require.resolve() handling - */ - jsFiles = [jsFilename]; - } - _handle(req, res, jsFilename, jsFiles, function (err) { - console.log("Unable to load minified file " + jsFilename + ": " + err.toString()); - /* Throw away error and generate a 404, not 500 */ - next(); - }); -} - -function _handle(req, res, jsFilename, jsFiles, next) { - res.header("Content-Type","text/javascript"); - - var cacheName = CACHE_DIR + "/minified_" + jsFilename.replace(/\//g, "_"); - - //minifying is enabled - if(settings.minify) - { - var result = undefined; - var latestModification = 0; - - async.series([ - //find out the highest modification date - function(callback) - { - var folders2check = [CSS_DIR, JS_DIR]; - - //go trough this two folders - async.forEach(folders2check, function(path, callback) - { - //read the files in the folder - fs.readdir(path, function(err, files) - { - if(ERR(err, callback)) return; - - //we wanna check the directory itself for changes too - files.push("."); - - //go trough all files in this folder - async.forEach(files, function(filename, callback) - { - //get the stat data of this file - fs.stat(path + "/" + filename, function(err, stats) - { - if(ERR(err, callback)) return; - - //get the modification time - var modificationTime = stats.mtime.getTime(); - - //compare the modification time to the highest found - if(modificationTime > latestModification) - { - latestModification = modificationTime; - } - - callback(); - }); - }, callback); - }); - }, callback); - }, - function(callback) - { - //check the modification time of the minified js - fs.stat(cacheName, function(err, stats) - { - if(err && err.code != "ENOENT") - { - ERR(err, callback); - return; - } - - //there is no minfied file or there new changes since this file was generated, so continue generating this file - if((err && err.code == "ENOENT") || stats.mtime.getTime() < latestModification) - { - callback(); - } - //the minified file is still up to date, stop minifying - else - { - callback("stop"); - } - }); - }, - //load all js files - function (callback) - { - var values = []; - tarCode( - jsFiles - , function (content) {values.push(content)} - , function (err) { - if(ERR(err, next)) return; - - result = values.join(''); - callback(); - }); - }, - //put all together and write it into a file - function(callback) - { - async.parallel([ - //write the results plain in a file - function(callback) - { - fs.writeFile(cacheName, result, "utf8", callback); - }, - //write the results compressed in a file - function(callback) - { - 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; - - fs.writeFile(cacheName + ".gz", compressedResult, callback); - }); - } - ],callback); - } - ], function(err) - { - if(err && err != "stop") - { - if(ERR(err)) return; - } - - //check if gzip is supported by this browser - var gzipSupport = req.header('Accept-Encoding', '').indexOf('gzip') != -1; - - var pathStr; - if(gzipSupport && os.type().indexOf("Windows") == -1) - { - pathStr = path.normalize(cacheName + ".gz"); - res.header('Content-Encoding', 'gzip'); - } - else - { - pathStr = path.normalize(cacheName); - } - - res.sendfile(pathStr, { maxAge: server.maxAge }); - }) - } - //minifying is disabled, so put the files together in one file - else - { - tarCode( - jsFiles - , function (content) {res.write(content)} - , function (err) { - if(ERR(err, next)) return; -======= - var filename = req.params['filename']; - - // No relative paths, especially if they may go up the file hierarchy. - filename = path.normalize(path.join(ROOT_DIR, filename)); - if (filename.indexOf(ROOT_DIR) == 0) { - filename = filename.slice(ROOT_DIR.length); - filename = filename.replace(/\\/g, '/'); // Windows (safe generally?) - } else { - res.writeHead(404, {}); - res.end(); - return; - } - - // What content type should this be? - // TODO: This should use a MIME module. - var contentType; - if (filename.match(/\.js$/)) { - contentType = "text/javascript"; - } else if (filename.match(/\.css$/)) { - contentType = "text/css"; - } else if (filename.match(/\.html$/)) { - contentType = "text/html"; - } else if (filename.match(/\.txt$/)) { - contentType = "text/plain"; - } else if (filename.match(/\.png$/)) { - contentType = "image/png"; - } else if (filename.match(/\.gif$/)) { - contentType = "image/gif"; - } else if (filename.match(/\.ico$/)) { - contentType = "image/x-icon"; - } else { - contentType = "application/octet-stream"; - } - - statFile(filename, function (error, date, exists) { - if (date) { - date = new Date(date); - res.setHeader('last-modified', date.toUTCString()); - res.setHeader('date', (new Date()).toUTCString()); - if (server.maxAge) { - var expiresDate = new Date((new Date()).getTime()+server.maxAge*1000); - res.setHeader('expires', expiresDate.toUTCString()); - res.setHeader('cache-control', 'max-age=' + server.maxAge); - } - } - - if (error) { - res.writeHead(500, {}); ->>>>>>> pita - res.end(); - } else if (!exists) { - res.writeHead(404, {}); - res.end(); - } else if (new Date(req.headers['if-modified-since']) >= date) { - res.writeHead(304, {}); - res.end(); - } else { - if (req.method == 'HEAD') { - res.header("Content-Type", contentType); - res.writeHead(200, {}); - res.end(); - } else if (req.method == 'GET') { - getFileCompressed(filename, contentType, function (error, content) { - if(ERR(error)) return; - res.header("Content-Type", contentType); - res.writeHead(200, {}); - res.write(content); - res.end(); - }); - } else { - res.writeHead(405, {'allow': 'HEAD, GET'}); - res.end(); - } - } - }); -} - -// find all includes in ace.js and embed them. -function getAceFile(callback) { - fs.readFile(ROOT_DIR + 'js/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_]+\("[^"]*"\)/gi); - if (!settings.minify) { - founds = []; - } - // Always include the require kernel. - founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")'); - - data += ';\n'; - data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n'; - - // Request the contents of the included file on the server-side and write - // them into the file. - async.forEach(founds, function (item, callback) { - var filename = item.match(/"([^"]*)"/)[1]; - var request = require('request'); - - var baseURI = 'http://localhost:' + settings.port - - request(baseURI + path.normalize(path.join('/static/', filename)), function (error, response, body) { - if (!error && response.statusCode == 200) { - data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = ' - + JSON.stringify(body || '') + ';\n'; - } else { - // Silence? - } - callback(); - }); - }, function(error) { - callback(error, data); - }); - }); -} - -// Check for the existance of the file and get the last modification date. -function statFile(filename, callback) { - if (filename == 'js/ace.js') { - // Sometimes static assets are inlined into this file, so we have to stat - // everything. - lastModifiedDateOfEverything(function (error, date) { - callback(error, date, !error); - }); - } else if (filename == 'js/require-kernel.js') { - callback(null, requireLastModified(), true); - } else { - fs.stat(ROOT_DIR + filename, function (error, stats) { - if (error) { - if (error.code == "ENOENT") { - // Stat the directory instead. - fs.stat(path.dirname(ROOT_DIR + filename), function (error, stats) { - if (error) { - if (error.code == "ENOENT") { - callback(null, null, false); - } else { - callback(error); - } - } else { - callback(null, stats.mtime.getTime(), false); - } - }); - } else { - callback(error); - } - } else { - callback(null, stats.mtime.getTime(), true); - } - }); - } -} -function lastModifiedDateOfEverything(callback) { - var folders2check = [ROOT_DIR + 'js/', ROOT_DIR + 'css/']; - var latestModification = 0; - //go trough this two folders - async.forEach(folders2check, function(path, callback) - { - //read the files in the folder - fs.readdir(path, function(err, files) - { - if(ERR(err, callback)) return; - - //we wanna check the directory itself for changes too - files.push("."); - - //go trough all files in this folder - async.forEach(files, function(filename, callback) - { - //get the stat data of this file - fs.stat(path + "/" + filename, function(err, stats) - { - if(ERR(err, callback)) return; - - //get the modification time - var modificationTime = stats.mtime.getTime(); - - //compare the modification time to the highest found - if(modificationTime > latestModification) - { - latestModification = modificationTime; - } - - callback(); - }); - }, callback); - }); - }, function () { - callback(null, latestModification); - }); -} - -// This should be provided by the module, but until then, just use startup -// time. -var _requireLastModified = new Date(); -function requireLastModified() { - return _requireLastModified.toUTCString(); -} -function requireDefinition() { - return 'var require = ' + RequireKernel.kernelSource + ';\n'; -} - -<<<<<<< HEAD -function tarCode(jsFiles, write, callback) { - write('require.define({'); - var initialEntry = true; - async.forEach(jsFiles, function (filename, callback){ - var path; - var srcPath; - if (filename.indexOf('plugins/') == 0) { - srcPath = filename.substring('plugins/'.length); - path = require.resolve(srcPath); - } else { - srcPath = '/' + filename; - path = JS_DIR + filename; - } - - srcPath = JSON.stringify(srcPath); - var srcPathAbbv = JSON.stringify(srcPath.replace(/\.js$/, '')); - - if (filename == 'ace.js') { - getAceFile(handleFile); - } else { - fs.readFile(path, "utf8", handleFile); - } - - function handleFile(err, data) { - if(ERR(err, callback)) return; - - if (!initialEntry) { - write('\n,'); - } else { - initialEntry = false; - } - write(srcPath + ': ') - data = '(function (require, exports, module) {' + data + '})'; -======= -function getFileCompressed(filename, contentType, callback) { - getFile(filename, function (error, content) { - if (error || !content) { - callback(error, content); - } else { ->>>>>>> pita - if (settings.minify) { - if (contentType == 'text/javascript') { - try { - content = compressJS([content]); - } catch (error) { - // silence - } - } else if (contentType == 'text/css') { - content = compressCSS([content]); - } - } - callback(null, content); - } -<<<<<<< HEAD - }, function (err) { - if(ERR(err, callback)) return; - write('});\n'); - callback(); -======= ->>>>>>> pita - }); -} - -function getFile(filename, callback) { - if (filename == 'js/ace.js') { - getAceFile(callback); - } else if (filename == 'js/require-kernel.js') { - callback(undefined, requireDefinition()); - } else { - fs.readFile(ROOT_DIR + filename, callback); - } -} - -function compressJS(values) -{ - var complete = values.join("\n"); - var ast = jsp.parse(complete); // parse code and get the initial AST - ast = pro.ast_mangle(ast); // get a new AST with mangled names - ast = pro.ast_squeeze(ast); // get an AST with compression optimizations - return pro.gen_code(ast); // compressed code here -} - -function compressCSS(values) -{ - var complete = values.join("\n"); - return cleanCSS.process(complete); -} From 6fc45d6252928f1b95171dba716d1c39e5397b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 17:00:32 +0200 Subject: [PATCH 12/82] added etherpad-lite to "bin" in package.json --- src/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/package.json b/src/package.json index eda385b2..cd9342be 100644 --- a/src/package.json +++ b/src/package.json @@ -31,6 +31,7 @@ "semver" : "1.0.13", "underscore" : "1.3.1" }, + "bin": { "etherpad-lite": "./node/server.js" }, "devDependencies": { "jshint" : "*" }, From 90bbf169b247194946fdbc13c1de700c495372cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 17:03:26 +0200 Subject: [PATCH 13/82] allow startup without settings file --- src/node/utils/Settings.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index cb6a6403..8f13b0c6 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -106,9 +106,15 @@ if (settingsFilename.charAt(0) != '/') { settingsFilename = path.normalize(path.join(root, settingsFilename)); } -//read the settings sync -var settingsStr = fs.readFileSync(settingsFilename).toString(); - +var settingsStr +try{ + //read the settings sync + settingsStr = fs.readFileSync(settingsFilename).toString(); +} catch(e){ + console.warn('No settings file found. Using defaults.'); + settingsStr = '{}'; +} + //remove all comments settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,""); From e9fc16a9745c83e084a01bcdf8a3c0025154559f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 17:03:37 +0200 Subject: [PATCH 14/82] warn if dirty db is used --- src/node/utils/Settings.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 8f13b0c6..7c64140b 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -152,3 +152,7 @@ for(var i in settings) console.warn("This setting doesn't exist or it was removed"); } } + +if(exports.dbType === "dirty"){ + console.warn("DirtyDB is used. This is fine for testing but not recommended for production.") +} From c90ef5aeb8a83d58daff38d79de92919fde96b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 22:39:16 +0200 Subject: [PATCH 15/82] default dirty.db to current pwd, so no new directory has to be created --- src/node/utils/Settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 7c64140b..e60446df 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -44,7 +44,7 @@ exports.dbType = "dirty"; /** * This setting is passed with dbType to ueberDB to set up the database */ -exports.dbSettings = { "filename" : path.join(exports.root, "var/dirty.db") }; +exports.dbSettings = { "filename" : path.join(exports.root, "dirty.db") }; /** * The default Text of a new pad */ From 7f50e8f55106ca455e2897639454c31578bdb164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 22:40:33 +0200 Subject: [PATCH 16/82] server.js can be called from console. --- src/node/server.js | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 src/node/server.js diff --git a/src/node/server.js b/src/node/server.js old mode 100644 new mode 100755 index 9d2c52e4..978c83fb --- a/src/node/server.js +++ b/src/node/server.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node /** * This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server. * Static file Requests are answered directly from this module, Socket.IO messages are passed From 8fefb551fca91212b2419ab0cd593b460f8f7397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Fri, 20 Apr 2012 22:44:10 +0200 Subject: [PATCH 17/82] less verbose startup, better log messages at startup --- src/node/server.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node/server.js b/src/node/server.js index 978c83fb..4eb38ea7 100755 --- a/src/node/server.js +++ b/src/node/server.js @@ -66,9 +66,9 @@ async.waterfall([ plugins.update, function (callback) { - console.log("Installed plugins: " + plugins.formatPlugins()); - console.log("Installed parts:\n" + plugins.formatParts()); - console.log("Installed hooks:\n" + plugins.formatHooks()); + console.info("Installed plugins: " + plugins.formatPlugins()); + console.debug("Installed parts:\n" + plugins.formatParts()); + console.debug("Installed hooks:\n" + plugins.formatHooks()); callback(); }, @@ -89,12 +89,12 @@ async.waterfall([ //let the server listen app.listen(settings.port, settings.ip); - console.log("Server is listening at " + settings.ip + ":" + settings.port); + console.log("You can access your Etherpad-Lite instance at http://" + settings.ip + ":" + settings.port + "/"); if(!_.isEmpty(settings.users)){ - console.log("Plugin admin page listening at " + settings.ip + ":" + settings.port + "/admin/plugins"); + console.log("The plugin admin page is at http://" + settings.ip + ":" + settings.port + "/admin/plugins"); } else{ - console.log("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json"); + console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json"); } callback(null); } From a557f2414e4abf606dcbeba12cf3187f9e625646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Sat, 21 Apr 2012 13:47:11 +0200 Subject: [PATCH 18/82] cssManager top is not used, so drop it --- src/static/js/ace2_inner.js | 8 -------- src/static/js/cssmanager.js | 11 ++++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 0e15195c..723d410f 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -166,12 +166,10 @@ function Ace2Inner(){ } var dynamicCSS = null; - var dynamicCSSTop = null; function initDynamicCSS() { dynamicCSS = makeCSSManager("dynamicsyntax"); - dynamicCSSTop = makeCSSManager("dynamicsyntax", true); } var changesetTracker = makeChangesetTracker(scheduler, rep.apool, { @@ -214,7 +212,6 @@ function Ace2Inner(){ if (dynamicCSS) { dynamicCSS.removeSelectorStyle(getAuthorColorClassSelector(getAuthorClassName(author))); - dynamicCSSTop.removeSelectorStyle(getAuthorColorClassSelector(getAuthorClassName(author))); } } else @@ -232,23 +229,18 @@ function Ace2Inner(){ var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))); - var authorStyleTop = dynamicCSSTop.selectorStyle(getAuthorColorClassSelector( - getAuthorClassName(author))); var anchorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector( getAuthorClassName(author))+' > a') // author color authorStyle.backgroundColor = bgcolor; - authorStyleTop.backgroundColor = bgcolor; // text contrast if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) { authorStyle.color = '#ffffff'; - authorStyleTop.color = '#ffffff'; }else{ authorStyle.color = null; - authorStyleTop.color = null; } // anchor text contrast diff --git a/src/static/js/cssmanager.js b/src/static/js/cssmanager.js index 952388b7..e2007449 100644 --- a/src/static/js/cssmanager.js +++ b/src/static/js/cssmanager.js @@ -20,15 +20,12 @@ * limitations under the License. */ -function makeCSSManager(emptyStylesheetTitle, top) +function makeCSSManager(emptyStylesheetTitle) { - function getSheetByTitle(title, top) + function getSheetByTitle(title) { - if(top) - var allSheets = window.parent.parent.document.styleSheets; - else - var allSheets = document.styleSheets; + var allSheets = document.styleSheets; for (var i = 0; i < allSheets.length; i++) { @@ -41,7 +38,7 @@ function makeCSSManager(emptyStylesheetTitle, top) return null; } - var browserSheet = getSheetByTitle(emptyStylesheetTitle, top); + var browserSheet = getSheetByTitle(emptyStylesheetTitle); function browserRules() { From 18d0c8118103b8fb50203c5f40d7aa97e249d9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Sat, 21 Apr 2012 14:57:22 +0200 Subject: [PATCH 19/82] adding padutils to padmodals --- src/static/js/pad_modals.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/static/js/pad_modals.js b/src/static/js/pad_modals.js index 480074c5..2e1939fc 100644 --- a/src/static/js/pad_modals.js +++ b/src/static/js/pad_modals.js @@ -19,6 +19,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +var padutils = require('./pad_utils').padutils; var padmodals = (function() { From c11df112e813a28387f6021aaf453fefda05d994 Mon Sep 17 00:00:00 2001 From: 0ip Date: Sat, 28 Apr 2012 22:00:15 +0200 Subject: [PATCH 20/82] templates/plugins.html Fixed relative paths --- src/templates/admin/plugins.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/templates/admin/plugins.html b/src/templates/admin/plugins.html index 6e9b4d2e..0f3a5feb 100644 --- a/src/templates/admin/plugins.html +++ b/src/templates/admin/plugins.html @@ -2,10 +2,10 @@ Plugin manager - - - - + + + +
@@ -20,7 +20,7 @@

Etherpad Lite

-
+

Installed plugins

@@ -44,7 +44,7 @@
-
+

Search for plugins to install

From 4b272fe2e1824665d4772db2b28e75995c3bb0ec Mon Sep 17 00:00:00 2001 From: 0ip Date: Sun, 29 Apr 2012 01:00:31 +0200 Subject: [PATCH 21/82] Tidied up highlighting for currently opened module --- src/static/css/pad.css | 2 +- src/static/js/pad_editbar.js | 19 ++++++++----------- src/templates/pad.html | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 2ce8dbb6..31d74c87 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -1402,7 +1402,7 @@ input[type=checkbox] { float: left; width: 50%; } -#settingsmenu, +#settings, #importexport, #embed { position: absolute; diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index dec32b46..cede9f37 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -119,7 +119,7 @@ var padeditbar = (function() } else if (cmd == 'settings') { - self.toogleDropDown("settingsmenu"); + self.toogleDropDown("settings"); } else if (cmd == 'embed') { @@ -177,12 +177,11 @@ var padeditbar = (function() }, toogleDropDown: function(moduleName) { - var modules = ["settingsmenu", "importexport", "embed", "users"]; + var modules = ["settings", "importexport", "embed", "users"]; - //hide all modules + // hide all modules and remove highlighting of all buttons if(moduleName == "none") { - $(".toolbar ul.menu_right li").removeClass("selected"); for(var i=0;i 0 && nth_child <= (modules.length-1)) { - $(".toolbar ul.menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected"); - $(".toolbar ul.menu_right li:nth-child(" + nth_child + ")").toggleClass("selected"); - } - if(modules[modules.length-1] === moduleName) $(".toolbar ul.menu_right li").removeClass("selected"); - //hide all modules that are not selected and show the selected one + // hide all modules that are not selected and remove highlighting + // respectively add highlighting to the corresponding button for(var i=0;iLoading...
-