Inject pad dependencies into most pad submodules.

pull/371/head
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:
padcookie.init(clientVars.cookiePrefsToSet);
padcookie.init(clientVars.cookiePrefsToSet, this);
$("#widthprefcheck").click(pad.toggleWidthPref);
// $("#sidebarcheck").click(pad.togglewSidebar);
@ -465,16 +465,16 @@ var pad = {
initialTitle: clientVars.initialTitle,
initialPassword: clientVars.initialPassword,
guestPolicy: pad.padOptions.guestPolicy
});
padimpexp.init();
padsavedrevs.init(clientVars.initialRevisionList);
}, this);
padimpexp.init(this);
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);
padconnectionstatus.init();
padmodals.init();
padmodals.init(this);
pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, {
colorPalette: pad.getColorPalette()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -349,9 +349,9 @@ var padsavedrevs = (function()
var pad = undefined;
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);
$("#savedrevs-savenow").click(function()

View File

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