Show anim on trial bar, new checkExists function

Run autoOpenFiles after 200ms, giving time for ICEcoder to finish
displaying onscreen, including the trial bar animating (over 150ms)
checkExists is a new function which will take a path and give you back a
status object, stored under lastFileDirCheckStatusObj
Only set fileControl URL if serverQueueItems[0] is available, it isn't
under new setup with extra AJAX call
This commit is contained in:
Matt Pass
2015-06-30 17:05:50 +01:00
parent f39093c78f
commit 166d27ca4c

View File

@@ -88,7 +88,8 @@ var ICEcoder = {
top.ICEcoder.showHide('hide',top.get('loadingMask'));
top.ICEcoder.autoOpenInt = setInterval(function() {
if (top.ICEcoder.fmReady) {
if (top.ICEcoder.openLastFiles) {top.ICEcoder.autoOpenFiles()};
// Delay auto open process by 200ms to give trial bar time to begin animation
if (top.ICEcoder.openLastFiles) {setTimeout(function() {top.ICEcoder.autoOpenFiles()},200);};
clearInterval(top.ICEcoder.autoOpenInt);
}
}, 4);
@@ -1495,6 +1496,57 @@ var ICEcoder = {
return false;
},
// Check for existance of a file/dir
checkExists(path) {
var xhr, statusObj, timeStart;
path = path.replace(/\|/g,"/");
// Start a seperate XHR call. We do a seperate one immediately rather than in the serverQueue because
// we may need to run independently and straight away, eg for checking if a file/dir exists in 'Save As' function
xhr = top.ICEcoder.xhrObj();
xhr.onreadystatechange=function() {
if (xhr.readyState==4) {
// Parse the response as a JSON object
statusObj = JSON.parse(xhr.responseText);
// Set the action end time and time taken in JSON object
statusObj.action.timeEnd = new Date().getTime();
statusObj.action.timeTaken = statusObj.action.timeEnd - statusObj.action.timeStart;
// User wanted raw (or both) output of the response?
if (["raw","both"].indexOf(top.ICEcoder.fileDirResOutput) >= 0) {
console.log(xhr.responseText);
}
// User wanted object (or both) output of the response?
if (["object","both"].indexOf(top.ICEcoder.fileDirResOutput) >= 0) {
console.log(statusObj);
}
// Also store the statusObj
top.ICEcoder.lastFileDirCheckStatusObj = statusObj;
// OK reponse? If error, show that, otherwise do whatever we're required to do next
if (xhr.status==200) {
if (!statusObj.status.error) {
eval(statusObj.action.doNext);
}
// Some other response? Display a message about that
} else {
top.ICEcoder.message(top.t['Sorry there was...']);
console.log("ICEcoder error info for your request...");
console.log(statusObj);
top.ICEcoder.serverMessage();
top.ICEcoder.serverQueue('del',0);
}
}
};
xhr.open("POST","lib/file-control-xhr.php?action=checkExists&csrf="+top.ICEcoder.csrf,true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
timeStart = new Date().getTime();
xhr.send('timeStart='+timeStart+'&file='+path);
},
// Show menu on right clicking in file manager
showMenu: function(evt) {
var menuType, menuHeight, winH, fmYPos;
@@ -2386,7 +2438,13 @@ var ICEcoder = {
xhr.send('timeStart='+timeStart+'&file='+file);
}
} else {
setTimeout(function() {top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0]},1);
setTimeout(function() {
if ("undefined" != typeof ICEcoder.serverQueueItems[0]) {
top.ICEcoder.filesFrame.contentWindow.frames['fileControl'].location.href=ICEcoder.serverQueueItems[0];
}
},1);
}
}
},