From 75fd27998e818b64942fd62f332082af742b4206 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 18:58:58 +0000 Subject: [PATCH 1/3] expose socket timeslider with a bad hack --- src/static/js/timeslider.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 5203e57ba..0e26699b1 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -63,6 +63,7 @@ function init() { //build up the socket io connection socket = io.connect(url, {resource: resource}); + window.parent.socket = socket; // Expose the socket to it's parent HACK //send the ready message once we're connected socket.on('connect', function() @@ -163,3 +164,4 @@ function handleClientVars(message) exports.baseURL = ''; exports.init = init; +exports.sendSocketMsg = sendSocketMsg; From 7fcc71710fc2491d4d439c2730b6991e98b3250e Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 18:59:53 +0000 Subject: [PATCH 2/3] dont exposrt sendSocketMs --- src/static/js/timeslider.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 0e26699b1..acf1b0394 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -164,4 +164,3 @@ function handleClientVars(message) exports.baseURL = ''; exports.init = init; -exports.sendSocketMsg = sendSocketMsg; From cda3a0e78bbfb5d26d7f449260d59cfa11b04124 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 21:03:52 +0000 Subject: [PATCH 3/3] a different approach --- src/static/js/timeslider.js | 5 +++-- src/templates/timeslider.html | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index acf1b0394..24e6e98de 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -30,7 +30,7 @@ var readCookie = require('./pad_utils').readCookie; var randomString = require('./pad_utils').randomString; var _ = require('./underscore'); -var socket, token, padId, export_links; +var token, padId, export_links; function init() { $(document).ready(function () @@ -63,7 +63,6 @@ function init() { //build up the socket io connection socket = io.connect(url, {resource: resource}); - window.parent.socket = socket; // Expose the socket to it's parent HACK //send the ready message once we're connected socket.on('connect', function() @@ -107,6 +106,8 @@ function init() { window.location.reload(); }); + exports.socket = socket; // make the socket available + }); } diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index 4a8543c56..5d0e357c6 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -211,6 +211,8 @@ } var plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins'); + var socket = require('ep_etherpad-lite/static/js/timeslider').socket; + plugins.baseURL = baseURL; plugins.update(function () {