Merge branch 'master' into eejs

This commit is contained in:
Egil Moeller 2012-03-13 17:51:42 +01:00
commit 5f7f382a9e
34 changed files with 182 additions and 165 deletions

View File

@ -57,7 +57,7 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
**As root:**
<ol>
<li>Install the dependencies. We need gzip, git, curl, libssl develop libraries, python and gcc. <br><i>For Debian/Ubuntu</i> <code>apt-get install gzip git-core curl python libssl-dev build-essential</code><br>
<li>Install the dependencies. We need gzip, git, curl, libssl develop libraries, python and gcc. <br><i>For Debian/Ubuntu</i> <code>apt-get install gzip git-core curl python libssl-dev pkg-config build-essential</code><br>
<i>For Fedora/CentOS</i> <code>yum install gzip git-core curl python openssl-devel && yum groupinstall "Development Tools"</code>
</li><br>
<li>Install node.js
@ -73,6 +73,7 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
<ol start="3">
<li>Move to a folder where you want to install Etherpad Lite. Clone the git repository <code>git clone 'git://github.com/Pita/etherpad-lite.git'</code><br>&nbsp;</li>
<li>Change into the directory containing the Etherpad Lite source code clone with <code>cd etherpad-lite</code><br> </li>
<li>Install the dependencies with <code>bin/installDeps.sh</code><br>&nbsp;</li>
<li>Start it with <code>bin/run.sh</code><br>&nbsp;</li>
<li>Open your web browser and visit <a href="http://localhost:9001">http://localhost:9001</a>. You like it? Look at the 'Next Steps' section below</li>

16
README.plugins Normal file
View File

@ -0,0 +1,16 @@
So, a plugin is an npm package whose name starts with ep_ and that contains a file ep.json
require("ep_etherpad-lite/static/js/plugingfw/plugins").update() will use npm to list all installed modules and read their ep.json files. These will contain registrations for hooks which are loaded
A hook registration is a pairs of a hook name and a function reference (filename for require() plus function name)
require("ep_etherpad-lite/static/js/plugingfw/hooks").callAll("hook_name", {argname:value}) will call all hook functions registered for hook_name
That is the basis.
Ok, so that was a slight simplification: inside ep.json, hook registrations are grouped into groups called "parts". Parts from all plugins are ordered using a topological sort according to "pre" and "post" pointers to other plugins/parts (just like dependencies, but non-installed plugins are silently ignored).
This ordering is honored when you do callAll(hook_name) - hook functions for that hook_name are called in that order
Ordering between plugins is undefined, only parts are ordered.
A plugin usually has one part, but it van have multiple.
This is so that it can insert some hook registration before that of another plugin, and another one after.
This is important for e.g. registering URL-handlers for the express webserver, if you have some very generic and some very specific url-regexps
So, that's basically it... apart from client-side hooks
which works the same way, but uses a separate member of the part (part.client_hooks vs part.hooks), and where the hook function must obviously reside in a file require():able from the client...
One thing more: The main etherpad tree is actually a plugin itself, called ep_etherpad-lite, and it has it's own ep.json...
was that clear?

View File

