diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 95162f3..71c7ab8 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -31,13 +31,13 @@ var ICEcoder = { tabLeftPos: [], // Array of left positions of tabs inside content area tabBGcurrent: '#141414', // BG of current tab tabBGselected: '#49d', // BG of selected tab - tabBGopen: '#aaa', // BG of open tab + tabBGopen: '#c3c3c3', // BG of open tab tabBGnormal: 'transparent', // BG of normal tab tabFGcurrent: '#fff', // FG of selected tab tabFGselected: '#fff', // FG of selected tab tabFGopenFile: '#000', // FG of open file tabFGnormalFile: '#eee', // FG of normal file - tabFGnormalTab: '#000', // FG of normal tab + tabFGnormalTab: '#888', // FG of normal tab serverQueueItems: [], // Array of URLs to call in order previewWindow: false, // Target variable for the preview window pluginIntervalRefs: [], // Array of plugin interval refs @@ -99,11 +99,10 @@ var ICEcoder = { winH = window.innerHeight; // Apply sizes to various elements of the page - headerH = 40, footerH = 30, accountH = 50, tabsBarH = 21, findBarH = 28; + headerH = 25, footerH = 0, accountH = 45, tabsBarH = 21, findBarH = 28; this.header.style.width = this.tabsBar.style.width = this.findBar.style.width = winW + "px"; this.files.style.width = this.editor.style.left = this.filesW + "px"; this.account.style.height = this.accountH + "px"; - this.fmLock.style.marginLeft = (this.filesW-42) + "px"; this.filesFrame.style.height = (winH-headerH-accountH-footerH) + "px"; this.nestValid.style.left = (this.filesW+10) + "px"; this.nestDisplay.style.left = (this.filesW+17) + "px"; @@ -167,7 +166,7 @@ var ICEcoder = { lockUnlockNav: function() { var lockIcon; - lockIcon = top.get('fmLock'); + lockIcon = top.filesFrame.contentWindow.document.getElementById('fmLock'); ICEcoder.lockedNav = !ICEcoder.lockedNav; lockIcon.style.backgroundPosition = ICEcoder.lockedNav ? "-64px -16px" : "-80px -16px"; }, @@ -243,7 +242,9 @@ var ICEcoder = { if (!(/iPhone|iPad|iPod/i.test(navigator.userAgent))) { cM = top.ICEcoder.getcMInstance(); - cM.focus(); + if (cM) { + cM.focus(); + } } }, @@ -1403,7 +1404,7 @@ var ICEcoder = { winH = window.innerHeight; if (!top.ICEcoder.mouseDown) {top.ICEcoder.draggingFilesW = false}; - cursorName = (!ICEcoder.draggingTab && ((top.ICEcoder.mouseX > top.ICEcoder.filesW-7 && top.ICEcoder.mouseX < top.ICEcoder.filesW+7 && top.ICEcoder.mouseY > 40 && top.ICEcoder.mouseY < (winH-30)) || top.ICEcoder.draggingFilesW)) + cursorName = (!ICEcoder.draggingTab && ((top.ICEcoder.mouseX > top.ICEcoder.filesW-7 && top.ICEcoder.mouseX < top.ICEcoder.filesW+7) || top.ICEcoder.draggingFilesW)) ? "w-resize" : "auto"; if (top.ICEcoder.content.contentWindow.document && top.ICEcoder.filesFrame.contentWindow) { @@ -1433,26 +1434,28 @@ var ICEcoder = { var cM, string, rx, match, oldBlock, newBlock; cM = ICEcoder.getcMInstance(); - string = cM.getLine(cM.getCursor().line); - rx = /(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi; + if (cM) { + string = cM.getLine(cM.getCursor().line); + rx = /(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi; - while((match = rx.exec(string)) && cM.getCursor().ch > match.index+match[0].length); + while((match = rx.exec(string)) && cM.getCursor().ch > match.index+match[0].length); - oldBlock = top.get('content').contentWindow.document.getElementById('cssColor'); - if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; - if (top.ICEcoder.codeAssist && top.ICEcoder.caretLocType=="CSS") { - newBlock = top.document.createElement("div"); - newBlock.id = "cssColor"; - newBlock.style.position = "absolute"; - newBlock.style.display = "block"; - newBlock.style.width = newBlock.style.height = "20px"; - newBlock.style.zIndex = "1000"; - newBlock.style.background = match ? match[0] : ''; - newBlock.style.cursor = "pointer"; - newBlock.onclick = function() {top.ICEcoder.showColorPicker(match[0])}; - if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; - top.get('header').appendChild(newBlock); - cM.addWidget(cM.getCursor(), top.get('cssColor'), true); + oldBlock = top.get('content').contentWindow.document.getElementById('cssColor'); + if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)}; + if (top.ICEcoder.codeAssist && top.ICEcoder.caretLocType=="CSS") { + newBlock = top.document.createElement("div"); + newBlock.id = "cssColor"; + newBlock.style.position = "absolute"; + newBlock.style.display = "block"; + newBlock.style.width = newBlock.style.height = "20px"; + newBlock.style.zIndex = "1000"; + newBlock.style.background = match ? match[0] : ''; + newBlock.style.cursor = "pointer"; + newBlock.onclick = function() {top.ICEcoder.showColorPicker(match[0])}; + if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; + top.get('header').appendChild(newBlock); + cM.addWidget(cM.getCursor(), top.get('cssColor'), true); + } } }, @@ -1581,6 +1584,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); top.ICEcoder.codeAssist = !top.ICEcoder.codeAssist; + top.get('codeAssistDisplay').style.backgroundPosition = top.ICEcoder.codeAssist ? "0 0" : "-16px 0"; top.ICEcoder.cssColorPreview(); top.ICEcoder.focus();