mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
commit
cbe0b6d6bb
9 changed files with 43 additions and 141 deletions
|
@ -141,9 +141,6 @@ async.waterfall([
|
||||||
gracefulShutdown();
|
gracefulShutdown();
|
||||||
});
|
});
|
||||||
|
|
||||||
//serve minified files
|
|
||||||
app.get('/minified/:filename', minify.minifyJS);
|
|
||||||
|
|
||||||
//serve static files
|
//serve static files
|
||||||
app.get('/static/js/require-kernel.js', function (req, res, next) {
|
app.get('/static/js/require-kernel.js', function (req, res, next) {
|
||||||
res.header("Content-Type","application/javascript; charset: utf-8");
|
res.header("Content-Type","application/javascript; charset: utf-8");
|
||||||
|
|
|
@ -337,6 +337,15 @@ function Ace2Editor()
|
||||||
$$INCLUDE_JS("../static/js/domline.js");
|
$$INCLUDE_JS("../static/js/domline.js");
|
||||||
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
||||||
pushRequireScriptTo(iframeHTML);
|
pushRequireScriptTo(iframeHTML);
|
||||||
|
// Inject my plugins into my child.
|
||||||
|
iframeHTML.push('\
|
||||||
|
<script type="text/javascript">\
|
||||||
|
require.define("/plugins", null);\n\
|
||||||
|
require.define("/plugins.js", function (require, exports, module) {\
|
||||||
|
module.exports = parent.parent.require("/plugins");\
|
||||||
|
});\
|
||||||
|
</script>\
|
||||||
|
');
|
||||||
pushScriptTagsFor(iframeHTML, includedJS);
|
pushScriptTagsFor(iframeHTML, includedJS);
|
||||||
|
|
||||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||||
|
@ -362,19 +371,6 @@ function Ace2Editor()
|
||||||
// (throbs busy while typing)
|
// (throbs busy while typing)
|
||||||
outerHTML.push('<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>');
|
outerHTML.push('<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>');
|
||||||
|
|
||||||
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");
|
var outerFrame = document.createElement("IFRAME");
|
||||||
outerFrame.frameBorder = 0; // for IE
|
outerFrame.frameBorder = 0; // for IE
|
||||||
info.frame = outerFrame;
|
info.frame = outerFrame;
|
||||||
|
|
|
@ -20,11 +20,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(window).bind("load", function()
|
|
||||||
{
|
|
||||||
getCollabClient.windowLoaded = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
var chat = require('/chat').chat;
|
var chat = require('/chat').chat;
|
||||||
|
|
||||||
// Dependency fill on init. This exists for `pad.socket` only.
|
// Dependency fill on init. This exists for `pad.socket` only.
|
||||||
|
@ -268,19 +263,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUpSocketWhenWindowLoaded()
|
|
||||||
{
|
|
||||||
if (getCollabClient.windowLoaded)
|
|
||||||
{
|
|
||||||
setUpSocket();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setTimeout(setUpSocketWhenWindowLoaded, 200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTimeout(setUpSocketWhenWindowLoaded, 0);
|
|
||||||
|
|
||||||
var hiccupCount = 0;
|
var hiccupCount = 0;
|
||||||
|
|
||||||
function handleCometHiccup(params)
|
function handleCometHiccup(params)
|
||||||
|
@ -654,8 +636,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var self;
|
var self = {
|
||||||
return (self = {
|
|
||||||
setOnUserJoin: function(cb)
|
setOnUserJoin: function(cb)
|
||||||
{
|
{
|
||||||
callbacks.onUserJoin = cb;
|
callbacks.onUserJoin = cb;
|
||||||
|
@ -698,7 +679,10 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
callWhenNotCommitting: callWhenNotCommitting,
|
callWhenNotCommitting: callWhenNotCommitting,
|
||||||
addHistoricalAuthors: tellAceAboutHistoricalAuthors,
|
addHistoricalAuthors: tellAceAboutHistoricalAuthors,
|
||||||
setChannelState: setChannelState
|
setChannelState: setChannelState
|
||||||
});
|
};
|
||||||
|
|
||||||
|
$(document).ready(setUpSocket);
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectElementContents(elem)
|
function selectElementContents(elem)
|
||||||
|
|
|
@ -26,12 +26,7 @@
|
||||||
var _MAX_LIST_LEVEL = 8;
|
var _MAX_LIST_LEVEL = 8;
|
||||||
|
|
||||||
var Changeset = require('/easysync2').Changeset
|
var Changeset = require('/easysync2').Changeset
|
||||||
var plugins = undefined;
|
var plugins = require('/plugins').plugins;
|
||||||
try {
|
|
||||||
plugins = require('/plugins').plugins;
|
|
||||||
} catch (e) {
|
|
||||||
// silence
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizeUnicode(s)
|
function sanitizeUnicode(s)
|
||||||
{
|
{
|
||||||
|
@ -42,15 +37,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
{
|
{
|
||||||
browser = browser || {};
|
browser = browser || {};
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dom = domInterface || {
|
var dom = domInterface || {
|
||||||
isNodeText: function(n)
|
isNodeText: function(n)
|
||||||
|
|
|
@ -26,12 +26,8 @@
|
||||||
// requires: plugins
|
// requires: plugins
|
||||||
// requires: undefined
|
// requires: undefined
|
||||||
|
|
||||||
var plugins = undefined;
|
var plugins = require('/plugins').plugins;
|
||||||
try {
|
var map = require('/ace2_common').map;
|
||||||
plugins = require('/plugins').plugins;
|
|
||||||
} catch (e) {
|
|
||||||
// silence
|
|
||||||
}
|
|
||||||
|
|
||||||
var domline = {};
|
var domline = {};
|
||||||
domline.noop = function()
|
domline.noop = function()
|
||||||
|
@ -148,20 +144,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
var extraOpenTags = "";
|
var extraOpenTags = "";
|
||||||
var extraCloseTags = "";
|
var extraCloseTags = "";
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins_.callHook("aceCreateDomLine", {
|
map(plugins_.callHook("aceCreateDomLine", {
|
||||||
domline: domline,
|
domline: domline,
|
||||||
cls: cls
|
cls: cls
|
||||||
}).map(function(modifier)
|
}), function(modifier)
|
||||||
{
|
{
|
||||||
cls = modifier.cls;
|
cls = modifier.cls;
|
||||||
extraOpenTags = extraOpenTags + modifier.extraOpenTags;
|
extraOpenTags = extraOpenTags + modifier.extraOpenTags;
|
||||||
|
|
|
@ -25,12 +25,8 @@
|
||||||
// requires: plugins
|
// requires: plugins
|
||||||
// requires: undefined
|
// requires: undefined
|
||||||
|
|
||||||
var plugins = undefined;
|
var plugins = require('/plugins').plugins;
|
||||||
try {
|
var map = require('/ace2_common').map;
|
||||||
plugins = require('/plugins').plugins;
|
|
||||||
} catch (e) {
|
|
||||||
// silence
|
|
||||||
}
|
|
||||||
|
|
||||||
var domline = {};
|
var domline = {};
|
||||||
domline.noop = function()
|
domline.noop = function()
|
||||||
|
@ -147,20 +143,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
var extraOpenTags = "";
|
var extraOpenTags = "";
|
||||||
var extraCloseTags = "";
|
var extraCloseTags = "";
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins_.callHook("aceCreateDomLine", {
|
map(plugins_.callHook("aceCreateDomLine", {
|
||||||
domline: domline,
|
domline: domline,
|
||||||
cls: cls
|
cls: cls
|
||||||
}).map(function(modifier)
|
}), function(modifier)
|
||||||
{
|
{
|
||||||
cls = modifier.cls;
|
cls = modifier.cls;
|
||||||
extraOpenTags = extraOpenTags + modifier.extraOpenTags;
|
extraOpenTags = extraOpenTags + modifier.extraOpenTags;
|
||||||
|
|
|
@ -29,12 +29,8 @@
|
||||||
// requires: undefined
|
// requires: undefined
|
||||||
|
|
||||||
var Changeset = require('/easysync2').Changeset
|
var Changeset = require('/easysync2').Changeset
|
||||||
var plugins = undefined;
|
var plugins = require('/plugins').plugins;
|
||||||
try {
|
var map = require('/ace2_common').map;
|
||||||
plugins = require('/plugins').plugins;
|
|
||||||
} catch (e) {
|
|
||||||
// silence
|
|
||||||
}
|
|
||||||
|
|
||||||
var linestylefilter = {};
|
var linestylefilter = {};
|
||||||
|
|
||||||
|
@ -59,15 +55,7 @@ linestylefilter.getAuthorClassName = function(author)
|
||||||
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
||||||
{
|
{
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lineLength == 0) return textAndClassFunc;
|
if (lineLength == 0) return textAndClassFunc;
|
||||||
|
|
||||||
|
@ -312,21 +300,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
|
||||||
{
|
{
|
||||||
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
||||||
linestylefilter: linestylefilter,
|
linestylefilter: linestylefilter,
|
||||||
browser: browser
|
browser: browser
|
||||||
});
|
});
|
||||||
hookFilters.map(function(hookFilter)
|
map(hookFilters, function(hookFilter)
|
||||||
{
|
{
|
||||||
func = hookFilter(lineText, func);
|
func = hookFilter(lineText, func);
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,12 +27,8 @@
|
||||||
// requires: undefined
|
// requires: undefined
|
||||||
|
|
||||||
var Changeset = require('/easysync2_client').Changeset
|
var Changeset = require('/easysync2_client').Changeset
|
||||||
var plugins = undefined;
|
var plugins = require('/plugins').plugins;
|
||||||
try {
|
var map = require('/ace2_common').map;
|
||||||
plugins = require('/plugins').plugins;
|
|
||||||
} catch (e) {
|
|
||||||
// silence
|
|
||||||
}
|
|
||||||
|
|
||||||
var linestylefilter = {};
|
var linestylefilter = {};
|
||||||
|
|
||||||
|
@ -57,15 +53,7 @@ linestylefilter.getAuthorClassName = function(author)
|
||||||
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
||||||
{
|
{
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lineLength == 0) return textAndClassFunc;
|
if (lineLength == 0) return textAndClassFunc;
|
||||||
|
|
||||||
|
@ -310,21 +298,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
|
||||||
{
|
{
|
||||||
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
||||||
|
|
||||||
var plugins_;
|
var plugins_ = plugins;
|
||||||
if (typeof(plugins) != 'undefined')
|
|
||||||
{
|
|
||||||
plugins_ = plugins;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
plugins_ = parent.parent.plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
||||||
linestylefilter: linestylefilter,
|
linestylefilter: linestylefilter,
|
||||||
browser: browser
|
browser: browser
|
||||||
});
|
});
|
||||||
hookFilters.map(function(hookFilter)
|
map(hookFilters, function(hookFilter)
|
||||||
{
|
{
|
||||||
func = hookFilter(lineText, func);
|
func = hookFilter(lineText, func);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
|
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
|
||||||
*/
|
*/
|
||||||
|
|
||||||
plugins = {
|
var plugins = {
|
||||||
callHook: function(hookName, args)
|
callHook: function(hookName, args)
|
||||||
{
|
{
|
||||||
var global = (function () {return this}());
|
var global = (function () {return this}());
|
||||||
|
@ -25,10 +25,12 @@ plugins = {
|
||||||
if (sep == undefined) sep = '';
|
if (sep == undefined) sep = '';
|
||||||
if (pre == undefined) pre = '';
|
if (pre == undefined) pre = '';
|
||||||
if (post == undefined) post = '';
|
if (post == undefined) post = '';
|
||||||
return plugins.callHook(hookName, args).map(function(x)
|
var newCallhooks = [];
|
||||||
{
|
var callhooks = plugins.callHook(hookName, args);
|
||||||
return pre + x + post
|
for (var i = 0, ii = callhooks.length; i < ii; i++) {
|
||||||
}).join(sep || "");
|
newCallhooks[i] = pre + callhooks[i] + post;
|
||||||
|
}
|
||||||
|
return newCallhooks.join(sep || "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue