From 9fa87c51419bcd6b68aa38df638d83097b5f2ce4 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Mon, 18 Mar 2013 17:10:12 +0000 Subject: [PATCH] Get rid of global, CSS & Voke URL tweak Create a new var - cursorTemp and reduce the amount of code used to set cursor position The left side of 1st nest tag should have a cursor: pointer styling Simplify and tweak the CTRL+i code to prefix voke.fm URLs with CSS or PHP --- lib/ice-coder.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index fc04f9e..1145444 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -284,7 +284,7 @@ var ICEcoder = { // Highlight or hide block upon roll over/out of nest positions highlightBlock: function(nestPos,hide) { - var cM, searchPos, cursor, startPos, endPos; + var cM, searchPos, cursor, cursorTemp, startPos, endPos; cM = top.ICEcoder.getcMInstance(); // Hiding the block @@ -310,12 +310,9 @@ var ICEcoder = { searchPos.ch = cursor.from().ch; searchPos.line = cursor.from().line; if (i==nestPos) { - cursorX = cM.getSearchCursor(">",searchPos); - cursorX.findNext(); - searchPosX = new Object(); - searchPosX.ch = cursorX.from().ch+1; - searchPosX.line = cursorX.from().line; - cM.setCursor(searchPosX); + cursorTemp = cM.getSearchCursor(">",searchPos); + cursorTemp.findNext(); + cM.setCursor(cursorTemp.from().line, cursorTemp.from().ch+1); top.ICEcoder.getNestLocation(); if (ICEcoder.htmlTagArray.length-1 != nestPos) { i++; @@ -1040,7 +1037,7 @@ var ICEcoder = { // Then for all the array items, output as the nest display for (var i=0;i'}; + if (i==0) {ICEcoder.nestDisplay.innerHTML += '
'}; ICEcoder.nestDisplay.innerHTML += ''+ICEcoder.htmlTagArray[i]+''; ICEcoder.nestDisplay.innerHTML += i' @@ -1981,12 +1978,12 @@ var ICEcoder = { // CTRL+I (Get info) } else if(key==73 && top.ICEcoder.ctrlKeyDown==true && area == "content") { - var searchPrefix = ""; + var searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" "; if (top.ICEcoder.caretLocType=="CSS"||top.ICEcoder.caretLocType=="PHP") { - window.open("http://voke.fm/"+top.ICEcoder.getcMInstance().getSelection()); + window.open("http://voke.fm/"+searchPrefix+top.ICEcoder.getcMInstance().getSelection()); } else { - if (top.ICEcoder.caretLocType!="Content") { - searchPrefix = top.ICEcoder.caretLocType.toLowerCase()+" "; + if (top.ICEcoder.caretLocType=="Content") { + searchPrefix = ""; } window.open("http://www.google.com/#output=search&q="+searchPrefix+top.ICEcoder.getcMInstance().getSelection()); }