2018-04-23 01:43:19 +00:00
|
|
|
// SSE events if supported
|
|
|
|
if(typeof(EventSource) !== "undefined") {
|
2018-11-23 23:46:40 +00:00
|
|
|
let source = new EventSource("resources/php/sse.php");
|
|
|
|
source.onmessage = (event) => {
|
2018-04-23 01:43:19 +00:00
|
|
|
if (event.data === "updateListing") {
|
|
|
|
getDir("./");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
console.log("SSE Not Supported In Browser...");
|
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const getFavesList = () => {
|
2018-08-25 21:10:09 +00:00
|
|
|
doAjax("resources/php/dbController.php", "getTabs=true");
|
|
|
|
}
|
|
|
|
|
2019-01-24 04:25:19 +00:00
|
|
|
const doAjax = async (actionPath, data) => {
|
2018-11-23 23:46:40 +00:00
|
|
|
let xhttp = new XMLHttpRequest();
|
2018-04-16 01:59:09 +00:00
|
|
|
|
2018-08-19 18:51:20 +00:00
|
|
|
xhttp.onreadystatechange = function() {
|
|
|
|
if (this.readyState === 4 && this.status === 200) {
|
|
|
|
// Send the returned data to further process
|
2019-06-06 04:05:09 +00:00
|
|
|
if (this.responseText != null) {
|
|
|
|
handleJSONReturnData(JSON.parse(this.responseText));
|
2018-08-19 18:51:20 +00:00
|
|
|
} else {
|
2019-06-07 20:24:54 +00:00
|
|
|
document.getElementById('dynUl').innerHTML =
|
2018-08-19 18:51:20 +00:00
|
|
|
"<p class=\"error\" style=\"width:100%;text-align:center;\"> "
|
|
|
|
+ "No content returned. Check the folder path.</p>";
|
2018-04-16 01:59:09 +00:00
|
|
|
}
|
2018-04-22 08:14:40 +00:00
|
|
|
}
|
2018-08-19 18:51:20 +00:00
|
|
|
};
|
2018-07-29 03:55:02 +00:00
|
|
|
|
2018-08-19 18:51:20 +00:00
|
|
|
xhttp.open("POST", actionPath, true);
|
|
|
|
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
2019-06-06 04:05:09 +00:00
|
|
|
xhttp.overrideMimeType('application/json'); // Force return to be JSON
|
2018-08-19 18:51:20 +00:00
|
|
|
xhttp.send(data);
|
2018-04-16 01:59:09 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 23:46:40 +00:00
|
|
|
const fileUploader = (data) => {
|
|
|
|
let xhttp = new XMLHttpRequest();
|
2018-04-16 01:59:09 +00:00
|
|
|
|
|
|
|
xhttp.onreadystatechange = function() {
|
|
|
|
if (this.readyState === 4 && this.status === 200) {
|
|
|
|
// Send the returned data to further process
|
2018-04-20 10:51:39 +00:00
|
|
|
if (this.responseXML != null) {
|
2018-08-19 18:51:20 +00:00
|
|
|
handleXMLReturnData(this.responseXML);
|
2018-04-20 10:51:39 +00:00
|
|
|
}
|
2018-04-16 01:59:09 +00:00
|
|
|
}
|
|
|
|
};
|
2018-08-19 18:51:20 +00:00
|
|
|
|
|
|
|
xhttp.open("POST", "resources/php/filesystemActions.php", true);
|
|
|
|
xhttp.overrideMimeType('application/xml'); // Force return to be XML
|
|
|
|
xhttp.send(data);
|
2018-04-16 01:59:09 +00:00
|
|
|
}
|