diff --git a/lib/ice-coder.js b/lib/ice-coder.js index d758c09..adfb4d6 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -5,7 +5,7 @@ var ICEcoder = { // ============== // Define settings - filesW: 250, // Initial width of the files pane + filesW: 250, // Width of the files pane minFilesW: 14, // Min width of the files pane maxFilesW: 250, // Max width of the files pane selectedTab: 0, // The tab that's currently selected @@ -13,7 +13,7 @@ var ICEcoder = { ctrlKeyDown: false, // Indicates if CTRL keydown altKeyDown: false, // Indicates if Alt keydown shiftKeyDown: false, // Indicates if Shift keydown - delKeyDown: false, // Indicates if DEL keydown + delKeyDown: false, // Indicates if Del keydown canSwitchTabs: true, // Stops switching of tabs when trying to close openFiles: [], // Array of open file URLs openFileMDTs: [], // Array of open file modification datetimes @@ -24,7 +24,6 @@ var ICEcoder = { lockedNav: true, // Nav is locked or not htmlTagArray: [], // Array storing the nest of tags codeAssist: true, // Assist user with their coding - snippetLine: false, // Line no of snippet, if shown mouseDown: false, // If the mouse is down or not draggingFilesW: false, // If we're dragging the file manager width or not draggingTab: false, // If we're dragging a tab @@ -224,7 +223,7 @@ var ICEcoder = { } }, - // Comment or uncomment line on keypress + // Comment/uncomment line or selected range on keypress lineCommentToggle: function() { var cM, cursorPos, linePos, lineContent, lCLen, adjustCursor, startLine, endLine; @@ -379,22 +378,23 @@ var ICEcoder = { // Open/close dirs on demand openCloseDir: function(dir,load) { + var node, d; + dir.onclick = function() {top.ICEcoder.openCloseDir(this,false)}; - var node = dir.parentNode; + node = dir.parentNode; if (node.nextSibling) {node = node.nextSibling}; + if (node && node.tagName=="UL") { + d = node.style.display=="none"; + d ? load = true : node.style.display = "none"; + dir.parentNode.className = dir.className = d ? "pft-directory dirOpen" : "pft-directory"; + } if (load) { top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/get-branch.php?location="+dir.childNodes[1].id; - } else if (node && node.tagName=="UL") { - var d = node.style.display=="none"; - if (d) { - top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href = "lib/get-branch.php?location="+dir.childNodes[1].id; - } else {node.style.display = "none"} - dir.parentNode.className=dir.className = d ? "pft-directory dirOpen" : "pft-directory"; } return false; }, - // Note which files or foldets we are over on mouseover/mouseout + // Note which files or folders we are over on mouseover/mouseout overFileFolder: function(type, link) { ICEcoder.thisFileFolderType=type; ICEcoder.thisFileFolderLink=link; @@ -495,7 +495,7 @@ var ICEcoder = { } }, - // Open a file on demand + // Open a file openFile: function(fileLink) { var shortURL, canOpenFile; @@ -541,7 +541,7 @@ var ICEcoder = { } }, - // Save a file on demand + // Save a file saveFile: function(saveAs) { var saveType; @@ -550,7 +550,7 @@ var ICEcoder = { top.ICEcoder.serverMessage('Saving
'+ICEcoder.openFiles[ICEcoder.selectedTab-1].replace(top.iceRoot,"")); }, - // Prompt a rename dialog on demand + // Prompt a rename dialog renameFile: function(oldName,newName) { var shortURL, fileName, i; @@ -580,12 +580,11 @@ var ICEcoder = { } }, - // Delete a file on demand + // Delete a file deleteFile: function() { var delFiles, selectedFilesList; delFiles = top.ICEcoder.ask('Delete:\n\n'+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+'?'); - // Upon supply a new name, rename tabs and update filename on server if (delFiles) { selectedFilesList = ""; for (var i=0;i0) @@ -1088,7 +1087,7 @@ var ICEcoder = { ]; }, - // Get the mouse position on demand + // Get the mouse position getMouseXY: function(e,area) { var tempX, tempY, scrollTop; @@ -1106,7 +1105,7 @@ var ICEcoder = { // Test if we need to show a drag cursor or not dragCursorTest: function() { - var winH, cursorName, diffX; + var winH, cursorName, diffX, zone; diffX = top.ICEcoder.mouseX - top.ICEcoder.diffStartX; if (top.ICEcoder.draggingTab!==false && top.ICEcoder.diffStartX && (diffX <= -10 || diffX >= 10)) { @@ -1125,8 +1124,8 @@ var ICEcoder = { : "auto"; if (top.ICEcoder.content.contentWindow.document && top.ICEcoder.filesFrame.contentWindow) { top.document.body.style.cursor = cursorName; - if (top.ICEcoder.content.contentWindow.document.body) {top.ICEcoder.content.contentWindow.document.body.style.cursor = cursorName}; - if (top.ICEcoder.filesFrame.contentWindow.document.body) {top.ICEcoder.filesFrame.contentWindow.document.body.style.cursor = cursorName}; + if (zone = top.ICEcoder.content.contentWindow.document.body) {zone.style.cursor = cursorName}; + if (zone = top.ICEcoder.filesFrame.contentWindow.document.body) {zone.style.cursor = cursorName}; } } }, @@ -1171,7 +1170,7 @@ var ICEcoder = { } }, - // Change opacity of the file manager icons on demand + // Change opacity of the file manager icons fMIconVis: function(icon, vis) { var i; @@ -1663,7 +1662,7 @@ var ICEcoder = { } // Highlight the selected tab after splicing the change state out of the array top.ICEcoder.changedContent.splice(closeTabNum-1,1); - top.parent.ICEcoder.redoTabHighlight(ICEcoder.selectedTab); + top.ICEcoder.redoTabHighlight(ICEcoder.selectedTab); // Update the nesting indicator top.ICEcoder.getNestLocation('update'); @@ -2011,10 +2010,6 @@ var ICEcoder = { addSnippet: function() { var cM, lineNo, whiteSpace, content; - if (top.ICEcoder.snippetLine!==false) { - top.ICEcoder.removeSnippet(); - } - cM = ICEcoder.getcMInstance(); lineNo = cM.getCursor().line; whiteSpace = cM.getLine(lineNo).length - cM.getLine(lineNo).replace(/^\s\s*/, '').length; @@ -2057,7 +2052,6 @@ var ICEcoder = { cM.setLine(lineNo, replacedLine.replace("CURSOR","")); cM.setCursor(lineNoCount,curPos); cM.focus(); - top.ICEcoder.removeSnippet(); } } }; \ No newline at end of file