@ -3,7 +3,6 @@
{ "name": "static", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/static:expressCreateServer" } },
{ "name": "specialpages", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/specialpages:expressCreateServer" } },
{ "name": "padurlsanitize", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padurlsanitize:expressCreateServer" } },
{ "name": "minified", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/minified:expressCreateServer" } },
{ "name": "padreadonly", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/padreadonly:expressCreateServer" } },
{ "name": "webaccess", "hooks": { "expressConfigure": "ep_etherpad-lite/node/hooks/express/webaccess:expressConfigure" } },
{ "name": "apicalls", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/apicalls:expressCreateServer" } },

View File

@ -1,6 +0,0 @@
var minify = require('../../utils/Minify');
exports.expressCreateServer = function (hook_name, args, cb) {
//serve minified files
args.app.get(/^\/minified\/(.*)/, minify.minifyJS);
}

View File

@ -8,34 +8,9 @@ var fs = require("fs");
var ERR = require("async-stacktrace");
exports.expressCreateServer = function (hook_name, args, cb) {
/* Handle static files for plugins:
paths like "/static/plugins/ep_myplugin/js/test.js"
are rewritten into ROOT_PATH_OF_MYPLUGIN/static/js/test.js,
commonly ETHERPAD_ROOT/node_modules/ep_myplugin/static/js/test.js
*/
args.app.get(/^\/minified\/plugins\/([^\/]+)\/static\/(.*)/, function(req, res, next) {
var plugin_name = req.params[0];
var modulePath = req.url.split("?")[0].substr("/minified/plugins/".length);
var fullPath = require.resolve(modulePath);
if (plugins.plugins[plugin_name] == undefined) {
return next();
}
fs.readFile(fullPath, "utf8", function(err, data){
if(ERR(err)) return;
res.send("require.define('" + modulePath + "', function (require, exports, module) {" + data + "})");
})
//require.define("/plugins.js", function (require, exports, module) {
//res.sendfile(fullPath);
});
// Cache both minified and static.
var assetCache = new CachingMiddleware;
args.app.all('/(minified|static)/*', assetCache.handle);
args.app.all('/(javascripts|static)/*', assetCache.handle);
// Minify will serve static files compressed (minify enabled). It also has
// file-specific hacks for ace/require-kernel/etc.
@ -44,8 +19,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
// Setup middleware that will package JavaScript files served by minify for
// CommonJS loader on the client-side.
var jsServer = new (Yajsml.Server)({
rootPath: 'minified/'
rootPath: 'javascripts/src/'
, rootURI: 'http://localhost:' + settings.port + '/static/js/'
, libraryPath: 'javascripts/lib/'
, libraryURI: 'http://localhost:' + settings.port + '/static/plugins/'
});
var StaticAssociator = Yajsml.associators.StaticAssociator;

View File

@ -27,6 +27,7 @@ var cleanCSS = require('clean-css');
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var path = require('path');
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
var RequireKernel = require('require-kernel');
var server = require('../server');
@ -35,11 +36,14 @@ var TAR_PATH = path.join(__dirname, 'tar.json');
var tar = JSON.parse(fs.readFileSync(TAR_PATH, 'utf8'));
// Rewrite tar to include modules with no extensions and proper rooted paths.
var LIBRARY_PREFIX = 'ep_etherpad-lite/static/js';
exports.tar = {};
for (var key in tar) {
exports.tar['/' + key] =
tar[key].map(function (p) {return '/' + p}).concat(
tar[key].map(function (p) {return '/' + p.replace(/\.js$/, '')})
exports.tar[LIBRARY_PREFIX + '/' + key] =
tar[key].map(function (p) {return LIBRARY_PREFIX + '/' + p}).concat(
tar[key].map(function (p) {
return LIBRARY_PREFIX + '/' + p.replace(/\.js$/, '')
})
);
}
@ -63,6 +67,22 @@ exports.minify = function(req, res, next)
return;
}
/* Handle static files for plugins:
paths like "plugins/ep_myplugin/static/js/test.js"
are rewritten into ROOT_PATH_OF_MYPLUGIN/static/js/test.js,
commonly ETHERPAD_ROOT/node_modules/ep_myplugin/static/js/test.js
*/
var match = filename.match(/^plugins\/([^\/]+)\/static\/(.*)/);
if (match) {
var pluginName = match[1];
var resourcePath = match[2];
var plugin = plugins.plugins[pluginName];
if (plugin) {
var pluginPath = plugin.package.realPath;
filename = path.relative(ROOT_DIR, pluginPath + '/static/' + resourcePath);
}
}
// What content type should this be?
// TODO: This should use a MIME module.
var contentType;
@ -149,8 +169,10 @@ function getAceFile(callback) {
var request = require('request');
var baseURI = 'http://localhost:' + settings.port
var resourceURI = baseURI + path.normalize(path.join('/static/', filename));
resourceURI = resourceURI.replace(/\\/g, '/'); // Windows (safe generally?)
request(baseURI + path.normalize(path.join('/static/', filename)), function (error, response, body) {
request(resourceURI, function (error, response, body) {
if (!error && response.statusCode == 200) {
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
+ JSON.stringify(body || '') + ';\n';

View File

@ -21,9 +21,10 @@ var path = require('path');
var server = require('../server');
var zlib = require('zlib');
var util = require('util');
var settings = require('./Settings');
var ROOT_DIR = path.normalize(__dirname + "/../");
var CACHE_DIR = ROOT_DIR + '../var/';
var CACHE_DIR = path.normalize(path.join(settings.root, 'var/'));
CACHE_DIR = path.existsSync(CACHE_DIR) ? CACHE_DIR : undefined;
var responseCache = {};
@ -37,7 +38,7 @@ function CachingMiddleware() {
}
CachingMiddleware.prototype = new function () {
function handle(req, res, next) {
if (!(req.method == "GET" || req.method == "HEAD")) {
if (!(req.method == "GET" || req.method == "HEAD") || !CACHE_DIR) {
return next(undefined, req, res);
}
@ -54,7 +55,7 @@ CachingMiddleware.prototype = new function () {
var modifiedSince = (req.headers['if-modified-since']
&& new Date(req.headers['if-modified-since']));
var lastModifiedCache = !error && stats.mtime;
if (lastModifiedCache) {
if (lastModifiedCache && responseCache[cacheKey]) {
req.headers['if-modified-since'] = lastModifiedCache.toUTCString();
} else {
delete req.headers['if-modified-since'];
@ -83,7 +84,7 @@ CachingMiddleware.prototype = new function () {
&& new Date(res.getHeader('last-modified')));
res.writeHead = old_res.writeHead;
if (status == 200 || status == 404) {
if (status == 200) {
// Update cache
var buffer = '';

View File

@ -12,7 +12,7 @@
"dependencies" : {
"yajsml" : "1.1.2",
"request" : "2.9.100",
"require-kernel" : "1.0.3",
"require-kernel" : "1.0.5",
"socket.io" : "0.8.7",
"ueberDB" : "0.1.7",
"async" : "0.1.18",

View File

@ -25,7 +25,7 @@
* limitations under the License.
*/
var AttributePoolFactory = require("ep_etherpad-lite/static/js/AttributePoolFactory");
var AttributePoolFactory = require("./AttributePoolFactory");
var _opt = null;

View File

@ -28,7 +28,7 @@ Ace2Editor.registry = {
nextId: 1
};
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
var hooks = require('./pluginfw/hooks');
function Ace2Editor()
{
@ -156,7 +156,11 @@ function Ace2Editor()
}
function pushRequireScriptTo(buffer) {
var KERNEL_SOURCE = '../static/js/require-kernel.js';
var KERNEL_BOOT = 'require.setRootURI("../minified/");\nrequire.setLibraryURI("../minified/plugins/");\nrequire.setGlobalKeyPath("require");'
var KERNEL_BOOT = '\
require.setRootURI("../javascripts/src");\n\
require.setLibraryURI("../javascripts/lib");\n\
require.setGlobalKeyPath("require");\n\
';
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) {
buffer.push('<script type="text/javascript">');
buffer.push(Ace2Editor.EMBEDED[KERNEL_SOURCE]);
@ -166,8 +170,8 @@ function Ace2Editor()
}
function pushScriptsTo(buffer) {
/* Folling is for packaging regular expression. */
/* $$INCLUDE_JS("../minified/ace2_inner.js?callback=require.define"); */
var ACE_SOURCE = '../minified/ace2_inner.js?callback=require.define';
/* $$INCLUDE_JS("../javascripts/src/ace2_inner.js?callback=require.define"); */
var ACE_SOURCE = '../javascripts/src/ace2_inner.js?callback=require.define';
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[ACE_SOURCE]) {
buffer.push('<script type="text/javascript">');
buffer.push(Ace2Editor.EMBEDED[ACE_SOURCE]);
@ -175,11 +179,6 @@ function Ace2Editor()
buffer.push('<\/script>');
} else {
file = ACE_SOURCE;
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
buffer.push('<script type="text/javascript" src="../static/js/require-kernel.js"><\/script>');
buffer.push('<script type="text/javascript">');
buffer.push('require.setRootURI("../minified/"); require.setLibraryURI("../minified/plugins/"); require.setGlobalKeyPath("require");');
buffer.push('<\/script>');
buffer.push('<script type="application/javascript" src="' + ACE_SOURCE + '"><\/script>');
buffer.push('<script type="text/javascript">');
buffer.push('require("ep_etherpad-lite/static/js/ace2_inner");');
@ -261,9 +260,7 @@ function Ace2Editor()
pushRequireScriptTo(iframeHTML);
// Inject my plugins into my child.
iframeHTML.push('\
<script type="text/javascript" src="../static/js/require-kernel.js"></script>\
<script type="text/javascript">\
require.setRootURI("../minified/"); require.setLibraryURI("../minified/plugins/"); require.setGlobalKeyPath("require");\
require.define("/plugins", null);\n\
require.define("/plugins.js", function (require, exports, module) {\
module.exports = require("ep_etherpad-lite/static/js/plugins");\

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var Security = require('ep_etherpad-lite/static/js/security');
var Security = require('./security');
function isNodeText(node)
{

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var Ace2Common = require('ep_etherpad-lite/static/js/ace2_common');
var Ace2Common = require('./ace2_common');
// Extract useful method defined in the other module.
var isNodeText = Ace2Common.isNodeText;
@ -38,18 +38,17 @@ var htmlPrettyEscape = Ace2Common.htmlPrettyEscape;
var map = Ace2Common.map;
var noop = Ace2Common.noop;
var makeChangesetTracker = require('ep_etherpad-lite/static/js/changesettracker').makeChangesetTracker;
var colorutils = require('ep_etherpad-lite/static/js/colorutils').colorutils;
var makeContentCollector = require('ep_etherpad-lite/static/js/contentcollector').makeContentCollector;
var makeCSSManager = require('ep_etherpad-lite/static/js/cssmanager').makeCSSManager;
var domline = require('ep_etherpad-lite/static/js/domline').domline;
var AttribPool = require('ep_etherpad-lite/static/js/AttributePoolFactory').createAttributePool;
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var linestylefilter = require('ep_etherpad-lite/static/js/linestylefilter').linestylefilter;
var newSkipList = require('ep_etherpad-lite/static/js/skiplist').newSkipList;
var undoModule = require('ep_etherpad-lite/static/js/undomodule').undoModule;
var makeVirtualLineView = require('ep_etherpad-lite/static/js/virtual_lines').makeVirtualLineView;
var makeChangesetTracker = require('./changesettracker').makeChangesetTracker;
var colorutils = require('./colorutils').colorutils;
var makeContentCollector = require('./contentcollector').makeContentCollector;
var makeCSSManager = require('./cssmanager').makeCSSManager;
var domline = require('./domline').domline;
var AttribPool = require('./AttributePoolFactory').createAttributePool;
var Changeset = require('./Changeset');
var linestylefilter = require('./linestylefilter').linestylefilter;
var newSkipList = require('./skiplist').newSkipList;
var undoModule = require('./undomodule').undoModule;
var makeVirtualLineView = require('./virtual_lines').makeVirtualLineView;
function Ace2Inner(){
var DEBUG = false; //$$ build script replaces the string "var DEBUG=true;//$$" with "var DEBUG=false;"

View File

@ -20,13 +20,13 @@
* limitations under the License.
*/
var makeCSSManager = require('ep_etherpad-lite/static/js/cssmanager').makeCSSManager;
var domline = require('ep_etherpad-lite/static/js/domline').domline;
var AttribPool = require('ep_etherpad-lite/static/js/AttributePoolFactory').createAttributePool;
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var linestylefilter = require('ep_etherpad-lite/static/js/linestylefilter').linestylefilter;
var colorutils = require('ep_etherpad-lite/static/js/colorutils').colorutils;
var Ace2Common = require('ep_etherpad-lite/static/js/ace2_common');
var makeCSSManager = require('./cssmanager').makeCSSManager;
var domline = require('./domline').domline;
var AttribPool = require('./AttributePoolFactory').createAttributePool;
var Changeset = require('./Changeset');
var linestylefilter = require('./linestylefilter').linestylefilter;
var colorutils = require('./colorutils').colorutils;
var Ace2Common = require('./ace2_common');
var map = Ace2Common.map;
var forEach = Ace2Common.forEach;

View File

@ -22,6 +22,8 @@
// These parameters were global, now they are injected. A reference to the
// Timeslider controller would probably be more appropriate.
var forEach = require('./ace2_common').forEach;
function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
{
var BroadcastSlider;
@ -173,7 +175,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
$("#authorstable").empty();
var numAnonymous = 0;
var numNamed = 0;
authors.forEach(function(author)
forEach(authors, function(author)
{
if (author.name)
{
@ -467,7 +469,7 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
$("#timeslider").show();
setSliderLength(clientVars.totalRevs);
setSliderPosition(clientVars.revNum);
clientVars.savedRevisions.forEach(function(revision)
forEach(clientVars.savedRevisions, function(revision)
{
addSavedRevision(revision.revNum, revision);
})

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var AttribPool = require('ep_etherpad-lite/static/js/AttributePoolFactory').createAttributePool;
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var AttribPool = require('./AttributePoolFactory').createAttributePool;
var Changeset = require('./Changeset');
function makeChangesetTracker(scheduler, apool, aceCallbacksProvider)
{

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
var padutils = require('./pad_utils').padutils;
var padcookie = require('./pad_cookie').padcookie;
var chat = (function()
{

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var chat = require('ep_etherpad-lite/static/js/chat').chat;
var chat = require('./chat').chat;
// Dependency fill on init. This exists for `pad.socket` only.
// TODO: bind directly to the socket.

View File

@ -25,8 +25,8 @@
var _MAX_LIST_LEVEL = 8;
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
var Changeset = require('./Changeset');
var hooks = require('./pluginfw/hooks');
function sanitizeUnicode(s)
{

View File

@ -26,9 +26,9 @@
// requires: plugins
// requires: undefined
var Security = require('ep_etherpad-lite/static/js/security');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
var Ace2Common = require('ep_etherpad-lite/static/js/ace2_common');
var Security = require('./security');
var hooks = require('./pluginfw/hooks');
var Ace2Common = require('./ace2_common');
var map = Ace2Common.map;
var noop = Ace2Common.noop;
var identity = Ace2Common.identity;

View File

@ -28,9 +28,9 @@
// requires: plugins
// requires: undefined
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
var map = require('ep_etherpad-lite/static/js/ace2_common').map;
var Changeset = require('./Changeset');
var hooks = require('./pluginfw/hooks');
var map = require('./ace2_common').map;
var linestylefilter = {};

View File

@ -26,29 +26,29 @@ var socket;
// These jQuery things should create local references, but for now `require()`
// assigns to the global `$` and augments it with plugins.
require('ep_etherpad-lite/static/js/jquery');
require('ep_etherpad-lite/static/js/farbtastic');
require('ep_etherpad-lite/static/js/excanvas');
JSON = require('ep_etherpad-lite/static/js/json2');
require('ep_etherpad-lite/static/js/undo-xpopup');
require('ep_etherpad-lite/static/js/prefixfree');
require('./jquery');
require('./farbtastic');
require('./excanvas');
JSON = require('./json2');
require('./undo-xpopup');
require('./prefixfree');
var chat = require('ep_etherpad-lite/static/js/chat').chat;
var getCollabClient = require('ep_etherpad-lite/static/js/collab_client').getCollabClient;
var padconnectionstatus = require('ep_etherpad-lite/static/js/pad_connectionstatus').padconnectionstatus;
var padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
var paddocbar = require('ep_etherpad-lite/static/js/pad_docbar').paddocbar;
var padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
var padeditor = require('ep_etherpad-lite/static/js/pad_editor').padeditor;
var padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp;
var padmodals = require('ep_etherpad-lite/static/js/pad_modals').padmodals;
var padsavedrevs = require('ep_etherpad-lite/static/js/pad_savedrevs').padsavedrevs;
var paduserlist = require('ep_etherpad-lite/static/js/pad_userlist').paduserlist;
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var chat = require('./chat').chat;
var getCollabClient = require('./collab_client').getCollabClient;
var padconnectionstatus = require('./pad_connectionstatus').padconnectionstatus;
var padcookie = require('./pad_cookie').padcookie;
var paddocbar = require('./pad_docbar').paddocbar;
var padeditbar = require('./pad_editbar').padeditbar;
var padeditor = require('./pad_editor').padeditor;
var padimpexp = require('./pad_impexp').padimpexp;
var padmodals = require('./pad_modals').padmodals;
var padsavedrevs = require('./pad_savedrevs').padsavedrevs;
var paduserlist = require('./pad_userlist').paduserlist;
var padutils = require('./pad_utils').padutils;
var createCookie = require('ep_etherpad-lite/static/js/pad_utils').createCookie;
var readCookie = require('ep_etherpad-lite/static/js/pad_utils').readCookie;
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
var createCookie = require('./pad_utils').createCookie;
var readCookie = require('./pad_utils').readCookie;
var randomString = require('./pad_utils').randomString;
function getParams()
{

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var padmodals = require('ep_etherpad-lite/static/js/pad_modals').padmodals;
var padmodals = require('./pad_modals').padmodals;
var padconnectionstatus = (function()
{

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var padutils = require('./pad_utils').padutils;
var paddocbar = (function()
{
@ -449,7 +449,7 @@ var paddocbar = (function()
handleResizePage: function()
{
// Side-step circular reference. This should be injected.
var padsavedrevs = require('ep_etherpad-lite/static/js/pad_savedrevs').padsavedrevs;
var padsavedrevs = require('./pad_savedrevs').padsavedrevs;
padsavedrevs.handleResizePage();
},
hideLaterIfNoOtherInteraction: function()

View File

@ -20,9 +20,9 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var padeditor = require('ep_etherpad-lite/static/js/pad_editor').padeditor;
var padsavedrevs = require('ep_etherpad-lite/static/js/pad_savedrevs').padsavedrevs;
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++) {

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var padcookie = require('./pad_cookie').padcookie;
var padutils = require('./pad_utils').padutils;
var padeditor = (function()
{
@ -34,7 +34,7 @@ var padeditor = (function()
viewZoom: 100,
init: function(readyFunc, initialViewOptions, _pad)
{
Ace2Editor = require('ep_etherpad-lite/static/js/ace').Ace2Editor;
Ace2Editor = require('./ace').Ace2Editor;
pad = _pad;
settings = pad.settings;

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var paddocbar = require('ep_etherpad-lite/static/js/pad_docbar').paddocbar;
var paddocbar = require('./pad_docbar').paddocbar;
var padimpexp = (function()
{

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var paddocbar = require('ep_etherpad-lite/static/js/pad_docbar').paddocbar;
var padutils = require('./pad_utils').padutils;
var paddocbar = require('./pad_docbar').paddocbar;
var padmodals = (function()
{

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var paddocbar = require('ep_etherpad-lite/static/js/pad_docbar').paddocbar;
var padutils = require('./pad_utils').padutils;
var paddocbar = require('./pad_docbar').paddocbar;
var padsavedrevs = (function()
{

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var padutils = require('ep_etherpad-lite/static/js/pad_utils').padutils;
var padutils = require('./pad_utils').padutils;
var myUserInfo = {};

View File

@ -20,7 +20,7 @@
* limitations under the License.
*/
var Security = require('ep_etherpad-lite/static/js/security');
var Security = require('./security');
/**
* Generates a random String with the given length. Is needed to generate the Author, Group, readonly, session Ids
@ -75,7 +75,7 @@ var padutils = {
},
uniqueId: function()
{
var pad = require('ep_etherpad-lite/static/js/pad').pad; // Sidestep circular dependency
var pad = require('./pad').pad; // Sidestep circular dependency
function encodeNum(n, width)
{
// returns string that is exactly 'width' chars, padding with zeros
@ -250,7 +250,7 @@ var padutils = {
},
timediff: function(d)
{
var pad = require('ep_etherpad-lite/static/js/pad').pad; // Sidestep circular dependency
var pad = require('./pad').pad; // Sidestep circular dependency
function format(n, word)
{
n = Math.round(n);
@ -502,17 +502,26 @@ var padutils = {
var globalExceptionHandler = undefined;
function setupGlobalExceptionHandler() {
//send javascript errors to the server
if (!globalExceptionHandler) {
globalExceptionHandler = function test (msg, url, linenumber)
{
var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, linenumber: linenumber, userAgent: navigator.userAgent})};
var loc = document.location;
var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror";
var errorId = randomString(20);
if ($("#editorloadingbox").attr("display") != "none"){
//show javascript errors to the user
$("#editorloadingbox").css("padding", "10px");
$("#editorloadingbox").css("padding-top", "45px");
$("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please send this error message to us: </span><div style='color:black;font-size:14px'>'"
+ "ErrorId: " + errorId + "<br>UserAgent: " + navigator.userAgent + "<br>" + msg + " in " + url + " at line " + linenumber + "'</div></div>");
}
//send javascript errors to the server
var errObj = {errorInfo: JSON.stringify({errorId: errorId, msg: msg, url: url, linenumber: linenumber, userAgent: navigator.userAgent})};
var loc = document.location;
var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror";
$.post(url, errObj);
$.post(url, errObj);
return false;
return false;
};
window.onerror = globalExceptionHandler;
}
@ -520,7 +529,7 @@ function setupGlobalExceptionHandler() {
padutils.setupGlobalExceptionHandler = setupGlobalExceptionHandler;
padutils.binarySearch = require('ep_etherpad-lite/static/js/ace2_common').binarySearch;
padutils.binarySearch = require('./ace2_common').binarySearch;
exports.randomString = randomString;
exports.createCookie = createCookie;

View File

@ -22,13 +22,13 @@
// These jQuery things should create local references, but for now `require()`
// assigns to the global `$` and augments it with plugins.
require('ep_etherpad-lite/static/js/jquery');
JSON = require('ep_etherpad-lite/static/js/json2');
require('ep_etherpad-lite/static/js/undo-xpopup');
require('./jquery');
JSON = require('./json2');
require('./undo-xpopup');
var createCookie = require('ep_etherpad-lite/static/js/pad_utils').createCookie;
var readCookie = require('ep_etherpad-lite/static/js/pad_utils').readCookie;
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
var createCookie = require('./pad_utils').createCookie;
var readCookie = require('./pad_utils').readCookie;
var randomString = require('./pad_utils').randomString;
var socket, token, padId, export_links;
@ -127,12 +127,12 @@ function handleClientVars(message)
clientVars = message.data;
//load all script that doesn't work without the clientVars
BroadcastSlider = require('ep_etherpad-lite/static/js/broadcast_slider').loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded);
require('ep_etherpad-lite/static/js/broadcast_revisions').loadBroadcastRevisionsJS();
changesetLoader = require('ep_etherpad-lite/static/js/broadcast').loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider);
BroadcastSlider = require('./broadcast_slider').loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded);
require('./broadcast_revisions').loadBroadcastRevisionsJS();
changesetLoader = require('./broadcast').loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider);
//initialize export ui
require('ep_etherpad-lite/static/js/pad_impexp').padimpexp.init();
require('./pad_impexp').padimpexp.init();
//change export urls when the slider moves
var export_rev_regex = /(\/\d+)?\/export/

View File

@ -20,8 +20,8 @@
* limitations under the License.
*/
var Changeset = require('ep_etherpad-lite/static/js/Changeset');
var extend = require('ep_etherpad-lite/static/js/ace2_common').extend;
var Changeset = require('./Changeset');
var extend = require('./ace2_common').extend;
var undoModule = (function()
{

View File

@ -260,24 +260,24 @@
<script type="text/javascript" src="../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../static/js/jquery.js"></script>
<script type="text/javascript" src="../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../minified/pad.js?callback=require.define"></script>
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define"></script>
<script type="text/javascript">
var clientVars = {};
(function () {
require.setRootURI("../minified/");
require.setLibraryURI("../minified/plugins/");
require.setRootURI("../javascripts/src");
require.setLibraryURI("../javascripts/lib");
require.setGlobalKeyPath("require");
var plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins');
plugins.update(function () {
require('ep_etherpad-lite/static/js/pad').init();
plugins.update(function () {
require('ep_etherpad-lite/static/js/pad').init();
});
/* TODO: These globals shouldn't exist. */
pad = require('ep_etherpad-lite/static/js/pad').pad;
chat = require('ep_etherpad-lite/static/js/chat').chat;
padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp;
});
/* TODO: These globals shouldn't exist. */
pad = require('ep_etherpad-lite/static/js/pad').pad;
chat = require('ep_etherpad-lite/static/js/chat').chat;
padeditbar = require('ep_etherpad-lite/static/js/pad_editbar').padeditbar;
padimpexp = require('ep_etherpad-lite/static/js/pad_impexp').padimpexp;
}());
</script>

View File

@ -200,13 +200,13 @@
<script type="text/javascript" src="../../../static/js/require-kernel.js"></script>
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../../minified/timeslider.js?callback=require.define"></script>
<script type="text/javascript" src="../../../javascripts/lib/ep_etherpad-lite/static/js/timeslider.js?callback=require.define"></script>
<script type="text/javascript" src="../../../static/custom/timeslider.js"></script>
<script type="text/javascript" >
var clientVars = {};
(function () {
require.setRootURI("../../../minified/");
require.setLibraryURI("../../../minified/plugins/");
require.setRootURI("../../../javascripts/src");
require.setLibraryURI("../../../javascripts/lib");
require.setGlobalKeyPath("require");
var plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins');