New initAliases function & scoping of vars

Initialisation of DOM vars now in own function
(This allows Firefox loadstack to work fine & is more efficient too,
only ever called once)
'this' also prefixes the DOM vars initialised, so works in Firefox
This commit is contained in:
Matt Pass
2012-05-29 17:53:41 +01:00
parent 6a0cc816a9
commit 401a3a7abb

View File

@@ -33,15 +33,18 @@ var ICEcoder = {
// Don't consider these tags as part of nesting as they're singles, JS, PHP or Ruby code blocks
tagNestExceptions: ["!DOCTYPE","meta","link","img","br","hr","input","script","?php","?","%"],
// On load, set aliases, set the layout and get the nest location
init: function(login) {
// Set our aliases
initAliases: function() {
var aliasArray = ["header","files","account","accountLogin","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","nestValid","nestDisplay","charDisplay"];
// Create our ID aliases
for (var i=0;i<aliasArray.length;i++) {
ICEcoder[aliasArray[i]] = top.document.getElementById(aliasArray[i]);
}
},
// On load, set the layout and get the nest location
init: function(login) {
// Set layout & the nest location
ICEcoder.setLayout();
@@ -65,15 +68,15 @@ var ICEcoder = {
// Apply sizes to various elements of the page
headerH = 40, footerH = 30, accountH = 50, tabsBarH = 21, findBarH = 28;
header.style.width = tabsBar.style.width = findBar.style.width = winW + "px";
files.style.width = accountLogin.style.width = editor.style.left = this.filesW + "px";
account.style.height = accountH + "px";
fmLock.style.marginLeft = (this.filesW-27) + "px";
filesFrame.style.height = (winH-headerH-accountH-footerH) + "px";
this.header.style.width = this.tabsBar.style.width = this.findBar.style.width = winW + "px";
this.files.style.width = this.accountLogin.style.width = this.editor.style.left = this.filesW + "px";
this.account.style.height = this.accountH + "px";
this.fmLock.style.marginLeft = (this.filesW-27) + "px";
this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px";
// If we need to set the editor sizes
if (!dontSetEditor) {
editor.style.width = ICEcoder.content.style.width = (winW-this.filesW) + "px";
this.editor.style.width = ICEcoder.content.style.width = (winW-this.filesW) + "px";
ICEcoder.content.style.height = (winH-headerH-footerH-tabsBarH-findBarH) + "px";
// Resize the CodeMirror instances to match the window size