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" DOWNLOAD_JQUERY="true"
NEEDED_VERSION="1.7.1" NEEDED_VERSION="1.7.1"
if [ -f "static/js/jquery.js" ]; then 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 if [ ${VERSION#v} = $NEEDED_VERSION ]; then
DOWNLOAD_JQUERY="false" DOWNLOAD_JQUERY="false"
@ -79,7 +79,7 @@ if [ -f "static/js/prefixfree.js" ]; then
fi fi
if [ $DOWNLOAD_PREFIXFREE = "true" ]; then 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 fi
#Remove all minified data to force node creating it new #Remove all minified data to force node creating it new

View file

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

View file

@ -73,8 +73,7 @@ function _handle(req, res, jsFilename, jsFiles) {
//minifying is enabled //minifying is enabled
if(settings.minify) if(settings.minify)
{ {
var fileValues = {}; var result = undefined;
var embeds = {};
var latestModification = 0; var latestModification = 0;
async.series([ async.series([
@ -143,87 +142,20 @@ function _handle(req, res, jsFilename, jsFiles) {
//load all js files //load all js files
function (callback) function (callback)
{ {
async.forEach(jsFiles, function (item, callback) var values = [];
{ tarCode(
fs.readFile(JS_DIR + item, "utf-8", function(err, data) jsFiles
{ , function (content) {values.push(content)}
if(ERR(err, callback)) return; , function (err) {
fileValues[item] = data; if(ERR(err)) return;
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';
}
result = values.join('');
callback(); callback();
}); });
}, },
//put all together and write it into a file //put all together and write it into a file
function(callback) function(callback)
{ {
//minify all javascript files to one
var values = [];
tarCode(jsFiles, fileValues, function (content) {values.push(content)});
var result = compressJS(values);
async.parallel([ async.parallel([
//write the results plain in a file //write the results plain in a file
function(callback) function(callback)
@ -271,54 +203,123 @@ function _handle(req, res, jsFilename, jsFiles) {
//minifying is disabled, so put the files together in one file //minifying is disabled, so put the files together in one file
else else
{ {
var fileValues = {}; tarCode(
jsFiles
//read all js files , function (content) {res.write(content)}
async.forEach(jsFiles, function (item, callback) , function (err) {
{
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)
{
if(ERR(err)) return; if(ERR(err)) return;
tarCode(jsFiles, fileValues, function (content) {res.write(content)});
res.end(); 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; exports.requireDefinition = requireDefinition;
function requireDefinition() { function requireDefinition() {
return 'var require = ' + RequireKernel.kernelSource + ';\n'; return 'var require = ' + RequireKernel.kernelSource + ';\n';
} }
function tarCode(filesInOrder, files, write) { function tarCode(jsFiles, write, callback) {
for(var i = 0, ii = filesInOrder.length; i < filesInOrder.length; i++) { write('require.define({');
var filename = filesInOrder[i]; var initialEntry = true;
write("\n\n\n/*** File: static/js/" + filename + " ***/\n\n\n"); async.forEach(jsFiles, function (filename, callback){
write(isolateJS(files[filename], filename)); 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 function handleFile(err, data) {
// global. This is a first step towards removing symbols from the global scope. if(ERR(err, callback)) return;
// exports is global and require is a function that returns global.
function isolateJS(code, filename) {
var srcPath = JSON.stringify('/' + filename); var srcPath = JSON.stringify('/' + filename);
var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, '')); var srcPathAbbv = JSON.stringify('/' + filename.replace(/\.js$/, ''));
return 'require.define({' if (!initialEntry) {
+ srcPath + ': ' write('\n,');
+ 'function (require, exports, module) {' + code + '}' } else {
+ (srcPath != srcPathAbbv ? '\n,' + srcPathAbbv + ': null' : '') initialEntry = false;
+ '});\n'; }
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) function compressJS(values)

View file

@ -48,4 +48,18 @@
, "broadcast_revisions.js" , "broadcast_revisions.js"
, "timeslider.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" } "name": "Robin Buse" }
], ],
"dependencies" : { "dependencies" : {
"require-kernel" : "1.0.0", "require-kernel" : "1.0.1",
"socket.io" : "0.8.7", "socket.io" : "0.8.7",
"ueberDB" : "0.1.3", "ueberDB" : "0.1.7",
"async" : "0.1.15", "async" : "0.1.15",
"express" : "2.5.0", "express" : "2.5.0",
"clean-css" : "0.2.4", "clean-css" : "0.2.4",

View file

@ -1,6 +1,6 @@
function costumStart() function customStart()
{ {
//define your javascript here //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/ //you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/
} }

View file

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

View file

@ -217,41 +217,33 @@ function Ace2Editor()
return {embeded: embededFiles, remote: remoteFiles}; return {embeded: embededFiles, remote: remoteFiles};
} }
function pushRequireScriptTo(buffer) { 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_SOURCE = '../static/js/require-kernel.js';
var KERNEL_BOOT = 'require.setRootURI("../minified/");\nrequire.setGlobalKeyPath("require");'
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) { if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) {
buffer.push('<script type="text/javascript">'); buffer.push('<script type="text/javascript">');
buffer.push(Ace2Editor.EMBEDED[KERNEL_SOURCE]); 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>'); buffer.push('<\/script>');
} else { } else {
buffer.push('<script type="application/javascript" src="'+KERNEL_SOURCE+'"><\/script>'); file = ACE_SOURCE;
}
}
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 = file.replace(/^\.\.\/static\/js\//, '../minified/'); file = file.replace(/^\.\.\/static\/js\//, '../minified/');
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>'); buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
}
buffer.push('<script type="text/javascript">'); buffer.push('<script type="text/javascript">');
for (var i = 0, ii = embededFiles.length; i < ii; i++) { buffer.push('require("/ace2_inner");');
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>'); buffer.push('<\/script>');
} }
}
function pushStyleTagsFor(buffer, files) { function pushStyleTagsFor(buffer, files) {
var sorted = sortFilesByEmbeded(files); var sorted = sortFilesByEmbeded(files);
var embededFiles = sorted.embeded; var embededFiles = sorted.embeded;
@ -324,20 +316,17 @@ function Ace2Editor()
var includedJS = []; var includedJS = [];
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)}; 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); 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('<style type="text/css" title="dynamicsyntax"></style>');
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false">&nbsp;</body></html>'); iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false">&nbsp;</body></html>');
@ -362,19 +351,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;

View file

@ -238,7 +238,7 @@ function OUTER(gscope)
} }
// Text color // 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( var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector(
getAuthorClassName(author))); getAuthorClassName(author)));

View file

@ -25,6 +25,7 @@ var domline = require('/domline_client').domline;
var Changeset = require('/easysync2_client').Changeset; var Changeset = require('/easysync2_client').Changeset;
var AttribPool = require('/easysync2_client').AttribPool; var AttribPool = require('/easysync2_client').AttribPool;
var linestylefilter = require('/linestylefilter_client').linestylefilter; var linestylefilter = require('/linestylefilter_client').linestylefilter;
var colorutils = require('/colorutils').colorutils;
// These parameters were global, now they are injected. A reference to the // These parameters were global, now they are injected. A reference to the
// Timeslider controller would probably be more appropriate. // 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; var bgcolor = typeof data.colorId == "number" ? clientVars.colorPalette[data.colorId] : data.colorId;
if (bgcolor && dynamicCSS) 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; authorData[author] = data;
} }

View file

@ -106,7 +106,7 @@ var chat = (function()
var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName); 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); $("#chattext").append(html);
//should we increment the counter?? //should we increment the counter??

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -99,6 +99,7 @@ function getParams()
var IsnoColors = params["noColors"]; var IsnoColors = params["noColors"];
var hideQRCode = params["hideQRCode"]; var hideQRCode = params["hideQRCode"];
var rtl = params["rtl"]; var rtl = params["rtl"];
var alwaysShowChat = params["alwaysShowChat"];
if(IsnoColors) if(IsnoColors)
{ {
@ -153,6 +154,13 @@ function getParams()
settings.rtlIsTrue = true settings.rtlIsTrue = true
} }
} }
if(alwaysShowChat)
{
if(alwaysShowChat == "true")
{
chat.stickToScreen();
}
}
} }
function getUrlVars() function getUrlVars()
@ -414,8 +422,8 @@ var pad = {
$(document).ready(function() $(document).ready(function()
{ {
//start the costum js // start the custom js
if(typeof costumStart == "function") costumStart(); if (typeof customStart == "function") customStart();
getParams(); getParams();
handshake(); handshake();
}); });

View file

@ -24,6 +24,15 @@ var padutils = require('/pad_utils').padutils;
var padeditor = require('/pad_editor').padeditor; var padeditor = require('/pad_editor').padeditor;
var padsavedrevs = require('/pad_savedrevs').padsavedrevs; 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() var padeditbar = (function()
{ {
@ -190,7 +199,7 @@ var padeditbar = (function()
} }
else else
{ {
var nth_child = modules.indexOf(moduleName) + 1; var nth_child = indexOf(modules, moduleName) + 1;
if (nth_child > 0 && nth_child <= 3) { if (nth_child > 0 && nth_child <= 3) {
$("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected"); $("#editbar ul#menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected");
$("#editbar ul#menu_right li:nth-child(" + nth_child + ")").toggleClass("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 * 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 || "");
} }
}; };

View file

@ -65,8 +65,8 @@ var socket, token, padId, export_links;
function init() { function init() {
$(document).ready(function () $(document).ready(function ()
{ {
//start the costum js // start the custom js
if(typeof costumStart == "function") costumStart(); if (typeof customStart == "function") customStart();
//get the padId out of the url //get the padId out of the url
var urlParts= document.location.pathname.split("/"); var urlParts= document.location.pathname.split("/");

View file

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

View file

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