diff --git a/static/js/ace.js b/static/js/ace.js index 9efb5d74..4cad6b4f 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -371,19 +371,6 @@ function Ace2Editor() // (throbs busy while typing) outerHTML.push('', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '
x
'); - if (!Array.prototype.map) Array.prototype.map = function(fun) - { //needed for IE - if (typeof fun != "function") throw new TypeError(); - var len = this.length; - var res = new Array(len); - var thisp = arguments[1]; - for (var i = 0; i < len; i++) - { - if (i in this) res[i] = fun.call(thisp, this[i], i, this); - } - return res; - }; - var outerFrame = document.createElement("IFRAME"); outerFrame.frameBorder = 0; // for IE info.frame = outerFrame; diff --git a/static/js/domline.js b/static/js/domline.js index d89eeb46..8d8c2ea9 100644 --- a/static/js/domline.js +++ b/static/js/domline.js @@ -27,6 +27,7 @@ // requires: undefined var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -145,10 +146,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) var plugins_ = plugins; - plugins_.callHook("aceCreateDomLine", { + map(plugins_.callHook("aceCreateDomLine", { domline: domline, cls: cls - }).map(function(modifier) + }), function(modifier) { cls = modifier.cls; extraOpenTags = extraOpenTags + modifier.extraOpenTags; diff --git a/static/js/domline_client.js b/static/js/domline_client.js index 09530714..87b6ed55 100644 --- a/static/js/domline_client.js +++ b/static/js/domline_client.js @@ -26,6 +26,7 @@ // requires: undefined var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var domline = {}; domline.noop = function() @@ -144,10 +145,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) var plugins_ = plugins; - plugins_.callHook("aceCreateDomLine", { + map(plugins_.callHook("aceCreateDomLine", { domline: domline, cls: cls - }).map(function(modifier) + }), function(modifier) { cls = modifier.cls; extraOpenTags = extraOpenTags + modifier.extraOpenTags; diff --git a/static/js/linestylefilter.js b/static/js/linestylefilter.js index 6bb09f07..d0b5bc6e 100644 --- a/static/js/linestylefilter.js +++ b/static/js/linestylefilter.js @@ -30,6 +30,7 @@ var Changeset = require('/easysync2').Changeset var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -305,7 +306,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) linestylefilter: linestylefilter, browser: browser }); - hookFilters.map(function(hookFilter) + map(hookFilters, function(hookFilter) { func = hookFilter(lineText, func); }); diff --git a/static/js/linestylefilter_client.js b/static/js/linestylefilter_client.js index 8f1a6baf..f057e21a 100644 --- a/static/js/linestylefilter_client.js +++ b/static/js/linestylefilter_client.js @@ -28,6 +28,7 @@ var Changeset = require('/easysync2_client').Changeset var plugins = require('/plugins').plugins; +var map = require('/ace2_common').map; var linestylefilter = {}; @@ -303,7 +304,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) linestylefilter: linestylefilter, browser: browser }); - hookFilters.map(function(hookFilter) + map(hookFilters, function(hookFilter) { func = hookFilter(lineText, func); }); diff --git a/static/js/plugins.js b/static/js/plugins.js index 963f055c..3e226eba 100644 --- a/static/js/plugins.js +++ b/static/js/plugins.js @@ -25,10 +25,12 @@ var plugins = { if (sep == undefined) sep = ''; if (pre == undefined) pre = ''; if (post == undefined) post = ''; - return plugins.callHook(hookName, args).map(function(x) - { - return pre + x + post - }).join(sep || ""); + var newCallhooks = []; + var callhooks = plugins.callHook(hookName, args); + for (var i = 0, ii = callhooks.length; i < ii; i++) { + newCallhooks[i] = pre + callhooks[i] + post; + } + return newCallhooks.join(sep || ""); } };