Permalink
Browse files

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
  • Loading branch information...
1 parent dddf2e9 commit 9fa87c51419bcd6b68aa38df638d83097b5f2ce4 @mattpass committed Mar 18, 2013
Showing with 9 additions and 12 deletions.
  1. +9 −12 lib/ice-coder.js
View
@@ -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<ICEcoder.htmlTagArray.length;i++) {
events = 'onMouseover="top.ICEcoder.highlightBlock('+i+')" onMouseout="top.ICEcoder.highlightBlock('+i+',\'hide\')" onClick="top.ICEcoder.setPosition('+i+',top.ICEcoder.startPosLine,\''+ICEcoder.htmlTagArray[i]+'\')"';
- if (i==0) {ICEcoder.nestDisplay.innerHTML += '<div '+events+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'};
+ if (i==0) {ICEcoder.nestDisplay.innerHTML += '<div '+events+' style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); cursor: pointer"></div>'};
ICEcoder.nestDisplay.innerHTML += '<a '+events+' style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+ICEcoder.htmlTagArray[i]+'</a>';
ICEcoder.nestDisplay.innerHTML += i<ICEcoder.htmlTagArray.length-1
? '<div '+events+' style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0; cursor: pointer"></div>'
@@ -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());
}

0 comments on commit 9fa87c5

Please sign in to comment.