Skip to content

Commit

Permalink
Merge pull request #601 from redhog/master
Browse files Browse the repository at this point in the history
Bugfix for document.domain, and added initialization hook
  • Loading branch information
JohnMcLear committed Apr 5, 2012
2 parents 66fdacf + a3c9407 commit 5b87a2b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ bin/convertSettings.json
src/static/js/jquery.js
npm-debug.log
*.DS_Store
.ep_initialized
29 changes: 26 additions & 3 deletions src/static/js/pluginfw/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,28 @@ if (exports.isClient) {
};
} else {

exports.callInit = function (cb) {
var hooks = require("./hooks");
async.map(
Object.keys(exports.plugins),
function (plugin_name, cb) {
var plugin = exports.plugins[plugin_name];
fs.stat(path.normalize(path.join(plugin.package.path, ".ep_initialized")), function (err, stats) {
if (err) {
async.waterfall([
function (cb) { fs.writeFile(path.normalize(path.join(plugin.package.path, ".ep_initialized")), 'done', cb); },
function (cb) { hooks.aCallAll("init_" + plugin_name, {}, cb); },
cb,
]);
} else {
cb();
}
});
},
function () { cb(); }
);
}

exports.update = function (cb) {
exports.getPackages(function (er, packages) {
var parts = [];
Expand All @@ -109,11 +131,12 @@ exports.update = function (cb) {
exports.loadPlugin(packages, plugin_name, plugins, parts, cb);
},
function (err) {
exports.plugins = plugins;
if (err) cb(err);
exports.plugins = plugins;
exports.parts = exports.sortParts(parts);
exports.hooks = exports.extractHooks(exports.parts, "hooks");
exports.loaded = true;
cb(err);
exports.loaded = true;
exports.callInit(cb);
}
);
});
Expand Down
1 change: 1 addition & 0 deletions src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@

<script src="static/custom/index.js"></script>
<script>
document.domain = document.domain;
function go2Name()
{
var padname = document.getElementById("padname").value;
Expand Down
1 change: 1 addition & 0 deletions src/templates/pad.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ <h2 class="h2_unauth">No Authorization.</h2>
<script type="text/javascript" src="../javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define"></script>
<% } %>
<script type="text/javascript">
document.domain = document.domain;
var clientVars = {};
(function () {
<% if (settings.minify) { %>
Expand Down
1 change: 1 addition & 0 deletions src/templates/timeslider.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ <h1>
<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" >
document.domain = document.domain;
var clientVars = {};
(function () {
require.setRootURI("../../../javascripts/src");
Expand Down

0 comments on commit 5b87a2b

Please sign in to comment.