Inject pad dependencies into most pad submodules.

This commit is contained in:
Chad Weider 2012-01-26 21:02:58 -08:00
parent 56c07e484a
commit 514698162f
8 changed files with 22 additions and 26 deletions

View File

@ -438,7 +438,7 @@ var pad = {
} }
// order of inits is important here: // order of inits is important here:
padcookie.init(clientVars.cookiePrefsToSet); padcookie.init(clientVars.cookiePrefsToSet, this);
$("#widthprefcheck").click(pad.toggleWidthPref); $("#widthprefcheck").click(pad.toggleWidthPref);
// $("#sidebarcheck").click(pad.togglewSidebar); // $("#sidebarcheck").click(pad.togglewSidebar);
@ -465,16 +465,16 @@ var pad = {
initialTitle: clientVars.initialTitle, initialTitle: clientVars.initialTitle,
initialPassword: clientVars.initialPassword, initialPassword: clientVars.initialPassword,
guestPolicy: pad.padOptions.guestPolicy guestPolicy: pad.padOptions.guestPolicy
}); }, this);
padimpexp.init(); padimpexp.init(this);
padsavedrevs.init(clientVars.initialRevisionList); padsavedrevs.init(clientVars.initialRevisionList, this);
padeditor.init(postAceInit, pad.padOptions.view || {}); padeditor.init(postAceInit, pad.padOptions.view || {}, this);
paduserlist.init(pad.myUserInfo); paduserlist.init(pad.myUserInfo, this);
// padchat.init(clientVars.chatHistory, pad.myUserInfo); // padchat.init(clientVars.chatHistory, pad.myUserInfo);
padconnectionstatus.init(); padconnectionstatus.init();
padmodals.init(); padmodals.init(this);
pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, { pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, {
colorPalette: pad.getColorPalette() colorPalette: pad.getColorPalette()

View File

@ -87,9 +87,9 @@ var padcookie = (function()
var pad = undefined; var pad = undefined;
var self = { var self = {
init: function(prefsToSet) init: function(prefsToSet, _pad)
{ {
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
var rawCookie = getRawCookie(); var rawCookie = getRawCookie();
if (rawCookie) if (rawCookie)

View File

@ -118,9 +118,9 @@ var paddocbar = (function()
var self = { var self = {
title: null, title: null,
password: null, password: null,
init: function(opts) init: function(opts, _pad)
{ {
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
panels = { panels = {
impexp: { impexp: {

View File

@ -32,11 +32,11 @@ var padeditor = (function()
ace: null, ace: null,
// this is accessed directly from other files // this is accessed directly from other files
viewZoom: 100, viewZoom: 100,
init: function(readyFunc, initialViewOptions) init: function(readyFunc, initialViewOptions, _pad)
{ {
Ace2Editor = require('/ace').Ace2Editor; Ace2Editor = require('/ace').Ace2Editor;
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
settings = require('/pad2').settings; settings = pad.settings;
function aceReady() function aceReady()
{ {

View File

@ -236,13 +236,9 @@ var padimpexp = (function()
///// /////
var pad = undefined; var pad = undefined;
var self = { var self = {
init: function() init: function(_pad)
{ {
try { pad = _pad;
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
} catch (e) {
// skip (doesn't require pad when required by timeslider)
}
//get /p/padname //get /p/padname
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname)

View File

@ -75,9 +75,9 @@ var padmodals = (function()
var pad = undefined; var pad = undefined;
var self = { var self = {
init: function() init: function(_pad)
{ {
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
self.initFeedback(); self.initFeedback();
self.initShareBox(); self.initShareBox();

View File

@ -349,9 +349,9 @@ var padsavedrevs = (function()
var pad = undefined; var pad = undefined;
var self = { var self = {
init: function(initialRevisions) init: function(initialRevisions, _pad)
{ {
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
self.newRevisionList(initialRevisions, true); self.newRevisionList(initialRevisions, true);
$("#savedrevs-savenow").click(function() $("#savedrevs-savenow").click(function()

View File

@ -464,9 +464,9 @@ var paduserlist = (function()
var pad = undefined; var pad = undefined;
var self = { var self = {
init: function(myInitialUserInfo) init: function(myInitialUserInfo, _pad)
{ {
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected). pad = _pad;
self.setMyUserInfo(myInitialUserInfo); self.setMyUserInfo(myInitialUserInfo);