From 2f66afa4e4f29ceea78a9d6de63711920e49188e Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 13 Nov 2014 13:59:44 +0000 Subject: [PATCH] Time params on the action and URI encode content --- lib/file-control-xhr.php | 3 +++ lib/ice-coder.js | 7 ++++++- lib/ice-coder.min.js | 40 ++++++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index 4e185aa..6a4fb1c 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -267,6 +267,9 @@ echo '{ "action": { "initial" : "'.$_GET["action"].'", "final" : "'.$finalAction.'", + "timeStart": '.$_POST["timeStart"].', + "timeEnd": 0, + "timeTaken": 0, "csrf": "'.$_GET["csrf"].'", "doNext" : "'.str_replace(PHP_EOL,'',str_replace(' ','',str_replace('"','\"',$doNext))).'top.ICEcoder.switchMode();" }, diff --git a/lib/ice-coder.js b/lib/ice-coder.js index fee82ea..759bc59 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -2070,6 +2070,10 @@ var ICEcoder = { if (xhr.readyState==4 && xhr.status==200) { // console.log(xhr.responseText); var statusArray = JSON.parse(xhr.responseText); + + // Set the actions end time and time taken in JSON object + statusArray.action.timeEnd = new Date().getTime(); + statusArray.action.timeTaken = statusArray.action.timeEnd - statusArray.action.timeStart; // console.log(statusArray); if (statusArray.status.error) { @@ -2084,7 +2088,8 @@ var ICEcoder = { // console.log('Calling '+saveURL+' via XHR'); xhr.open("POST",saveURL,true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.send('contents='+top.document.getElementById('saveTemp1').value); + timeStart = new Date().getTime(); + xhr.send('timeStart='+timeStart+'&contents='+encodeURIComponent(top.document.getElementById('saveTemp1').value)); } else { diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js index ddde073..31dac8b 100644 --- a/lib/ice-coder.min.js +++ b/lib/ice-coder.min.js @@ -91,26 +91,26 @@ b.replaceRange(a,{line:b.getCursor().line,ch:c.start},{line:b.getCursor().line,c b+"'",6E4*d):0==c.indexOf("fileControl")?top.ICEcoder["plugTimer"+a]=setInterval(function(){top.ICEcoder.serverQueue("add",b);top.ICEcoder.serverMessage(c.split(":")[1])},6E4*d):top.ICEcoder["plugTimer"+a]=setInterval("window.open('"+b+"','"+c+"')",6E4*d);top.ICEcoder.pluginIntervalRefs.push(a)},codeAssistToggle:function(){var a,b;top.ICEcoder.codeAssist=!top.ICEcoder.codeAssist;top.get("codeAssistDisplay").style.backgroundPosition=top.ICEcoder.codeAssist?"0 0":"-16px 0";top.ICEcoder.cssColorPreview(); top.ICEcoder.focus(-1'+top.t["Cancelled tasks"]+"");setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add","lib/settings.php?saveFiles="+a+"&csrf="+top.ICEcoder.csrf)},autoOpenFiles:function(){if(0'); -top.ICEcoder.showHide(a?"hide":"show",top.get("blackMask"))},helpScreen:function(){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},showManual:function(a,b){var c;c=b?"#"+b:"";top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))}, -propertiesScreen:function(a){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},pluginsManager:function(){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},githubAction:function(a){top.get("mediaContainer").innerHTML= -'';top.ICEcoder.showHide("show",top.get("blackMask"))},githubTokenAsk:function(a){if(githubAuthToken=top.ICEcoder.getInput(top.t["Please enter your..."],""))top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+a+"&csrf="+top.ICEcoder.csrf, -githubAuthToken=""},showHideGithubNav:function(a){top.get("githubNav").style.display="show"==a?"block":"none";top.get("fileNav").style.display="show"==a?"none":"block"},githubManager:function(){top.ICEcoder.githubAuthTokenSet?(top.get("mediaContainer").innerHTML='',top.ICEcoder.showHide("show",top.get("blackMask"))):top.ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){var a;if(!top.ICEcoder.githubAuthTokenSet)top.ICEcoder.githubTokenAsk("loadFiles"); -else if(top.ICEcoder.githubDiff||top.ICEcoder.ask(top.t["This will compare..."]))top.ICEcoder.githubDiff=!top.ICEcoder.githubDiff,a=top.ICEcoder.githubDiff?"true":"false",top.ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+top.ICEcoder.csrf},useNewSettings:function(a,b,c,d,f,e,g,k,h,l,n,p,m,r,s,t){var q;top.ICEcoder.theme=a.slice(a.lastIndexOf("/")+1,a.lastIndexOf("."));"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");q=document.createElement("link");q.setAttribute("rel","stylesheet"); -q.setAttribute("type","text/css");q.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(q);a=-1<"3024-day base16-light eclipse elegant neat paraiso-light solarized xq-light".split(" ").indexOf(top.ICEcoder.theme)?"#ccc":"#000";top.ICEcoder.switchTab(top.ICEcoder.selectedTab);b!=top.ICEcoder.codeAssist&&(top.get("codeAssist").checked=b,top.ICEcoder.codeAssistToggle());c!=top.ICEcoder.lockedNav&&top.ICEcoder.lockUnlockNav();c||(ICEcoder.changeFilesW("contract"), -top.ICEcoder.hideFileMenu());c=ICEcoder.content.contentWindow.document.styleSheets[4];b=c.rules?"rules":"cssRules";c[b][0].style.fontSize=g;c[b][4].style["border-left-width"]=e?"1px":"0";c[b][4].style["margin-left"]=e?"-1px":"0";c[b][2].style.cssText="background-color: "+a+" !important";top.ICEcoder.lineWrapping=k;top.ICEcoder.indentWithTabs=h;top.ICEcoder.indentSize=l;for(e=0;echMod "+b+" on
"+a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(0

ICEcoder relies entirely on donations to fund future versions.
If you find it useful, please consider donating.
Many thanks!

Donate $5'}, +d-1;for(f=1;f'+top.t["Cancelled tasks"]+"");setTimeout(function(){top.ICEcoder.serverMessage()},2E3)},setPreviousFiles:function(){var a;a=top.ICEcoder.openFiles.join(",").replace(/\//g,"|").replace(/(\|\[NEW\])|(,\|\[NEW\])/g,"").replace(/(^,)|(,$)/g,"");""==a&&(a="CLEAR");top.ICEcoder.serverQueue("add", +"lib/settings.php?saveFiles="+a+"&csrf="+top.ICEcoder.csrf)},autoOpenFiles:function(){if(0';top.ICEcoder.showHide("show",top.get("blackMask"))},propertiesScreen:function(a){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},pluginsManager:function(){top.get("mediaContainer").innerHTML= +'';top.ICEcoder.showHide("show",top.get("blackMask"))},githubAction:function(a){top.get("mediaContainer").innerHTML='';top.ICEcoder.showHide("show",top.get("blackMask"))},githubTokenAsk:function(a){if(githubAuthToken= +top.ICEcoder.getInput(top.t["Please enter your..."],""))top.ICEcoder.filesFrame.contentWindow.frames.fileControl.location.href="lib/github.php?action=auth&token="+githubAuthToken+"&goNext="+a+"&csrf="+top.ICEcoder.csrf,githubAuthToken=""},showHideGithubNav:function(a){top.get("githubNav").style.display="show"==a?"block":"none";top.get("fileNav").style.display="show"==a?"none":"block"},githubManager:function(){top.ICEcoder.githubAuthTokenSet?(top.get("mediaContainer").innerHTML='', +top.ICEcoder.showHide("show",top.get("blackMask"))):top.ICEcoder.githubTokenAsk("showManager")},githubDiffToggle:function(){var a;if(!top.ICEcoder.githubAuthTokenSet)top.ICEcoder.githubTokenAsk("loadFiles");else if(top.ICEcoder.githubDiff||top.ICEcoder.ask(top.t["This will compare..."]))top.ICEcoder.githubDiff=!top.ICEcoder.githubDiff,a=top.ICEcoder.githubDiff?"true":"false",top.ICEcoder.filesFrame.src="files.php?githubDiff="+a+"&csrf="+top.ICEcoder.csrf},useNewSettings:function(a,b,c,d,f,e,g,k,h, +l,n,p,m,r,s,t){var q;top.ICEcoder.theme=a.slice(a.lastIndexOf("/")+1,a.lastIndexOf("."));"editor"==top.ICEcoder.theme&&(top.ICEcoder.theme="icecoder");q=document.createElement("link");q.setAttribute("rel","stylesheet");q.setAttribute("type","text/css");q.setAttribute("href",a);top.ICEcoder.content.contentWindow.document.getElementsByTagName("head")[0].appendChild(q);a=-1<"3024-day base16-light eclipse elegant neat paraiso-light solarized xq-light".split(" ").indexOf(top.ICEcoder.theme)?"#ccc":"#000"; +top.ICEcoder.switchTab(top.ICEcoder.selectedTab);b!=top.ICEcoder.codeAssist&&(top.get("codeAssist").checked=b,top.ICEcoder.codeAssistToggle());c!=top.ICEcoder.lockedNav&&top.ICEcoder.lockUnlockNav();c||(ICEcoder.changeFilesW("contract"),top.ICEcoder.hideFileMenu());c=ICEcoder.content.contentWindow.document.styleSheets[4];b=c.rules?"rules":"cssRules";c[b][0].style.fontSize=g;c[b][4].style["border-left-width"]=e?"1px":"0";c[b][4].style["margin-left"]=e?"-1px":"0";c[b][2].style.cssText="background-color: "+ +a+" !important";top.ICEcoder.lineWrapping=k;top.ICEcoder.indentWithTabs=h;top.ICEcoder.indentSize=l;for(e=0;echMod "+b+" on
"+ +a.replace(/\|/g,"/"))},openPreviewWindow:function(){if(0

ICEcoder relies entirely on donations to fund future versions.
If you find it useful, please consider donating.
Many thanks!

Donate $5'}, xhrObj:function(){try{return new XMLHttpRequest}catch(a){}try{return new ActiveXObject("Msxml3.XMLHTTP")}catch(b){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(d){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(f){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}return null},openBugReport:function(){var a;"off"==top.ICEcoder.bugReportStatus&&top.ICEcoder.message(top.t["You can start..."]);"error"==top.ICEcoder.bugReportStatus&& top.ICEcoder.message(top.t["Error cannot find..."]);"ok"==top.ICEcoder.bugReportStatus&&top.ICEcoder.message(top.t["No new errors..."]);"bugs"==top.ICEcoder.bugReportStatus&&(a=top.ICEcoder.openFiles.indexOf(top.ICEcoder.bugReportPath.replace(/\|/g,"/")),-1