mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 15:24:00 +01:00
Handle dragging files setting drag cursor
On drag over CM instance, call setDragCursor with event and 'editor' string Set ondragover function call upon this function too with folder/file string, same as when init'ing via get branch setDragCursor function added, handles cursor for dropping files editior, folder and file including if we have the CTRL key down or not
This commit is contained in:
@@ -478,6 +478,11 @@ var ICEcoder = {
|
||||
top.ICEcoder.mouseDownInCM = "editor";
|
||||
},
|
||||
|
||||
// On drag over
|
||||
cMonDragOver: function(thisCM,evt,cMinstance) {
|
||||
top.ICEcoder.setDragCursor(evt,'editor');
|
||||
},
|
||||
|
||||
// On render line
|
||||
cMonRenderLine: function(thisCM,cMinstance,line,element) {
|
||||
var paneMatch;
|
||||
@@ -1787,6 +1792,7 @@ var ICEcoder = {
|
||||
newLI.draggable = false;
|
||||
newLI.ondragstart = function(event) {top.ICEcoder.addDefaultDragData(this,event)};
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}};
|
||||
newLI.ondragover = function(event) {top.ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')};
|
||||
newLI.ondragend = function() {top.ICEcoder.dropFile(this)};
|
||||
newLI.innerHTML = innerLI
|
||||
locNest.nextSibling.appendChild(newLI);
|
||||
@@ -1809,6 +1815,7 @@ var ICEcoder = {
|
||||
newLI.draggable = false;
|
||||
newLI.ondragstart = function(event) {top.ICEcoder.addDefaultDragData(this,event)};
|
||||
newLI.ondrag = function(event) {top.ICEcoder.draggingWithKeyTest(event);if(top.ICEcoder.getcMInstance()){top.ICEcoder.editorFocusInstance.indexOf('diff') == -1 ? top.ICEcoder.getcMInstance().focus() : top.ICEcoder.getcMdiffInstance().focus()}};
|
||||
newLI.ondragover = function(event) {top.ICEcoder.setDragCursor(event,actionElemType=="folder" ? 'folder' : 'file')};
|
||||
newLI.ondragend = function() {top.ICEcoder.dropFile(this)};
|
||||
newLI.innerHTML = innerLI;
|
||||
// Append or insert depending on which of the above if statements is true
|
||||
@@ -1933,6 +1940,28 @@ var ICEcoder = {
|
||||
evt.dataTransfer.setData('Text', elem.id);
|
||||
},
|
||||
|
||||
// Set a copy, move or none drag cursor type
|
||||
setDragCursor: function(evt,dropType) {
|
||||
var cursorIcon;
|
||||
|
||||
// Prevent the default and establish if CTRL key is down
|
||||
evt.preventDefault();
|
||||
top.ICEcoder.draggingWithKeyTest(evt);
|
||||
// Establish the cursor to show
|
||||
cursorIcon =
|
||||
dropType == "editor"
|
||||
? top.ICEcoder.draggingWithKey == "CTRL"
|
||||
? "copy"
|
||||
: "link"
|
||||
: dropType == "folder"
|
||||
? top.ICEcoder.draggingWithKey == "CTRL"
|
||||
? "copy"
|
||||
: "move"
|
||||
: "none";
|
||||
|
||||
evt.dataTransfer.dropEffect = cursorIcon;
|
||||
},
|
||||
|
||||
// On dropping a file, do something
|
||||
dropFile: function(elem) {
|
||||
var filePath, tgtPath;
|
||||
|
||||
61
lib/ice-coder.min.js
vendored
61
lib/ice-coder.min.js
vendored
@@ -16,11 +16,11 @@ f,g;b=a.listSelections();for(var k=0;k<b.length;k++)if(e=a.getTokenAt(b[k].ancho
|
||||
top.ICEcoder.endTagReplaceData.push(e))}},cMonChange:function(a,b,c){var d,e,f;top.ICEcoder.loadingFile||top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);setTimeout(function(){top.ICEcoder.scrollBarVisible=a.getScrollInfo().height>a.getScrollInfo().clientHeight;top.ICEcoder.setLayout()},0);if(0<top.ICEcoder.endTagReplaceData.length)for(b=0;b<top.ICEcoder.endTagReplaceData.length;b++)d=top.ICEcoder.endTagReplaceData[b].split(";"),1*d[1].split(":")[0]!=c.from.line&&(d[1].split(":"),d[1].split(":"),
|
||||
d[1].split(":"),d[1].split(":"),d=a.getTokenAt(a.listSelections()[b].anchor),d=d.string,"<"==d&&(d=""));top.ICEcoder.endTagReplaceData=[];top.ICEcoder.getCaretPosition();top.ICEcoder.updateCharDisplay();top.ICEcoder.updateByteDisplay();top.ICEcoder.updateNestingIndicator();top.ICEcoder.findMode&&(top.ICEcoder.results.splice(top.ICEcoder.findResult,1),top.get("results").innerHTML=top.ICEcoder.results.length+" "+top.t.results,top.ICEcoder.findMode=!1);if(c=top.ICEcoder.openFiles[top.ICEcoder.selectedTab-
|
||||
1])e=c.substr(c.lastIndexOf("/")+1),f=e.substr(e.lastIndexOf(".")+1);top.ICEcoder.splitPane&&setTimeout(function(){top.ICEcoder.updateDiffs()},0);c&&top.ICEcoder.previewWindow.location&&"/[NEW]"!=c&&top.ICEcoder.updatePreviewWindow(a,c,e,f);top.ICEcoder.indicateChanges()},cMonScroll:function(a,b){var c,d,e;top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1;top.ICEcoder.splitPane&&(c=top.ICEcoder.getcMInstance(),d=top.ICEcoder.getcMdiffInstance(),e=-1<b.indexOf("diff")?c:d,setTimeout(function(){e.scrollTo(a.getScrollInfo().left,
|
||||
a.getScrollInfo().top)},0))},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&(a.state.completionActive||top.ICEcoder.autocomplete())},cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},cMonMouseDown:function(a,b){top.ICEcoder.mouseDownInCM="editor"},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&
|
||||
-1<b.indexOf("diff"))e=!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},updateDiffs:function(){var a,b,c,d,e,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=a?difflib.stringAsLines(a.getValue()):"";d=b?difflib.stringAsLines(b.getValue()):"";c=(new difflib.SequenceMatcher(c,d)).get_opcodes();if(a){e=a.getAllMarks();
|
||||
for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",f+"px"]);for(e=0;e<c[d][2]-
|
||||
c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],ch:0},
|
||||
{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());
|
||||
a.getScrollInfo().top)},0))},cMonInputRead:function(a,b){"keypress"==top.ICEcoder.autoComplete&&top.ICEcoder.codeAssist&&(a.state.completionActive||top.ICEcoder.autocomplete())},cMonGutterClick:function(a,b,c,d,e){top.ICEcoder.mouseDownInCM="gutter"},cMonMouseDown:function(a,b){top.ICEcoder.mouseDownInCM="editor"},cMonDragOver:function(a,b,c){top.ICEcoder.setDragCursor(b,"editor")},cMonRenderLine:function(a,b,c,d){for(var e,f=0;f<top.ICEcoder.renderLineStyle.length;f++){e=!1;if("diff"!=top.ICEcoder.renderLineStyle[f][0]&&
|
||||
-1==b.indexOf("diff")||"diff"==top.ICEcoder.renderLineStyle[f][0]&&-1<b.indexOf("diff"))e=!0;e&&a.lineInfo(c).line+1==top.ICEcoder.renderLineStyle[f][1]&&(d.style[top.ICEcoder.renderLineStyle[f][2]]=top.ICEcoder.renderLineStyle[f][3])}},updateDiffs:function(){var a,b,c,d,e,f;top.ICEcoder.renderLineStyle=[];top.ICEcoder.renderPaneShiftAmount=0;a=top.ICEcoder.getcMInstance();b=top.ICEcoder.getcMdiffInstance();c=a?difflib.stringAsLines(a.getValue()):"";d=b?difflib.stringAsLines(b.getValue()):"";c=(new difflib.SequenceMatcher(c,
|
||||
d)).get_opcodes();if(a){e=a.getAllMarks();for(d=0;d<e.length;d++)e[d].clear();e=b.getAllMarks();for(d=0;d<e.length;d++)e[d].clear()}if(a&&""!=b.getValue())for(d=0;d<c.length;d++)if("equal"!==c[d][0]){if("replace"==c[d][0]){f=(c[d][4]-c[d][2]+1+top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)b.getLineHandle(e).height>a.defaultTextHeight()&&(f+=b.getLineHandle(e).height-a.defaultTextHeight());f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["main",
|
||||
c[d][2],"height",f+"px"]);for(e=0;e<c[d][2]-c[d][1];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),a.markText({line:c[d][1]+e,ch:0},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{className:"diffGreyLighter"}),a.markText({line:c[d][1]+e,ch:f[0]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:f[0]+f[1]},{className:"diffGrey"}),a.markText({line:c[d][1]+e,ch:f[0]+f[1]},{line:c[d][3]+e+top.ICEcoder.renderPaneShiftAmount,ch:1E6},{className:"diffGreyLighter"})}else a.markText({line:c[d][1],
|
||||
ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffGreen"});"replace"!=c[d][0]&&c[d][1]==c[d][2]&&(top.ICEcoder.renderLineStyle.push(["main",c[d][2],"height",(c[d][4]-c[d][3]+1)*a.defaultTextHeight()+"px"]),a.markText({line:c[d][2]-1,ch:0},{line:c[d][2]-1,ch:1E6},{className:"diffNone"}));if("replace"==c[d][0]){f=(c[d][2]-c[d][4]+1-top.ICEcoder.renderPaneShiftAmount)*a.defaultTextHeight();for(e=c[d][4]-1;e<=c[d][2]-1;e++)a.getLineHandle(e).height>a.defaultTextHeight()&&(f+=a.getLineHandle(e).height-a.defaultTextHeight());
|
||||
f>a.defaultTextHeight()&&top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",f+"px"]);for(e=0;e<c[d][4]-c[d][3];e++)f=top.ICEcoder.findStringDiffs(a.getLine(c[d][1]+e),b.getLine(c[d][3]+e)),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:0},{line:c[d][3]+e,ch:f[0]},{className:"diffGreyLighter"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,ch:f[0]},{line:c[d][3]+e,ch:f[0]+f[2]},{className:"diffGrey"}),b.markText({line:c[d][1]+e-top.ICEcoder.renderPaneShiftAmount,
|
||||
ch:f[0]+f[2]},{line:c[d][3]+e,ch:1E6},{className:"diffGreyLighter"})}else b.markText({line:c[d][3],ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffRed"});"replace"!=c[d][0]&&c[d][3]==c[d][4]&&(top.ICEcoder.renderLineStyle.push(["diff",c[d][4],"height",(c[d][2]-c[d][1]+1)*a.defaultTextHeight()+"px"]),b.markText({line:c[d][4]-1,ch:0},{line:c[d][4]-1,ch:1E6},{className:"diffNone"}));top.ICEcoder.renderPaneShiftAmount=c[d][2]-c[d][4]}},findStringDiffs:function(a,b){"undefined"==typeof a&&(a="");"undefined"==
|
||||
typeof b&&(b="");for(var c=0,d=a.length,e=b.length;a[c]&&a[c]==b[c];c++);for(;d>c&e>c&a[d-1]==b[e-1];d--)e--;return[c,d-c,e-c]},updatePreviewWindow:function(a,b,c,d){top.ICEcoder.previewWindow.location.pathname==b?-1<["htm","html","txt"].indexOf(d)?top.ICEcoder.previewWindow.document.documentElement.innerHTML=a.getValue():-1<["md"].indexOf(d)&&(top.ICEcoder.previewWindow.document.documentElement.innerHTML=mmd(a.getValue())):-1<["css"].indexOf(d)&&-1<top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(c)&&
|
||||
@@ -75,31 +75,32 @@ a.replace(/\+/g,"%2B"))},showMenu:function(a){var b,c;0!=top.ICEcoder.selectedFi
|
||||
"|")+"|"+c)){k="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?top.ICEcoder.newFilePerms:top.ICEcoder.newDirPerms;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));m=h.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="parentNode.draggable=true;top.ICEcoder.overFileFolder(\''+
|
||||
g+"',this.childNodes[1].id)\" onMouseOut=\"parentNode.draggable=false;top.ICEcoder.overFileFolder('"+g+"','')\" "+("folder"==g?"ondragover=\"if(parentNode.nextSibling && parentNode.nextSibling.tagName != 'UL' && top.ICEcoder.thisFileFolderLink != this.childNodes[1].id) {top.ICEcoder.openCloseDir(this,true);}\"":"")+' onClick="if(!event.ctrlKey && !top.ICEcoder.cmdKey) {'+("folder"==g?"top.ICEcoder.openCloseDir(this,"+("folder"==g?"true":"false")+");":"")+' if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}" style="position: relative; left:-22px"> <span id="'+
|
||||
b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="'+n+'; font-size: 8px" id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(!m||3>m.childNodes.length)l=document.createElement("ul"),m=h.parentNode.parentNode,m.parentNode.insertBefore(l,m.nextSibling),l=document.createElement("li"),l.className=k,l.draggable=!1,l.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)},l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&
|
||||
(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},l.ondragend=function(){top.ICEcoder.dropFile(this)},l.innerHTML=n,m.nextSibling.appendChild(l),m.nextSibling.appendChild(p);else for(h=0;h<m.childNodes.length;h++)if(m.childNodes[h].className&&(l=0<m.childNodes[h].className.indexOf("directory")?"folder":"file",q=m.childNodes[h].getElementsByTagName("span")[0].innerHTML,l==g&&q>c||"folder"==g&&"file"==l||h==m.childNodes.length-
|
||||
1)){l=document.createElement("li");l.className=k;l.draggable=!1;l.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};l.ondragend=function(){top.ICEcoder.dropFile(this)};l.innerHTML=n;h==m.childNodes.length-1?(m.appendChild(l),m.appendChild(p)):(m.insertBefore(l,m.childNodes[h]),
|
||||
m.insertBefore(p,m.childNodes[h+1]));break}"file"!=g||f||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),h=top.get("filesFrame").contentWindow.document.getElementById(f),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(f+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",top.ICEcoder.renameInChildren(h,e,b,c));"move"==a&&(top.ICEcoder.updateFileManagerList("add",
|
||||
b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",e.substr(0,e.lastIndexOf("/")),c));"chmod"==a&&(f=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=top.get("filesFrame").contentWindow.document.getElementById(f.replace(/\//g,"|")+"_perms"),h.style.background=777==d?"#800":"none",h.style.color=777==d?"#eee":"#888",h.innerHTML=d);"delete"==a&&(b||(b=""),b=b.replace(top.iceRoot,"/"),b=b.replace("//","/"),b=b.replace(/\/$/,"").replace(/\//g,"|"),h=(b+"|"+
|
||||
c).replace("||","|"),h=top.get("filesFrame").contentWindow.document.getElementById(h).parentNode.parentNode,top.ICEcoder.openCloseDir(h.childNodes[0],!1),h.parentNode.removeChild(h))},renameInChildren:function(a,b,c,d){var e,f;if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;for(var g=0;g<a.childNodes.length;g++)"LI"==a.childNodes[g].nodeName&&(e=a.childNodes[g].childNodes[0].childNodes[1],e.id=e.id.replace(b.replace(/\//g,
|
||||
"|"),c.replace(/\//g,"|")+"|"+d),e.parentNode.title=e.id.replace(/\|/g,"/"),f=top.get("filesFrame").contentWindow.document.getElementById(e.id).nextSibling.nextSibling,f.id=e.id+"_perms",top.ICEcoder.renameInChildren(e,b,c,d))}},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.contentWindow.location.reload(!0);top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",
|
||||
top.get("loadingMask"))}},draggingWithKeyTest:function(a){var b;b=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(224==b||91==b||93==b)top.ICEcoder.cmdKey=!0;top.ICEcoder.draggingWithKey=a.ctrlKey||top.ICEcoder.cmdKey?"CTRL":!1},addDefaultDragData:function(a,b){b.dataTransfer.setData("Text",a.id)},dropFile:function(a){var b,c;b=a.childNodes[0].childNodes[1].id.replace(/\|/g,"/");fileName=b.substr(b.lastIndexOf("/")+1);"editor"==top.ICEcoder.area&&top.ICEcoder.pasteURL(b);"files"==top.ICEcoder.area&&
|
||||
setTimeout(function(){c="folder"==ICEcoder.thisFileFolderType?ICEcoder.thisFileFolderLink:ICEcoder.thisFileFolderLink.substr(0,ICEcoder.thisFileFolderLink.lastIndexOf("|"));"CTRL"==top.ICEcoder.draggingWithKey?(top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles),top.ICEcoder.pasteFiles(c)):top.ICEcoder.moveFile(b,c.replace(/\|/g,"/")+"/"+fileName)},4);top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1},findReplaceOptions:function(){top.get("rText").style.display=top.get("replace").style.display=
|
||||
top.get("rTarget").style.display=document.findAndReplace.connector.value==top.t.and?"inline-block":"none"},findReplace:function(a,b,c,d,e){var f,g,k;if(d)top.get("find").value=top.get("find").value,top.ICEcoder.focus();else{"undefined"==typeof e&&(e=!1);a=a.toLowerCase();f=top.get("replace").value;g=top.get("results");d=ICEcoder.getcMInstance();k=ICEcoder.getcMdiffInstance();if((d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?k:d)&&0<a.length&&document.findAndReplace.target.value==top.t["this document"]){d.getValue().toLowerCase();
|
||||
document.findAndReplace.connector.value==top.t.and&&c&&(document.findAndReplace.replaceAction.value==top.t.replace&&d.getSelection().toLowerCase()==a?d.replaceSelection(f,"around"):document.findAndReplace.replaceAction.value==top.t["replace all"]&&(c=new RegExp(a,"gi"),d.setValue(d.getValue().replace(c,f))));c=d.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];ICEcoder.resultsLines=[];for(f=0;f<c.length;f++)c.substr(f,a.length)==a&&-1==ICEcoder.results.indexOf(f)&&
|
||||
(ICEcoder.results.push(f),-1==ICEcoder.resultsLines.indexOf(d.posFromIndex(f).line+1)&&ICEcoder.resultsLines.push(d.posFromIndex(f).line+1));ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)g.innerHTML=ICEcoder.results.length+" results";else{if(e)for(ICEcoder.findResult="undefined"==typeof ICEcoder.findResult?ICEcoder.results.length+1:ICEcoder.results.length,f=ICEcoder.results.length-1;0<=f;f--)ICEcoder.results[f]>d.indexFromPos({ch:d.getCursor().ch-1,line:d.getCursor().line})&&ICEcoder.findResult--;
|
||||
else for(f=ICEcoder.findResult=0;f<ICEcoder.results.length;f++)ICEcoder.results[f]<d.indexFromPos({ch:d.getCursor().ch+1,line:d.getCursor().line})&&ICEcoder.findResult++;!e&&ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);e&&1==ICEcoder.findResult&&(ICEcoder.findResult=ICEcoder.results.length+1);g.innerHTML="Highlighted result "+(ICEcoder.findResult+(e?-1:1))+" of "+ICEcoder.results.length+" results";e?(b=d.getSearchCursor(a,{ch:d.getCursor().ch-1,line:d.getCursor().line},!0),
|
||||
b.findPrevious(),b.from()||(b=d.getSearchCursor(a,{line:1E6,ch:1E6},!0),b.findPrevious())):(b=d.getSearchCursor(a,{ch:d.getCursor().ch+1,line:d.getCursor().line},!0),b.findNext(),b.from()||(b=d.getSearchCursor(a,{line:0,ch:0},!0),b.findNext()));d.setSelection(b.from(),b.to());top.ICEcoder.focus();top.ICEcoder.findMode=!0}a=top.ICEcoder.scrollBarVisible?parseInt(top.ICEcoder.content.style.height,10)/d.lineCount():d.defaultTextHeight();b=top.ICEcoder.scrollBarVisible?0:d.heightAtLine(0);e="";for(f=
|
||||
1;f<=d.lineCount();f++)g=-1<ICEcoder.resultsLines.indexOf(f)?d.getCursor().line+1==f?"#b00":"#888":"transparent",e+='<div style="position: absolute; display: block; width: 5px; height:'+a+"px; background: "+g+"; top: "+parseInt(a*(f-1)+b,10)+'px"></div>';top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=e;top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}g.innerHTML="No results";top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=
|
||||
"";top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none";return!1}""!=a&&c?(e=b=d="",document.findAndReplace.connector.value==top.t.and&&(d="&replace="+f),0<=document.findAndReplace.target.value.indexOf(top.t.file)&&(b="&target="+document.findAndReplace.target.value.replace(/ /g,"-")),document.findAndReplace.target.value==top.t["selected files"]&&(e="&selectedFiles="+top.ICEcoder.selectedFiles.join(":")),a=a.replace(/\'/g,"'"),a!=encodeURIComponent(a)?a=
|
||||
"ICEcoder:"+encodeURIComponent(a):a,top.ICEcoder.showHide("show",top.get("loadingMask")),top.get("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+a+d+b+e+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'):(g.innerHTML="No results",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none")}},replaceInFile:function(a,
|
||||
b,c){top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=replaceText&find="+b+"&replace="+c+"&csrf="+top.ICEcoder.csrf,a.replace(/\//g,"|").replace(/\+/g,"%2B"));top.ICEcoder.serverMessage("<b>"+top.t["Replacing text in"]+"</b><br>"+a)},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().line;c=a.getCursor().ch;for(var e=d=0;e<b;e++)d+=a.getLine(e).length+1;ICEcoder.caretPos=
|
||||
d+c-1},updateCharDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateVersionsDisplay:function(){var a=top.ICEcoder.openFileVersions[ICEcoder.selectedTab-1];get("versionsDisplay").innerHTML="undefined"!=typeof a?top.ICEcoder.openFileVersions[ICEcoder.selectedTab-
|
||||
1]+" backup"+(1!=a?"s":""):""},updateByteDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.byteDisplay.innerHTML=a.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display="byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},showHide:function(a,b){b.style.visibility=
|
||||
"show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow[isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1]]},getcMdiffInstance:function(a){return top.ICEcoder.content.contentWindow[(isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1])+"diff"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=
|
||||
a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:a.clientY+document.body.scrollTop;top.ICEcoder.area=b;"top"!=b&&(top.ICEcoder.mouseY+=70);"editor"==b&&(top.ICEcoder.mouseX+=top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-top.ICEcoder.diffStartX;!1!==top.ICEcoder.draggingTab&&top.ICEcoder.diffStartX&&(-10>=a||10<=a)&&top.ICEcoder.mouseX>parseInt(top.ICEcoder.files.style.width,
|
||||
10)&&(top.ICEcoder.tabDragMouseX=top.ICEcoder.mouseX-parseInt(top.ICEcoder.files.style.width,10)-top.ICEcoder.tabDragMouseXStart,top.ICEcoder.tabDragMove());if(top.ICEcoder.ready&&(top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=
|
||||
a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=a}},serverMessage:function(a){var b;b=top.get("serverMessage");a?(b.innerHTML=top.ICEcoder.xssClean(a).replace(/\<b\>/g,"<b>").replace(/\<\/b\>/g,"</b>").replace(/\<br\>/g,"<br>"),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=
|
||||
ICEcoder.getcMdiffInstance();if(a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a){b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",
|
||||
b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))}},showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert >" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert >" class="insertColorValue">';
|
||||
(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},l.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")},l.ondragend=function(){top.ICEcoder.dropFile(this)},l.innerHTML=n,m.nextSibling.appendChild(l),m.nextSibling.appendChild(p);else for(h=0;h<m.childNodes.length;h++)if(m.childNodes[h].className&&(l=0<m.childNodes[h].className.indexOf("directory")?"folder":"file",q=m.childNodes[h].getElementsByTagName("span")[0].innerHTML,
|
||||
l==g&&q>c||"folder"==g&&"file"==l||h==m.childNodes.length-1)){l=document.createElement("li");l.className=k;l.draggable=!1;l.ondragstart=function(a){top.ICEcoder.addDefaultDragData(this,a)};l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};l.ondragover=function(a){top.ICEcoder.setDragCursor(a,"folder"==g?"folder":"file")};l.ondragend=
|
||||
function(){top.ICEcoder.dropFile(this)};l.innerHTML=n;h==m.childNodes.length-1?(m.appendChild(l),m.appendChild(p)):(m.insertBefore(l,m.childNodes[h]),m.insertBefore(p,m.childNodes[h+1]));break}"file"!=g||f||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),h=top.get("filesFrame").contentWindow.document.getElementById(f),h.innerHTML=c,h.id=b.replace(/\//g,"|")+"|"+c,h.parentNode.title=h.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(f+
|
||||
"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",top.ICEcoder.renameInChildren(h,e,b,c));"move"==a&&(top.ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",e.substr(0,e.lastIndexOf("/")),c));"chmod"==a&&(f=top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-1].replace(/\|/g,"/"),h=top.get("filesFrame").contentWindow.document.getElementById(f.replace(/\//g,"|")+"_perms"),h.style.background=777==d?"#800":"none",h.style.color=777==
|
||||
d?"#eee":"#888",h.innerHTML=d);"delete"==a&&(b||(b=""),b=b.replace(top.iceRoot,"/"),b=b.replace("//","/"),b=b.replace(/\/$/,"").replace(/\//g,"|"),h=(b+"|"+c).replace("||","|"),h=top.get("filesFrame").contentWindow.document.getElementById(h).parentNode.parentNode,top.ICEcoder.openCloseDir(h.childNodes[0],!1),h.parentNode.removeChild(h))},renameInChildren:function(a,b,c,d){var e,f;if(a.parentNode.parentNode.nextSibling&&"UL"==a.parentNode.parentNode.nextSibling.nodeName){a=a.parentNode.parentNode.nextSibling;
|
||||
for(var g=0;g<a.childNodes.length;g++)"LI"==a.childNodes[g].nodeName&&(e=a.childNodes[g].childNodes[0].childNodes[1],e.id=e.id.replace(b.replace(/\//g,"|"),c.replace(/\//g,"|")+"|"+d),e.parentNode.title=e.id.replace(/\|/g,"/"),f=top.get("filesFrame").contentWindow.document.getElementById(e.id).nextSibling.nextSibling,f.id=e.id+"_perms",top.ICEcoder.renameInChildren(e,b,c,d))}},refreshFileManager:function(){top.ICEcoder.showHide("show",top.get("loadingMask"));top.ICEcoder.filesFrame.contentWindow.location.reload(!0);
|
||||
top.ICEcoder.filesFrame.style.opacity="0";top.ICEcoder.filesFrame.onload=function(){top.ICEcoder.filesFrame.style.opacity="1";top.ICEcoder.showHide("hide",top.get("loadingMask"))}},draggingWithKeyTest:function(a){var b;b=a.keyCode?a.keyCode:a.which?a.which:a.charCode;if(224==b||91==b||93==b)top.ICEcoder.cmdKey=!0;top.ICEcoder.draggingWithKey=a.ctrlKey||top.ICEcoder.cmdKey?"CTRL":!1},addDefaultDragData:function(a,b){b.dataTransfer.setData("Text",a.id)},setDragCursor:function(a,b){a.preventDefault();
|
||||
top.ICEcoder.draggingWithKeyTest(a);a.dataTransfer.dropEffect="editor"==b?"CTRL"==top.ICEcoder.draggingWithKey?"copy":"link":"folder"==b?"CTRL"==top.ICEcoder.draggingWithKey?"copy":"move":"none"},dropFile:function(a){var b,c;b=a.childNodes[0].childNodes[1].id.replace(/\|/g,"/");fileName=b.substr(b.lastIndexOf("/")+1);"editor"==top.ICEcoder.area&&top.ICEcoder.pasteURL(b);"files"==top.ICEcoder.area&&setTimeout(function(){c="folder"==ICEcoder.thisFileFolderType?ICEcoder.thisFileFolderLink:ICEcoder.thisFileFolderLink.substr(0,
|
||||
ICEcoder.thisFileFolderLink.lastIndexOf("|"));"CTRL"==top.ICEcoder.draggingWithKey?(top.ICEcoder.copyFiles(top.ICEcoder.selectedFiles),top.ICEcoder.pasteFiles(c)):top.ICEcoder.moveFile(b,c.replace(/\|/g,"/")+"/"+fileName)},4);top.ICEcoder.mouseDown=!1;top.ICEcoder.mouseDownInCM=!1},findReplaceOptions:function(){top.get("rText").style.display=top.get("replace").style.display=top.get("rTarget").style.display=document.findAndReplace.connector.value==top.t.and?"inline-block":"none"},findReplace:function(a,
|
||||
b,c,d,e){var f,g,k;if(d)top.get("find").value=top.get("find").value,top.ICEcoder.focus();else{"undefined"==typeof e&&(e=!1);a=a.toLowerCase();f=top.get("replace").value;g=top.get("results");d=ICEcoder.getcMInstance();k=ICEcoder.getcMdiffInstance();if((d=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?k:d)&&0<a.length&&document.findAndReplace.target.value==top.t["this document"]){d.getValue().toLowerCase();document.findAndReplace.connector.value==top.t.and&&c&&(document.findAndReplace.replaceAction.value==
|
||||
top.t.replace&&d.getSelection().toLowerCase()==a?d.replaceSelection(f,"around"):document.findAndReplace.replaceAction.value==top.t["replace all"]&&(c=new RegExp(a,"gi"),d.setValue(d.getValue().replace(c,f))));c=d.getValue().toLowerCase();if(!top.ICEcoder.findMode||a!=top.ICEcoder.lastsearch){ICEcoder.results=[];ICEcoder.resultsLines=[];for(f=0;f<c.length;f++)c.substr(f,a.length)==a&&-1==ICEcoder.results.indexOf(f)&&(ICEcoder.results.push(f),-1==ICEcoder.resultsLines.indexOf(d.posFromIndex(f).line+
|
||||
1)&&ICEcoder.resultsLines.push(d.posFromIndex(f).line+1));ICEcoder.lastsearch=a}if(0<ICEcoder.results.length){if(b)g.innerHTML=ICEcoder.results.length+" results";else{if(e)for(ICEcoder.findResult="undefined"==typeof ICEcoder.findResult?ICEcoder.results.length+1:ICEcoder.results.length,f=ICEcoder.results.length-1;0<=f;f--)ICEcoder.results[f]>d.indexFromPos({ch:d.getCursor().ch-1,line:d.getCursor().line})&&ICEcoder.findResult--;else for(f=ICEcoder.findResult=0;f<ICEcoder.results.length;f++)ICEcoder.results[f]<
|
||||
d.indexFromPos({ch:d.getCursor().ch+1,line:d.getCursor().line})&&ICEcoder.findResult++;!e&&ICEcoder.findResult>ICEcoder.results.length-1&&(ICEcoder.findResult=0);e&&1==ICEcoder.findResult&&(ICEcoder.findResult=ICEcoder.results.length+1);g.innerHTML="Highlighted result "+(ICEcoder.findResult+(e?-1:1))+" of "+ICEcoder.results.length+" results";e?(b=d.getSearchCursor(a,{ch:d.getCursor().ch-1,line:d.getCursor().line},!0),b.findPrevious(),b.from()||(b=d.getSearchCursor(a,{line:1E6,ch:1E6},!0),b.findPrevious())):
|
||||
(b=d.getSearchCursor(a,{ch:d.getCursor().ch+1,line:d.getCursor().line},!0),b.findNext(),b.from()||(b=d.getSearchCursor(a,{line:0,ch:0},!0),b.findNext()));d.setSelection(b.from(),b.to());top.ICEcoder.focus();top.ICEcoder.findMode=!0}a=top.ICEcoder.scrollBarVisible?parseInt(top.ICEcoder.content.style.height,10)/d.lineCount():d.defaultTextHeight();b=top.ICEcoder.scrollBarVisible?0:d.heightAtLine(0);e="";for(f=1;f<=d.lineCount();f++)g=-1<ICEcoder.resultsLines.indexOf(f)?d.getCursor().line+1==f?"#b00":
|
||||
"#888":"transparent",e+='<div style="position: absolute; display: block; width: 5px; height:'+a+"px; background: "+g+"; top: "+parseInt(a*(f-1)+b,10)+'px"></div>';top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML=e;top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="inline-block";return!0}g.innerHTML="No results";top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="";top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display=
|
||||
"none";return!1}""!=a&&c?(e=b=d="",document.findAndReplace.connector.value==top.t.and&&(d="&replace="+f),0<=document.findAndReplace.target.value.indexOf(top.t.file)&&(b="&target="+document.findAndReplace.target.value.replace(/ /g,"-")),document.findAndReplace.target.value==top.t["selected files"]&&(e="&selectedFiles="+top.ICEcoder.selectedFiles.join(":")),a=a.replace(/\'/g,"'"),a!=encodeURIComponent(a)?a="ICEcoder:"+encodeURIComponent(a):a,top.ICEcoder.showHide("show",top.get("loadingMask")),
|
||||
top.get("mediaContainer").innerHTML='<iframe src="lib/multiple-results.php?find='+a+d+b+e+"&csrf="+top.ICEcoder.csrf+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>'):(g.innerHTML="No results",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").innerHTML="",top.ICEcoder.content.contentWindow.document.getElementById("resultsBar").style.display="none")}},replaceInFile:function(a,b,c){top.ICEcoder.serverQueue("add","lib/file-control-xhr.php?action=replaceText&find="+
|
||||
b+"&replace="+c+"&csrf="+top.ICEcoder.csrf,a.replace(/\//g,"|").replace(/\+/g,"%2B"));top.ICEcoder.serverMessage("<b>"+top.t["Replacing text in"]+"</b><br>"+a)},getCaretPosition:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;b=a.getCursor().line;c=a.getCursor().ch;for(var e=d=0;e<b;e++)d+=a.getLine(e).length+1;ICEcoder.caretPos=d+c-1},updateCharDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();
|
||||
a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.caretLocationType();ICEcoder.charDisplay.innerHTML=ICEcoder.caretLocType+", Line: "+(a.getCursor().line+1)+", Char: "+a.getCursor().ch},updateVersionsDisplay:function(){var a=top.ICEcoder.openFileVersions[ICEcoder.selectedTab-1];get("versionsDisplay").innerHTML="undefined"!=typeof a?top.ICEcoder.openFileVersions[ICEcoder.selectedTab-1]+" backup"+(1!=a?"s":""):""},updateByteDisplay:function(){var a,b;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();
|
||||
a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a;ICEcoder.byteDisplay.innerHTML=a.getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" bytes"},showDisplay:function(a){top.ICEcoder.byteDisplay.style.display="byte"==a?"inline-block":"none";top.ICEcoder.charDisplay.style.display="char"==a?"inline-block":"none"},showHide:function(a,b){b.style.visibility="show"==a?"visible":"hidden"},getcMInstance:function(a){return top.ICEcoder.content.contentWindow[isNaN(a)?"new"==a||"new"!=a&&
|
||||
0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1]]},getcMdiffInstance:function(a){return top.ICEcoder.content.contentWindow[(isNaN(a)?"new"==a||"new"!=a&&0<ICEcoder.openFiles.length?"cM"+ICEcoder.cMInstances[ICEcoder.selectedTab-1]:"cM1":"cM"+ICEcoder.cMInstances[a-1])+"diff"]},getMouseXY:function(a,b){top.ICEcoder.mouseX=a.pageX?a.pageX:a.clientX+document.body.scrollLeft;top.ICEcoder.mouseY=a.pageY?a.pageY:a.clientY+document.body.scrollTop;
|
||||
top.ICEcoder.area=b;"top"!=b&&(top.ICEcoder.mouseY+=70);"editor"==b&&(top.ICEcoder.mouseX+=top.ICEcoder.filesW);top.ICEcoder.dragCursorTest();62<top.ICEcoder.mouseY&&top.ICEcoder.setTabWidths()},dragCursorTest:function(){var a,b;a=top.ICEcoder.mouseX-top.ICEcoder.diffStartX;!1!==top.ICEcoder.draggingTab&&top.ICEcoder.diffStartX&&(-10>=a||10<=a)&&top.ICEcoder.mouseX>parseInt(top.ICEcoder.files.style.width,10)&&(top.ICEcoder.tabDragMouseX=top.ICEcoder.mouseX-parseInt(top.ICEcoder.files.style.width,
|
||||
10)-top.ICEcoder.tabDragMouseXStart,top.ICEcoder.tabDragMove());if(top.ICEcoder.ready&&(top.ICEcoder.mouseDown||(top.ICEcoder.draggingFilesW=!1),a=!ICEcoder.draggingTab&&(top.ICEcoder.mouseX>top.ICEcoder.filesW-7&&top.ICEcoder.mouseX<top.ICEcoder.filesW+7||top.ICEcoder.draggingFilesW)?"w-resize":"auto",top.ICEcoder.content.contentWindow.document&&top.ICEcoder.filesFrame.contentWindow)){top.document.body.style.cursor=a;if(b=top.ICEcoder.content.contentWindow.document.body)b.style.cursor=a;if(b=top.ICEcoder.filesFrame.contentWindow.document.body)b.style.cursor=
|
||||
a}},serverMessage:function(a){var b;b=top.get("serverMessage");a?(b.innerHTML=top.ICEcoder.xssClean(a).replace(/\<b\>/g,"<b>").replace(/\<\/b\>/g,"</b>").replace(/\<br\>/g,"<br>"),b.style.left="0"):setTimeout(function(){b.style.left="2000px"},200);b.style.opacity=a?1:0},cssColorPreview:function(){var a,b,c,d;a=ICEcoder.getcMInstance();b=ICEcoder.getcMdiffInstance();if(a=-1<top.ICEcoder.editorFocusInstance.indexOf("diff")?b:a){b=a.getLine(a.getCursor().line);for(c=/(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi;(d=
|
||||
c.exec(b))&&a.getCursor().ch>d.index+d[0].length;);(b=top.get("content").contentWindow.document.getElementById("cssColor"))&&b.parentNode.removeChild(b);top.ICEcoder.codeAssist&&"CSS"==top.ICEcoder.caretLocType&&(b=top.document.createElement("div"),b.id="cssColor",b.style.position="absolute",b.style.display="block",b.style.width=b.style.height="20px",b.style.zIndex="1000",b.style.background=d?d[0]:"",b.style.cursor="pointer",b.onclick=function(){top.ICEcoder.showColorPicker(d[0])},""==b.style.backgroundColor&&
|
||||
(b.style.display="none"),top.get("header").appendChild(b),a.addWidget(a.getCursor(),top.get("cssColor"),!0))}},showColorPicker:function(a){top.get("blackMask").style.visibility="visible";top.get("mediaContainer").innerHTML='<div id="picker" class="picker"></div><br><br><input type="text" id="color" name="color" value="#000" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'color\').value)" value="insert >" class="insertColorValue"><br><input type="text" id="colorRGB" name="colorRGB" value="rgb(0,0,0)" class="colorValue"><input type="button" onClick="top.ICEcoder.insertColorValue(top.get(\'colorRGB\').value)" value="insert >" class="insertColorValue">';
|
||||
farbtastic("picker","color");a&&top.get("picker").farbtastic.setColor(a)},initCanvasImage:function(a){var b,c;b=top.get("canvasPicker").getContext("2d");c=new Image;c.crossOrigin="Anonymous";c.src=a.src;c.onload=function(){top.get("canvasPicker").width=a.width;top.get("canvasPicker").height=a.height;b.drawImage(c,0,0,a.width,a.height)};top.document.getElementById("floatingContainer").style.backgroundSize=5*a.naturalWidth+"px "+5*a.naturalHeight+"px"},interactCanvasImage:function(a){var b,c,d,e,f,
|
||||
g,k,h,m,p,n,l,q;b=top.get("canvasPicker").getContext("2d");top.get("canvasPicker").onmousemove=function(u){c=u.pageX-this.offsetLeft;d=u.pageY-this.offsetTop;e=b.getImageData(c,d,1,1).data;f=e[0];g=e[1];k=e[2];h=f+","+g+","+k;m=top.ICEcoder.rgbToHex(f,g,k);top.get("rgbMouseXY").value=h;top.get("hexMouseXY").value="#"+m;top.get("hexMouseXY").style.backgroundColor=top.get("rgbMouseXY").style.backgroundColor="#"+m;p=128>f||128>g||128>k&&200>f&&200>g&&50<k?"#fff":"#000";top.get("hexMouseXY").style.color=
|
||||
top.get("rgbMouseXY").style.color=p;n=get("floatingContainer");n.style.left=top.ICEcoder.mouseX+20+"px";n.style.top=top.ICEcoder.mouseY+"px";l=-(a.naturalWidth/a.width*c*5)+25;q=-(a.naturalHeight/a.height*d*5)+25;n.style.backgroundPosition=l+"px "+q+"px"};top.get("canvasPicker").onmouseover=function(a){get("floatingContainer").style.visibility="visible"};top.get("canvasPicker").onmouseout=function(a){get("floatingContainer").style.visibility="hidden"};top.get("canvasPicker").onclick=function(){top.get("rgb").value=
|
||||
|
||||
Reference in New Issue
Block a user