2021-02-06 04:52:46 +00:00
|
|
|
window.onload = (eve) => {
|
|
|
|
console.log("Loaded...");
|
|
|
|
}
|
2021-02-08 02:07:13 +00:00
|
|
|
|
|
|
|
document.body.onload = (eve) => {
|
|
|
|
getFavesAjax();
|
|
|
|
reloadDirectory();
|
2021-02-08 08:02:14 +00:00
|
|
|
if (window.self !== window.top) {
|
|
|
|
setTimeout(function () {
|
|
|
|
let elm = document.getElementById("bg");
|
|
|
|
elm.parentElement.removeChild(elm);
|
|
|
|
|
|
|
|
// Stylesheet for iframe views
|
2021-02-09 00:36:55 +00:00
|
|
|
let link = document.createElement("link");
|
2021-02-08 08:02:14 +00:00
|
|
|
link.href = formatURL("static/css/iframe.css");
|
|
|
|
link.type = "text/css";
|
2021-02-09 00:36:55 +00:00
|
|
|
link.rel = "stylesheet";
|
2021-02-08 08:02:14 +00:00
|
|
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
|
|
}, 500);
|
|
|
|
}
|
2021-02-08 02:07:13 +00:00
|
|
|
}
|
2021-02-08 07:15:38 +00:00
|
|
|
|
2021-02-08 20:04:32 +00:00
|
|
|
|
2021-02-09 23:14:32 +00:00
|
|
|
const loadFavePath = (e) => {
|
|
|
|
const target = e.target;
|
|
|
|
const faveId = target.getAttribute("faveid");
|
|
|
|
loadFavorite(faveId);
|
|
|
|
}
|
2021-02-09 00:36:55 +00:00
|
|
|
|
2021-02-08 07:15:38 +00:00
|
|
|
const openFile = (eve) => {
|
2021-02-09 00:36:55 +00:00
|
|
|
const target = eve.target;
|
|
|
|
const ftype = target.getAttribute("ftype");
|
|
|
|
const title = target.getAttribute("title");
|
|
|
|
const hash = target.getAttribute("hash");
|
|
|
|
const parts = title.split('.');
|
|
|
|
const extension = "." + parts[parts.length - 1].toLowerCase();
|
|
|
|
|
|
|
|
if (ftype === "dir") {
|
|
|
|
listFilesAjax(hash);
|
|
|
|
} else if (ftype === "video") {
|
|
|
|
showMedia(hash, extension, "video");
|
|
|
|
} else {
|
|
|
|
showMedia(hash, extension, "file");
|
|
|
|
}
|
2021-02-08 07:15:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const openFileLocally = (eve) => {
|
2021-02-09 00:36:55 +00:00
|
|
|
const target = eve.target;
|
|
|
|
const hash = target.getAttribute("hash");
|
2021-02-08 08:02:14 +00:00
|
|
|
openWithLocalProgram(hash);
|
2021-02-08 07:15:38 +00:00
|
|
|
}
|
|
|
|
|
2021-02-08 20:04:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-08 07:15:38 +00:00
|
|
|
$( "#search-files-field" ).bind( "keyup", async function(eve) {
|
|
|
|
searchPage();
|
|
|
|
});
|
|
|
|
|
|
|
|
$( "#clear-search-btn" ).bind( "click", async function(eve) {
|
|
|
|
clearSearch();
|
|
|
|
});
|
|
|
|
|
|
|
|
$( "#refresh-btn" ).bind( "click", async function(eve) {
|
|
|
|
reloadDirectory();
|
|
|
|
});
|
|
|
|
|
|
|
|
$( "#back-btn" ).bind( "click", async function(eve) {
|
|
|
|
goUpADirectory();
|
|
|
|
});
|
|
|
|
|
|
|
|
$( "#tggl-faves-btn" ).bind( "click", async function(eve) {
|
|
|
|
manageFavorites(eve.target);
|
|
|
|
});
|
|
|
|
|
|
|
|
$( "#scroll-files-to-top-btn" ).bind( "click", async function(eve) {
|
|
|
|
scrollFilesToTop();
|
|
|
|
});
|