Merge remote branch 'upstream/master' into nice-pad-url

This commit is contained in:
Wikinaut 2012-02-07 09:43:53 +01:00
commit 2199d5ebf4
23 changed files with 252 additions and 337 deletions

View file

@ -56,7 +56,7 @@ echo "Ensure jQuery is downloaded and up to date..."
DOWNLOAD_JQUERY="true"
NEEDED_VERSION="1.7.1"
if [ -f "static/js/jquery.js" ]; then
VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9].[0-9]");
VERSION=$(cat static/js/jquery.js | head -n 3 | grep -o "v[0-9]\.[0-9]\(\.[0-9]\)\?");
if [ ${VERSION#v} = $NEEDED_VERSION ]; then
DOWNLOAD_JQUERY="false"
@ -79,7 +79,7 @@ if [ -f "static/js/prefixfree.js" ]; then
fi
if [ $DOWNLOAD_PREFIXFREE = "true" ]; then
curl -lo static/js/prefixfree.js https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1
curl -lo static/js/prefixfree.js -k https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.js || exit 1
fi
#Remove all minified data to force node creating it new

View file

@ -141,9 +141,6 @@ async.waterfall([
gracefulShutdown();
});
//serve minified files
app.get('/minified/:filename', minify.minifyJS);
//serve static files
app.get('/static/js/require-kernel.js', function (req, res, next) {
res.header("Content-Type","application/javascript; charset: utf-8");

View file

@ -73,8 +73,7 @@ function _handle(req, res, jsFilename, jsFiles) {
//minifying is enabled
if(settings.minify)
{
var fileValues = {};
var embeds = {};
var result = undefined;
var latestModification = 0;
async.series([
@ -143,87 +142,20 @@ function _handle(req, res, jsFilename, jsFiles) {
//load all js files
function (callback)
{
async.forEach(jsFiles, function (item, callback)
{
fs.readFile(JS_DIR + item, "utf-8", function(err, data)
{
if(ERR(err, callback)) return;
fileValues[item] = data;
callback();
});
}, callback);
},
//find all includes in ace.js and embed them
function(callback)
{
//if this is not the creation of pad.js, skip this part
if(jsFilename != "pad.js")
{
callback();
return;
}
var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"-]+\)/gi);
//go trough all includes
async.forEach(founds, function (item, callback)
{
var filename = item.match(/"[^"]*"/g)[0].substr(1);
filename = filename.substr(0,filename.length-1);
var type = item.match(/INCLUDE_[A-Z]+/g)[0].substr("INCLUDE_".length);
//read the included file
var shortFilename = filename.replace(/^..\/static\/js\//, '');
if (shortFilename == 'require-kernel.js') {
// the kernel isnt actually on the file system.
handleEmbed(null, requireDefinition());
} else {
fs.readFile(ROOT_DIR + filename, "utf-8", handleEmbed);
}
function handleEmbed(err, data)
{
if(ERR(err, callback)) return;
if(type == "JS")
{
if (shortFilename == 'require-kernel.js') {
embeds[filename] = compressJS([data]);
} else {
embeds[filename] = compressJS([isolateJS(data, shortFilename)]);
}
}
else
{
embeds[filename] = compressCSS([data]);
}
callback();
}
}, function(err)
{
if(ERR(err, callback)) return;
fileValues["ace.js"] += ';\n'
fileValues["ace.js"] +=
'Ace2Editor.EMBEDED = Ace2Editor.EMBED || {};\n'
for (var filename in embeds)
{
fileValues["ace.js"] +=
'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
+ JSON.stringify(embeds[filename]) + ';\n';
}
var values = [];
tarCode(
jsFiles
, function (content) {values.push(content)}
, function (err) {
if(ERR(err)) return;
result = values.join('');
callback();
});
},
//put all together and write it into a file
function(callback)
{
//minify all javascript files to one
var values = [];
tarCode(jsFiles, fileValues, function (content) {values.push(content)});
var result = compressJS(values);
async.parallel([
//write the results plain in a file
function(callback)
@ -271,54 +203,123 @@ function _handle(req, res, jsFilename, jsFiles) {
//minifying is disabled, so put the files together in one file
else
{
var fileValues = {};
//read all js files
async.forEach(jsFiles, function (item, callback)
{
fs.readFile(JS_DIR + item, "utf-8", function(err, data)
{
if(ERR(err, callback)) return;
fileValues[item] = data;
callback();
});
},
//send all files together
function(err)
{
tarCode(
jsFiles
, function (content) {res.write(content)}
, function (err) {
if(ERR(err)) return;
tarCode(jsFiles, fileValues, function (content) {res.write(content)});
res.end();
});
}
}
// find all includes in ace.js and embed them.
function getAceFile(callback) {
fs.readFile(JS_DIR + 'ace.js', "utf8", function(err, data) {
if(ERR(err, callback)) return;
// Find all includes in ace.js and embed them
var founds = data.match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"-]+\)/gi);
if (!settings.minify) {
founds = [];
}
founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")');
data += ';\n';
data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n';
//go trough all includes
async.forEach(founds, function (item, callback) {
var filename = item.match(/"([^"]*)"/)[1];
var type = item.match(/INCLUDE_([A-Z]+)/)[1];
var shortFilename = (filename.match(/^..\/static\/js\/(.*)$/, '')||[])[1];
//read the included files
if (shortFilename) {
if (shortFilename == 'require-kernel.js') {
// the kernel isnt actually on the file system.
handleEmbed(null, requireDefinition());
} else {
var contents = '';
tarCode(tar[shortFilename] || shortFilename
, function (content) {
contents += content;
}
, function () {
handleEmbed(null, contents);
}
);
}
} else {
fs.readFile(ROOT_DIR + filename, "utf8", handleEmbed);
}
function handleEmbed(error, data_) {
if (error) {
return; // Don't bother to include it.
}
if (settings.minify) {
if (type == "JS") {
try {
data_ = compressJS([data_]);
} catch (e) {
// Ignore, include uncompresseed, which will break in browser.
}
} else {
data_ = compressCSS([data_]);
}
}
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
+ JSON.stringify(data_) + ';\n';
callback();
}
}, function(error) {
callback(error, data);
});
});
}
exports.requireDefinition = requireDefinition;
function requireDefinition() {
return 'var require = ' + RequireKernel.kernelSource + ';\n';
}
function tarCode(filesInOrder, files, write) {
for(var i = 0, ii = filesInOrder.length; i < filesInOrder.length; i++) {
var filename = filesInOrder[i];
write("\n\n\n/*** File: static/js/" + filename + " ***/\n\n\n");
write(isolateJS(files[filename], filename));
function tarCode(jsFiles, write, callback) {
write('require.define({');
var initialEntry = true;
async.forEach(jsFiles, function (filename, callback){
if (filename == 'ace.js') {
getAceFile(handleFile);
} else {
fs.readFile(JS_DIR + filename, "utf8", handleFile);
}
}
// Wrap the following code in a self executing function and assign exports to
// global. This is a first step towards removing symbols from the global scope.
// exports is global and require is a function that returns global.
function isolateJS(code, filename) {
function handleFile(err, data) {
if(ERR(err, callback)) return;
var srcPath = JSON.stringify('/' + filename);
var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, ''));
return 'require.define({'
+ srcPath + ': '
+ 'function (require, exports, module) {' + code + '}'
+ (srcPath != srcPathAbbv ? '\n,' + srcPathAbbv + ': null' : '')
+ '});\n';
if (!initialEntry) {
write('\n,');
} else {
initialEntry = false;
}
write(srcPath + ': ')
data = '(function (require, exports, module) {' + data + '})';
if (settings.minify) {
write(compressJS([data]));
} else {
write(data);
}
if (srcPath != srcPathAbbv) {
write('\n,' + srcPathAbbv + ': null');
}
callback();
}
}, function () {
write('});\n');
callback();
});
}
function compressJS(values)

View file

@ -48,4 +48,18 @@
, "broadcast_revisions.js"
, "timeslider.js"
]
, "ace2_inner.js": [
"ace2_common.js"
, "skiplist.js"
, "virtual_lines.js"
, "easysync2.js"
, "cssmanager.js"
, "colorutils.js"
, "undomodule.js"
, "contentcollector.js"
, "changesettracker.js"
, "linestylefilter.js"
, "domline.js"
, "ace2_inner.js"
]
}

View file

@ -10,9 +10,9 @@
"name": "Robin Buse" }
],
"dependencies" : {
"require-kernel" : "1.0.0",
"require-kernel" : "1.0.1",
"socket.io" : "0.8.7",
"ueberDB" : "0.1.3",
"ueberDB" : "0.1.7",
"async" : "0.1.15",
"express" : "2.5.0",
"clean-css" : "0.2.4",

View file

@ -1,6 +1,6 @@
function costumStart()
function customStart()
{
//define your javascript here
//jquery is avaiable - except index.js
//jquery is available - except index.js
//you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/
}

View file

@ -148,8 +148,8 @@
return randomstring;
}
//start the costum js
if(typeof costumStart == "function") costumStart();
// start the custom js
if (typeof customStart == "function") customStart();
</script>
</html>

View file

@ -217,41 +217,33 @@ 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>');
}
}
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 {
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];
file = ACE_SOURCE;
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
buffer.push('<script type="application/javascript" src="' + file + '"><\/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('require("/ace2_inner");');
buffer.push('<\/script>');
}
}
function pushStyleTagsFor(buffer, files) {
var sorted = sortFilesByEmbeded(files);
var embededFiles = sorted.embeded;
@ -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">&nbsp;</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;

View file

@ -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)));

View file

@ -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;
}

View file

@ -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??

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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();
});

View file

@ -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");

View file

@ -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 || "");
}
};

View file

@ -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("/");

View file

@ -11,14 +11,6 @@
<link href="../static/custom/pad.css" rel="stylesheet">
<style title="dynamicsyntax"></style>
<script>
var clientVars = {};
</script>
<script src="../static/js/require-kernel.js"></script>
<script src="../socket.io/socket.io.js"></script>
<script src="../minified/pad.js"></script>
<script src="../static/custom/pad.js"></script>
<div id="editbar">
<ul id="menu_left">
<li onClick="window.pad&amp;&amp;pad.editbarClick('bold');return false" >
@ -116,8 +108,8 @@
<div id="myuser">
<div id="mycolorpicker">
<div id="colorpicker"></div>
<span id="mycolorpickersave"><a onclick="closeColorPicker()">Save</a></span>
<span id="mycolorpickercancel"><a onclick="closeColorPicker()">Cancel</a></span>
<button id="mycolorpickersave">Save</button>
<button id="mycolorpickercancel">Cancel</button>
<span id="mycolorpickerpreview" class="myswatchboxhoverable"></span>
</div>
<div id="myswatchbox"><div id="myswatch"></div></div>
@ -296,15 +288,22 @@
</div>
<script>
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../minified/pad.js"></script>
<script type="text/javascript" src="../static/custom/pad.js"></script>
<script type="text/javascript">
var clientVars = {};
(function () {
require.setRootURI("../minified/");
require.setGlobalKeyPath("require");
require('/pad').init();
/* TODO: These globals shouldn't exist. */
pad = require('/pad').pad;
chat = require('/chat').chat;
padeditbar = require('/pad_editbar').padeditbar;
padimpexp = require('/pad_impexp').padimpexp;
(function () {
require('/pad').init();
}());
</script>

View file

@ -7,14 +7,8 @@
<title>Etherpad Lite Timeslider</title>
<link rel="stylesheet" href="../../static/css/pad.css">
<link rel="stylesheet" href="../../static/css/timeslider.css">
<link rel="stylesheet" href="../../static/custom/timeslider.css">
<style type="text/css" title="dynamicsyntax"></style>
<script type="text/javascript" src="../../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../minified/timeslider.js"></script>
<link href="../../static/custom/timeslider.css" rel="stylesheet">
<script src="../../static/custom/timeslider.js"></script>
</head>
<body id="padbody" class="timeslider limwidth nonpropad nonprouser">
@ -203,15 +197,20 @@
</div>
</div>
<script>
<script type="text/javascript" src="../../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../minified/timeslider.js"></script>
<script type="text/javascript" src="../../static/custom/timeslider.js"></script>
<script type="text/javascript" >
var clientVars = {};
(function () {
require.setRootURI("../minified/");
require.setGlobalKeyPath("require");
require('/timeslider').init();
/* TODO: These globals shouldn't exist. */
padeditbar = require('/pad_editbar').padeditbar;
padimpexp = require('/pad_impexp').padimpexp;
(function () {
var TimeSlider = require('/timeslider').init();
})();
</script>
</body>