From 7f98116a435d0204f91100cb24bfb4f1f49f41d3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 20:16:11 -0800 Subject: [PATCH] Implement `require` for most modules. --- static/js/ace2_inner.js | 29 +++++++++++++++++++++++++++++ static/js/broadcast.js | 6 ++++++ static/js/changesettracker.js | 2 ++ static/js/chat.js | 2 ++ static/js/collab_client.js | 2 ++ static/js/contentcollector.js | 2 ++ static/js/linestylefilter.js | 3 +++ static/js/linestylefilter_client.js | 3 +++ static/js/pad2.js | 3 +++ static/js/pad_editor.js | 1 + static/js/undomodule.js | 2 ++ 11 files changed, 55 insertions(+) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index ea6d7cbe2..455958cd2 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -20,6 +20,35 @@ * limitations under the License. */ +var Ace2Common = require('/ace2_common'); +// Extract useful method defined in the other module. +var isNodeText = Ace2Common.isNodeText; +var object = Ace2Common.object; +var extend = Ace2Common.extend; +var forEach = Ace2Common.forEach; +var map = Ace2Common.map; +var filter = Ace2Common.filter; +var isArray = Ace2Common.isArray; +var browser = Ace2Common.browser; +var getAssoc = Ace2Common.getAssoc; +var setAssoc = Ace2Common.setAssoc; +var binarySearch = Ace2Common.binarySearch; +var binarySearchInfinite = Ace2Common.binarySearchInfinite; +var htmlPrettyEscape = Ace2Common.htmlPrettyEscape; +var map = Ace2Common.map; + +var makeChangesetTracker = require('/changesettracker').makeChangesetTracker; +var colorutils = require('/colorutils').colorutils; +var makeContentCollector = require('/contentcollector').makeContentCollector; +var makeCSSManager = require('/cssmanager').makeCSSManager; +var domline = require('/domline').domline; +var AttribPool = require('/easysync2').AttribPool; +var Changeset = require('/easysync2').Changeset; +var linestylefilter = require('/linestylefilter').linestylefilter; +var newSkipList = require('/skiplist').newSkipList; +var undoModule = require('/undomodule').undoModule; +var makeVirtualLineView = require('/virtual_lines').makeVirtualLineView; + function OUTER(gscope) { diff --git a/static/js/broadcast.js b/static/js/broadcast.js index edfeef9c6..f2aa048fb 100644 --- a/static/js/broadcast.js +++ b/static/js/broadcast.js @@ -22,6 +22,12 @@ var global = this; +var makeCSSManager = require('/cssmanager_client').makeCSSManager; +var domline = require('/domline_client').domline; +var Changeset = require('/easysync2_client').Changeset; +var AttribPool = require('/easysync2_client').AttribPool; +var linestylefilter = require('/linestylefilter_client').linestylefilter; + function loadBroadcastJS() { // just in case... (todo: this must be somewhere else in the client code.) diff --git a/static/js/changesettracker.js b/static/js/changesettracker.js index 60c73d3d5..db3ab9446 100644 --- a/static/js/changesettracker.js +++ b/static/js/changesettracker.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var Changeset = require('/easysync2').Changeset; +var AttribPool = require('/easysync2').AttribPool; function makeChangesetTracker(scheduler, apool, aceCallbacksProvider) { diff --git a/static/js/chat.js b/static/js/chat.js index a0d0d9ac2..b4d15f4e5 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var padutils = require('/pad_utils').padutils; + var chat = (function() { var bottomMargin = "0px"; diff --git a/static/js/collab_client.js b/static/js/collab_client.js index 3a40fba17..1f4e21dc8 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -25,6 +25,8 @@ $(window).bind("load", function() getCollabClient.windowLoaded = true; }); +var chat = require('/chat').chat; + // Dependency fill on init. This exists for `pad.socket` only. // TODO: bind directly to the socket. var pad = undefined; diff --git a/static/js/contentcollector.js b/static/js/contentcollector.js index e5a90586c..d69d813d8 100644 --- a/static/js/contentcollector.js +++ b/static/js/contentcollector.js @@ -25,6 +25,8 @@ var _MAX_LIST_LEVEL = 8; +var Changeset = require('/easysync2').Changeset + function sanitizeUnicode(s) { return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?'); diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index e990a68bc..5d831ae80 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -27,6 +27,9 @@ // requires: top // requires: plugins // requires: undefined + +var Changeset = require('/easysync2').Changeset + var linestylefilter = {}; linestylefilter.ATTRIB_CLASSES = { diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index a4536490f..b9203c9fd 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -25,6 +25,9 @@ // requires: top // requires: plugins // requires: undefined + +var Changeset = require('/easysync2_client').Changeset + var linestylefilter = {}; linestylefilter.ATTRIB_CLASSES = { diff --git a/static/js/pad2.js b/static/js/pad2.js index 5f454172f..3964dae6b 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -32,6 +32,9 @@ settings.globalUserName = false; settings.hideQRCode = false; settings.rtlIsTrue = false; +var chat = require('/chat').chat; +var getCollabClient = require('/collab_client').getCollabClient; + $(document).ready(function() { //start the costum js diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 929112bbf..5fc067cb2 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -20,6 +20,7 @@ * limitations under the License. */ +var Ace2Editor = require('/ace').Ace2Editor; var padeditor = (function() { diff --git a/static/js/undomodule.js b/static/js/undomodule.js index a0073e19e..b515180d4 100644 --- a/static/js/undomodule.js +++ b/static/js/undomodule.js @@ -20,6 +20,8 @@ * limitations under the License. */ +var Changeset = require('/easysync2').Changeset; +var extend = require('/ace2_common').extend; var undoModule = (function() {