diff --git a/lgtm.yml b/lgtm.yml new file mode 100644 index 00000000..9dd0f16b --- /dev/null +++ b/lgtm.yml @@ -0,0 +1,9 @@ +extraction: + javascript: + index: + exclude: + - src/static/js/vendors + python: + index: + exclude: + - / diff --git a/src/node/utils/tar.json b/src/node/utils/tar.json index c3081072..63944f85 100644 --- a/src/node/utils/tar.json +++ b/src/node/utils/tar.json @@ -2,7 +2,7 @@ "pad.js": [ "pad.js" , "pad_utils.js" - , "browser.js" + , "vendors/browser.js" , "pad_cookie.js" , "pad_editor.js" , "pad_editbar.js" @@ -16,10 +16,10 @@ , "pad_savedrevs.js" , "pad_connectionstatus.js" , "chat.js" - , "gritter.js" + , "vendors/gritter.js" , "$js-cookie/src/js.cookie.js" , "$tinycon/tinycon.js" - , "farbtastic.js" + , "vendors/farbtastic.js" , "skin_variants.js" , "socketio.js" ] @@ -28,7 +28,7 @@ , "colorutils.js" , "draggable.js" , "pad_utils.js" - , "browser.js" + , "vendors/browser.js" , "pad_cookie.js" , "pad_editor.js" , "pad_editbar.js" @@ -49,7 +49,7 @@ ] , "ace2_inner.js": [ "ace2_inner.js" - , "browser.js" + , "vendors/browser.js" , "AttributePool.js" , "Changeset.js" , "ChangesetUtils.js" @@ -68,11 +68,11 @@ ] , "ace2_common.js": [ "ace2_common.js" - , "browser.js" - , "jquery.js" + , "vendors/browser.js" + , "vendors/jquery.js" , "rjquery.js" , "$async.js" - , "underscore.js" + , "vendors/underscore.js" , "$underscore.js" , "$underscore/underscore.js" , "security.js" diff --git a/src/package.json b/src/package.json index 3c847b74..5580380d 100644 --- a/src/package.json +++ b/src/package.json @@ -100,11 +100,11 @@ "ignorePatterns": [ "/static/js/admin/jquery.autosize.js", "/static/js/admin/minify.json.js", - "/static/js/browser.js", - "/static/js/farbtastic.js", - "/static/js/gritter.js", - "/static/js/html10n.js", - "/static/js/jquery.js", + "/static/js/vendors/browser.js", + "/static/js/vendors/farbtastic.js", + "/static/js/vendors/gritter.js", + "/static/js/vendors/html10n.js", + "/static/js/vendors/jquery.js", "/static/js/vendors/nice-select.js", "/tests/frontend/lib/" ], diff --git a/src/static/js/AttributeManager.js b/src/static/js/AttributeManager.js index 7a37c8ff..1d8bd937 100644 --- a/src/static/js/AttributeManager.js +++ b/src/static/js/AttributeManager.js @@ -2,7 +2,7 @@ const Changeset = require('./Changeset'); const ChangesetUtils = require('./ChangesetUtils'); -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const lineMarkerAttribute = 'lmkr'; diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 8e41ae13..429fef7c 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -18,7 +18,7 @@ */ let documentAttributeManager; -const browser = require('./browser'); +const browser = require('./vendors/browser'); const padutils = require('./pad_utils').padutils; const Ace2Common = require('./ace2_common'); const $ = require('./rjquery').$; diff --git a/src/static/js/broadcast.js b/src/static/js/broadcast.js index 26370f6b..871e8c9b 100644 --- a/src/static/js/broadcast.js +++ b/src/static/js/broadcast.js @@ -28,7 +28,7 @@ const AttribPool = require('./AttributePool'); const Changeset = require('./Changeset'); const linestylefilter = require('./linestylefilter').linestylefilter; const colorutils = require('./colorutils').colorutils; -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const hooks = require('./pluginfw/hooks'); // These parameters were global, now they are injected. A reference to the diff --git a/src/static/js/broadcast_slider.js b/src/static/js/broadcast_slider.js index f03a2283..816a67a2 100644 --- a/src/static/js/broadcast_slider.js +++ b/src/static/js/broadcast_slider.js @@ -23,7 +23,7 @@ // These parameters were global, now they are injected. A reference to the // Timeslider controller would probably be more appropriate. -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const padmodals = require('./pad_modals').padmodals; const colorutils = require('./colorutils').colorutils; diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index d2b9c402..a4cbafd9 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -24,7 +24,7 @@ const chat = require('./chat').chat; const hooks = require('./pluginfw/hooks'); -const browser = require('./browser'); +const browser = require('./vendors/browser'); // Dependency fill on init. This exists for `pad.socket` only. // TODO: bind directly to the socket. diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 324e1353..727d81ed 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -24,7 +24,7 @@ const Security = require('./security'); const hooks = require('./pluginfw/hooks'); -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const lineAttributeMarker = require('./linestylefilter').lineAttributeMarker; const noop = () => {}; diff --git a/src/static/js/pad.js b/src/static/js/pad.js index d8aaa4fe..77a37cd1 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -26,9 +26,9 @@ let socket; // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. -require('./jquery'); -require('./farbtastic'); -require('./gritter'); +require('./vendors/jquery'); +require('./vendors/farbtastic'); +require('./vendors/gritter'); const Cookies = require('./pad_utils').Cookies; const chat = require('./chat').chat; diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 788d5ecd..7305608f 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -22,7 +22,7 @@ * limitations under the License. */ -const browser = require('./browser'); +const browser = require('./vendors/browser'); const hooks = require('./pluginfw/hooks'); const padutils = require('./pad_utils').padutils; const padeditor = require('./pad_editor').padeditor; diff --git a/src/static/js/rjquery.js b/src/static/js/rjquery.js index d729a25b..a80e1f8d 100644 --- a/src/static/js/rjquery.js +++ b/src/static/js/rjquery.js @@ -1,5 +1,5 @@ 'use strict'; // Provides a require'able version of jQuery without leaking $ and jQuery; -window.$ = require('./jquery'); +window.$ = require('./vendors/jquery'); const jq = window.$.noConflict(true); exports.jQuery = exports.$ = jq; diff --git a/src/static/js/skiplist.js b/src/static/js/skiplist.js index 4ea74010..006cf008 100644 --- a/src/static/js/skiplist.js +++ b/src/static/js/skiplist.js @@ -23,7 +23,7 @@ */ const Ace2Common = require('./ace2_common'); -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const noop = Ace2Common.noop; diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 23d7c79c..74aaf4f5 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -24,7 +24,7 @@ // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. -require('./jquery'); +require('./vendors/jquery'); const Cookies = require('./pad_utils').Cookies; const randomString = require('./pad_utils').randomString; diff --git a/src/static/js/undomodule.js b/src/static/js/undomodule.js index b8270b80..294b23bb 100644 --- a/src/static/js/undomodule.js +++ b/src/static/js/undomodule.js @@ -23,7 +23,7 @@ */ const Changeset = require('./Changeset'); -const _ = require('./underscore'); +const _ = require('./vendors/underscore'); const undoModule = (() => { const stack = (() => { diff --git a/src/static/js/browser.js b/src/static/js/vendors/browser.js similarity index 97% rename from src/static/js/browser.js rename to src/static/js/vendors/browser.js index 5d5f741a..2516a325 100644 --- a/src/static/js/browser.js +++ b/src/static/js/vendors/browser.js @@ -1,3 +1,7 @@ +// WARNING: This file may have been modified from original. +// TODO: Check requirement of this file, this afaik was to cover weird edge cases +// that have probably been fixed in browsers. + /*! * Bowser - a browser detector * https://github.com/ded/bowser @@ -303,4 +307,4 @@ bowser._detect = detect; return bowser -}); \ No newline at end of file +}); diff --git a/src/static/js/farbtastic.js b/src/static/js/vendors/farbtastic.js similarity index 99% rename from src/static/js/farbtastic.js rename to src/static/js/vendors/farbtastic.js index c6e12da4..cc0c2c1b 100644 --- a/src/static/js/farbtastic.js +++ b/src/static/js/vendors/farbtastic.js @@ -1,3 +1,6 @@ +// WARNING: This file has been modified from original. +// TODO: Replace with https://github.com/Simonwep/pickr + // Farbtastic 2.0 alpha // Original can be found at: // https://github.com/mattfarina/farbtastic/blob/71ca15f4a09c8e5a08a1b0d1cf37ef028adf22f0/src/farbtastic.js diff --git a/src/static/js/gritter.js b/src/static/js/vendors/gritter.js similarity index 99% rename from src/static/js/gritter.js rename to src/static/js/vendors/gritter.js index 64295ef7..a20cb4de 100644 --- a/src/static/js/gritter.js +++ b/src/static/js/vendors/gritter.js @@ -1,3 +1,5 @@ +// WARNING: This file has been modified from the Original + /* * Gritter for jQuery * http://www.boedesign.com/ diff --git a/src/static/js/html10n.js b/src/static/js/vendors/html10n.js similarity index 99% rename from src/static/js/html10n.js rename to src/static/js/vendors/html10n.js index 969a6a1a..43ac67f3 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/vendors/html10n.js @@ -1,3 +1,5 @@ +// WARNING: This file has been modified from the Original + /** * Copyright (c) 2012 Marcel Klehr * Copyright (c) 2011-2012 Fabien Cazenave, Mozilla diff --git a/src/static/js/jquery.js b/src/static/js/vendors/jquery.js similarity index 100% rename from src/static/js/jquery.js rename to src/static/js/vendors/jquery.js diff --git a/src/static/js/vendors/nice-select.js b/src/static/js/vendors/nice-select.js index cbd978ac..8975f03e 100644 --- a/src/static/js/vendors/nice-select.js +++ b/src/static/js/vendors/nice-select.js @@ -1,3 +1,6 @@ +// WARNING: This file has been modified from the Original +// TODO: Nice Select seems relatively abandoned, we should consider other options. + /* jQuery Nice Select - v1.1.0 https://github.com/hernansartorio/jquery-nice-select Made by Hernán Sartorio */ @@ -60,14 +63,14 @@ .addClass($select.attr('class') || '') .addClass($select.attr('disabled') ? 'disabled' : '') .attr('tabindex', $select.attr('disabled') ? null : '0') - .html('') + .html('') ); var $dropdown = $select.next(); var $options = $select.find('option'); var $selected = $select.find('option:selected'); - $dropdown.find('.current').html($selected.data('display') || $selected.text()); + $dropdown.find('.current').html($selected.data('display') || $selected.text()); $options.each(function(i) { var $option = $(this); @@ -94,31 +97,12 @@ var $dropdown = $(this); $('.nice-select').not($dropdown).removeClass('open'); - $dropdown.toggleClass('open'); if ($dropdown.hasClass('open')) { $dropdown.find('.option'); $dropdown.find('.focus').removeClass('focus'); $dropdown.find('.selected').addClass('focus'); - if ($dropdown.closest('.toolbar').length > 0) { - $dropdown.find('.list').css('left', $dropdown.offset().left); - $dropdown.find('.list').css('top', $dropdown.offset().top + $dropdown.outerHeight()); - $dropdown.find('.list').css('min-width', $dropdown.outerWidth() + 'px'); - } - - $listHeight = $dropdown.find('.list').outerHeight(); - $top = $dropdown.parent().offset().top; - $bottom = $('body').height() - $top; - $maxListHeight = $bottom - $dropdown.outerHeight() - 20; - if ($maxListHeight < 200) { - $dropdown.addClass('reverse'); - $maxListHeight = 250; - } else { - $dropdown.removeClass('reverse') - } - $dropdown.find('.list').css('max-height', $maxListHeight + 'px'); - } else { $dropdown.focus(); } @@ -206,4 +190,4 @@ }; -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/src/static/js/underscore.js b/src/static/js/vendors/underscore.js similarity index 100% rename from src/static/js/underscore.js rename to src/static/js/vendors/underscore.js diff --git a/src/templates/admin/index.html b/src/templates/admin/index.html index efed7f80..d4478153 100644 --- a/src/templates/admin/index.html +++ b/src/templates/admin/index.html @@ -4,10 +4,10 @@ Admin Dashboard - Etherpad - + - + diff --git a/src/templates/admin/plugins-info.html b/src/templates/admin/plugins-info.html index a737ea05..57e41f85 100644 --- a/src/templates/admin/plugins-info.html +++ b/src/templates/admin/plugins-info.html @@ -5,7 +5,7 @@ - + diff --git a/src/templates/admin/plugins.html b/src/templates/admin/plugins.html index 76b01acb..278304fa 100644 --- a/src/templates/admin/plugins.html +++ b/src/templates/admin/plugins.html @@ -4,12 +4,12 @@ Plugin manager - Etherpad - + - + diff --git a/src/templates/admin/settings.html b/src/templates/admin/settings.html index a75a9168..ffa4172f 100644 --- a/src/templates/admin/settings.html +++ b/src/templates/admin/settings.html @@ -4,14 +4,14 @@ Settings - Etherpad - + - + diff --git a/src/templates/index.html b/src/templates/index.html index 213071fe..8f20c08d 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -11,9 +11,9 @@ - + - +