Remove all global dependencies from broadcast modules.
parent
cd86ef5600
commit
d934fd6107
|
@ -20,16 +20,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var global = this;
|
||||
|
||||
var makeCSSManager = require('/cssmanager_client').makeCSSManager;
|
||||
var domline = require('/domline_client').domline;
|
||||
var Changeset = require('/easysync2_client').Changeset;
|
||||
var AttribPool = require('/easysync2_client').AttribPool;
|
||||
var linestylefilter = require('/linestylefilter_client').linestylefilter;
|
||||
|
||||
function loadBroadcastJS()
|
||||
// These parameters were global, now they are injected. A reference to the
|
||||
// Timeslider controller would probably be more appropriate.
|
||||
function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider)
|
||||
{
|
||||
var changesetLoader = undefined;
|
||||
// just in case... (todo: this must be somewhere else in the client code.)
|
||||
// Below Array#map code was direct pasted by AppJet/Etherpad, licence unknown. Possible source: http://www.tutorialspoint.com/javascript/array_map.htm
|
||||
if (!Array.prototype.map)
|
||||
|
@ -423,7 +424,7 @@ function loadBroadcastJS()
|
|||
}));
|
||||
}
|
||||
|
||||
global.changesetLoader = {
|
||||
changesetLoader = {
|
||||
running: false,
|
||||
resolved: [],
|
||||
requestQueue1: [],
|
||||
|
@ -763,6 +764,8 @@ function loadBroadcastJS()
|
|||
}
|
||||
|
||||
receiveAuthorData(clientVars.historicalAuthorData);
|
||||
|
||||
return changesetLoader;
|
||||
}
|
||||
|
||||
exports.loadBroadcastJS = loadBroadcastJS;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
// revision info is a skip list whos entries represent a particular revision
|
||||
// of the document. These revisions are connected together by various
|
||||
// changesets, or deltas, between any two revisions.
|
||||
var global = this;
|
||||
|
||||
function loadBroadcastRevisionsJS()
|
||||
{
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
var global = this;
|
||||
|
||||
function loadBroadcastSliderJS()
|
||||
// These parameters were global, now they are injected. A reference to the
|
||||
// Timeslider controller would probably be more appropriate.
|
||||
function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
|
||||
{
|
||||
var BroadcastSlider;
|
||||
|
||||
(function()
|
||||
{ // wrap this code in its own namespace
|
||||
|
@ -203,7 +205,7 @@ function loadBroadcastSliderJS()
|
|||
}
|
||||
}
|
||||
|
||||
global.BroadcastSlider = {
|
||||
BroadcastSlider = {
|
||||
onSlider: onSlider,
|
||||
getSliderPosition: getSliderPosition,
|
||||
setSliderPosition: setSliderPosition,
|
||||
|
@ -495,6 +497,8 @@ function loadBroadcastSliderJS()
|
|||
{
|
||||
$("#viewlatest").html(loc == BroadcastSlider.getSliderLength() ? "Viewing latest content" : "View latest content");
|
||||
})
|
||||
|
||||
return BroadcastSlider;
|
||||
}
|
||||
|
||||
exports.loadBroadcastSliderJS = loadBroadcastSliderJS;
|
||||
|
|
|
@ -140,15 +140,16 @@
|
|||
|
||||
var fireWhenAllScriptsAreLoaded = [];
|
||||
|
||||
var BroadcastSlider, changesetLoader;
|
||||
function handleClientVars(message)
|
||||
{
|
||||
//save the client Vars
|
||||
clientVars = message.data;
|
||||
|
||||
//load all script that doesn't work without the clientVars
|
||||
require('/broadcast_slider').loadBroadcastSliderJS();
|
||||
BroadcastSlider = require('/broadcast_slider').loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded);
|
||||
require('/broadcast_revisions').loadBroadcastRevisionsJS();
|
||||
require('/broadcast').loadBroadcastJS();
|
||||
changesetLoader = require('/broadcast').loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, BroadcastSlider);
|
||||
|
||||
//initialize export ui
|
||||
padimpexp.init();
|
||||
|
|
Loading…
Reference in New Issue