mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 22:57:11 -04:00
Merge remote branch 'upstream/master' into nice-pad-url
This commit is contained in:
commit
2199d5ebf4
23 changed files with 252 additions and 337 deletions
|
@ -217,40 +217,32 @@ function Ace2Editor()
|
|||
return {embeded: embededFiles, remote: remoteFiles};
|
||||
}
|
||||
function pushRequireScriptTo(buffer) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../static/js/require-kernel.js"); */
|
||||
var KERNEL_SOURCE = '../static/js/require-kernel.js';
|
||||
var KERNEL_BOOT = 'require.setRootURI("../minified/");\nrequire.setGlobalKeyPath("require");'
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push(Ace2Editor.EMBEDED[KERNEL_SOURCE]);
|
||||
buffer.push(KERNEL_BOOT);
|
||||
buffer.push('<\/script>');
|
||||
} else {
|
||||
buffer.push('<script type="application/javascript" src="'+KERNEL_SOURCE+'"><\/script>');
|
||||
}
|
||||
}
|
||||
function pushScriptTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
var embededFiles = sorted.embeded;
|
||||
var remoteFiles = sorted.remote;
|
||||
|
||||
for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
|
||||
var file = remoteFiles[i];
|
||||
function pushScriptsTo(buffer) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../static/js/ace2_inner.js"); */
|
||||
var ACE_SOURCE = '../static/js/ace2_inner.js';
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[ACE_SOURCE]) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push(Ace2Editor.EMBEDED[ACE_SOURCE]);
|
||||
buffer.push('require("/ace2_inner");');
|
||||
buffer.push('<\/script>');
|
||||
} else {
|
||||
file = ACE_SOURCE;
|
||||
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
|
||||
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push('require("/ace2_inner");');
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
|
||||
buffer.push('<script type="text/javascript">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
buffer.push(';\n');
|
||||
}
|
||||
for (var i = 0, ii = files.length; i < ii; i++) {
|
||||
var file = files[i];
|
||||
file = file.replace(/^\.\.\/static\/js\//, '');
|
||||
buffer.push('require('+ JSON.stringify('/' + file) + ');\n');
|
||||
}
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
function pushStyleTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
|
@ -324,20 +316,17 @@ function Ace2Editor()
|
|||
|
||||
var includedJS = [];
|
||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||
$$INCLUDE_JS("../static/js/ace2_common.js");
|
||||
$$INCLUDE_JS("../static/js/skiplist.js");
|
||||
$$INCLUDE_JS("../static/js/virtual_lines.js");
|
||||
$$INCLUDE_JS("../static/js/easysync2.js");
|
||||
$$INCLUDE_JS("../static/js/cssmanager.js");
|
||||
$$INCLUDE_JS("../static/js/colorutils.js");
|
||||
$$INCLUDE_JS("../static/js/undomodule.js");
|
||||
$$INCLUDE_JS("../static/js/contentcollector.js");
|
||||
$$INCLUDE_JS("../static/js/changesettracker.js");
|
||||
$$INCLUDE_JS("../static/js/linestylefilter.js");
|
||||
$$INCLUDE_JS("../static/js/domline.js");
|
||||
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
||||
pushRequireScriptTo(iframeHTML);
|
||||
pushScriptTagsFor(iframeHTML, includedJS);
|
||||
// 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>\
|
||||
');
|
||||
pushScriptsTo(iframeHTML);
|
||||
|
||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false"> </body></html>');
|
||||
|
@ -362,19 +351,6 @@ function Ace2Editor()
|
|||
// (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>');
|
||||
|
||||
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;
|
||||
|
|
|
@ -238,7 +238,7 @@ function OUTER(gscope)
|
|||
}
|
||||
|
||||
// Text color
|
||||
var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.45) ? '#ffffff' : '#000000';
|
||||
var txtcolor = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) ? '#ffffff' : '#000000';
|
||||
|
||||
var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector(
|
||||
getAuthorClassName(author)));
|
||||
|
|
|
@ -25,6 +25,7 @@ var domline = require('/domline_client').domline;
|
|||
var Changeset = require('/easysync2_client').Changeset;
|
||||
var AttribPool = require('/easysync2_client').AttribPool;
|
||||
var linestylefilter = require('/linestylefilter_client').linestylefilter;
|
||||
var colorutils = require('/colorutils').colorutils;
|
||||
|
||||
// These parameters were global, now they are injected. A reference to the
|
||||
// Timeslider controller would probably be more appropriate.
|
||||
|
@ -757,7 +758,9 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
|
|||
var bgcolor = typeof data.colorId == "number" ? clientVars.colorPalette[data.colorId] : data.colorId;
|
||||
if (bgcolor && dynamicCSS)
|
||||
{
|
||||
dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author)).backgroundColor = bgcolor;
|
||||
var selector = dynamicCSS.selectorStyle('.' + linestylefilter.getAuthorClassName(author));
|
||||
selector.backgroundColor = bgcolor
|
||||
selector.color = (colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5) ? '#ffffff' : '#000000'; //see ace2_inner.js for the other part
|
||||
}
|
||||
authorData[author] = data;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ var chat = (function()
|
|||
|
||||
var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName);
|
||||
|
||||
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time'>" + timeStr + "</span> " + text + "</p>";
|
||||
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
|
||||
$("#chattext").append(html);
|
||||
|
||||
//should we increment the counter??
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$(window).bind("load", function()
|
||||
{
|
||||
getCollabClient.windowLoaded = true;
|
||||
});
|
||||
|
||||
var chat = require('/chat').chat;
|
||||
|
||||
// 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;
|
||||
|
||||
function handleCometHiccup(params)
|
||||
|
@ -654,8 +636,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
}, 0);
|
||||
}
|
||||
|
||||
var self;
|
||||
return (self = {
|
||||
var self = {
|
||||
setOnUserJoin: function(cb)
|
||||
{
|
||||
callbacks.onUserJoin = cb;
|
||||
|
@ -698,7 +679,10 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
callWhenNotCommitting: callWhenNotCommitting,
|
||||
addHistoricalAuthors: tellAceAboutHistoricalAuthors,
|
||||
setChannelState: setChannelState
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(setUpSocket);
|
||||
return self;
|
||||
}
|
||||
|
||||
function selectElementContents(elem)
|
||||
|
|
|
@ -26,12 +26,7 @@
|
|||
var _MAX_LIST_LEVEL = 8;
|
||||
|
||||
var Changeset = require('/easysync2').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
var plugins = require('/plugins').plugins;
|
||||
|
||||
function sanitizeUnicode(s)
|
||||
{
|
||||
|
@ -42,15 +37,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
{
|
||||
browser = browser || {};
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
var plugins_ = plugins;
|
||||
|
||||
var dom = domInterface || {
|
||||
isNodeText: function(n)
|
||||
|
|
|
@ -26,12 +26,8 @@
|
|||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
var plugins = require('/plugins').plugins;
|
||||
var map = require('/ace2_common').map;
|
||||
|
||||
var domline = {};
|
||||
domline.noop = function()
|
||||
|
@ -148,20 +144,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
var extraOpenTags = "";
|
||||
var extraCloseTags = "";
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -25,12 +25,8 @@
|
|||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
var plugins = require('/plugins').plugins;
|
||||
var map = require('/ace2_common').map;
|
||||
|
||||
var domline = {};
|
||||
domline.noop = function()
|
||||
|
@ -147,20 +143,12 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
var extraOpenTags = "";
|
||||
var extraCloseTags = "";
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -29,12 +29,8 @@
|
|||
// requires: undefined
|
||||
|
||||
var Changeset = require('/easysync2').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
var plugins = require('/plugins').plugins;
|
||||
var map = require('/ace2_common').map;
|
||||
|
||||
var linestylefilter = {};
|
||||
|
||||
|
@ -59,15 +55,7 @@ linestylefilter.getAuthorClassName = function(author)
|
|||
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
||||
{
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
var plugins_ = plugins;
|
||||
|
||||
if (lineLength == 0) return textAndClassFunc;
|
||||
|
||||
|
@ -312,21 +300,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
|
|||
{
|
||||
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
var plugins_ = plugins;
|
||||
|
||||
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
||||
linestylefilter: linestylefilter,
|
||||
browser: browser
|
||||
});
|
||||
hookFilters.map(function(hookFilter)
|
||||
map(hookFilters, function(hookFilter)
|
||||
{
|
||||
func = hookFilter(lineText, func);
|
||||
});
|
||||
|
|
|
@ -27,12 +27,8 @@
|
|||
// requires: undefined
|
||||
|
||||
var Changeset = require('/easysync2_client').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
var plugins = require('/plugins').plugins;
|
||||
var map = require('/ace2_common').map;
|
||||
|
||||
var linestylefilter = {};
|
||||
|
||||
|
@ -57,15 +53,7 @@ linestylefilter.getAuthorClassName = function(author)
|
|||
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
|
||||
{
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
var plugins_ = plugins;
|
||||
|
||||
if (lineLength == 0) return textAndClassFunc;
|
||||
|
||||
|
@ -310,21 +298,13 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
|
|||
{
|
||||
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
|
||||
|
||||
var plugins_;
|
||||
if (typeof(plugins) != 'undefined')
|
||||
{
|
||||
plugins_ = plugins;
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins_ = parent.parent.plugins;
|
||||
}
|
||||
var plugins_ = plugins;
|
||||
|
||||
var hookFilters = plugins_.callHook("aceGetFilterStack", {
|
||||
linestylefilter: linestylefilter,
|
||||
browser: browser
|
||||
});
|
||||
hookFilters.map(function(hookFilter)
|
||||
map(hookFilters, function(hookFilter)
|
||||
{
|
||||
func = hookFilter(lineText, func);
|
||||
});
|
||||
|
|
|
@ -99,6 +99,7 @@ function getParams()
|
|||
var IsnoColors = params["noColors"];
|
||||
var hideQRCode = params["hideQRCode"];
|
||||
var rtl = params["rtl"];
|
||||
var alwaysShowChat = params["alwaysShowChat"];
|
||||
|
||||
if(IsnoColors)
|
||||
{
|
||||
|
@ -153,6 +154,13 @@ function getParams()
|
|||
settings.rtlIsTrue = true
|
||||
}
|
||||
}
|
||||
if(alwaysShowChat)
|
||||
{
|
||||
if(alwaysShowChat == "true")
|
||||
{
|
||||
chat.stickToScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getUrlVars()
|
||||
|
@ -414,8 +422,8 @@ var pad = {
|
|||
|
||||
$(document).ready(function()
|
||||
{
|
||||
//start the costum js
|
||||
if(typeof costumStart == "function") costumStart();
|
||||
// start the custom js
|
||||
if (typeof customStart == "function") customStart();
|
||||
getParams();
|
||||
handshake();
|
||||
});
|
||||
|
|
|
@ -24,6 +24,15 @@ var padutils = require('/pad_utils').padutils;
|
|||
var padeditor = require('/pad_editor').padeditor;
|
||||
var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
|
||||
|
||||
function indexOf(array, value) {
|
||||
for (var i = 0, ii = array.length; i < ii; i++) {
|
||||
if (array[i] == value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
var padeditbar = (function()
|
||||
{
|
||||
|
||||
|
@ -190,7 +199,7 @@ var padeditbar = (function()
|
|||
}
|
||||
else
|
||||
{
|
||||
var nth_child = modules.indexOf(moduleName) + 1;
|
||||
var nth_child = indexOf(modules, moduleName) + 1;
|
||||
if (nth_child > 0 && nth_child <= 3) {
|
||||
$("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected");
|
||||
$("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("selected");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
|
||||
*/
|
||||
|
||||
plugins = {
|
||||
var plugins = {
|
||||
callHook: function(hookName, args)
|
||||
{
|
||||
var global = (function () {return this}());
|
||||
|
@ -25,10 +25,12 @@ 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 || "");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ var socket, token, padId, export_links;
|
|||
function init() {
|
||||
$(document).ready(function ()
|
||||
{
|
||||
//start the costum js
|
||||
if(typeof costumStart == "function") costumStart();
|
||||
// start the custom js
|
||||
if (typeof customStart == "function") customStart();
|
||||
|
||||
//get the padId out of the url
|
||||
var urlParts= document.location.pathname.split("/");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue