Compare commits
No commits in common. "2222f6df9ead86468a1d3802f30982ae71e739a7" and "cb0a1fed975f46f6b9f701277bd81fcf62aab0e4" have entirely different histories.
2222f6df9e
...
cb0a1fed97
|
|
@ -31,6 +31,11 @@ function compareNames($a, $b) {
|
||||||
return strnatcmp($a["name"], $b["name"]);
|
return strnatcmp($a["name"], $b["name"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data["compath"] = $compath;
|
||||||
|
$pathparts = pathinfo($compath);
|
||||||
|
$data["parentpath"] = $pathparts['dirname'];
|
||||||
|
$data["foldername"] = $pathparts['basename'];
|
||||||
|
|
||||||
$adultcomics = getAdultComics();
|
$adultcomics = getAdultComics();
|
||||||
|
|
||||||
$compath = $_SESSION['compath'];
|
$compath = $_SESSION['compath'];
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ if ( ($newpath == "/") || ($comicfull === false) || (substr($comicfull, 0, strle
|
||||||
}
|
}
|
||||||
$data["message"] = "New comic path: {$_SESSION["compath"]}";
|
$data["message"] = "New comic path: {$_SESSION["compath"]}";
|
||||||
$pathparts = pathinfo($_SESSION['compath']);
|
$pathparts = pathinfo($_SESSION['compath']);
|
||||||
|
$data["parentpath"] = $pathparts["dirname"];
|
||||||
|
$data["foldername"] = $pathparts["basename"];
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ require_once 'htmlheader.php';
|
||||||
?>
|
?>
|
||||||
<div class='header' id='header'>
|
<div class='header' id='header'>
|
||||||
<div class='sorter'>Sort: <span id="sortorder"></span></div>
|
<div class='sorter'>Sort: <span id="sortorder"></span></div>
|
||||||
<div id="path" class='name link'>/Comics/</div>
|
<div id="path" class='name link'></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="list" class='list'></div>
|
<div id="list" class='list'></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
||||||
32
js/comics.js
32
js/comics.js
|
|
@ -1,8 +1,12 @@
|
||||||
const NOREFRESH = false;
|
const NOREFRESH = false;
|
||||||
|
|
||||||
|
var curpath = "/";
|
||||||
|
var parentpath = "/";
|
||||||
|
var foldername = "";
|
||||||
|
|
||||||
// This function is executed after the page load completes on the client
|
// This function is executed after the page load completes on the client
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#path").click(function() { changeFolder("/"); });
|
$("#path").click(function() { changeFolder(parentpath, parentpath); });
|
||||||
$("#sortorder").on("click", cycleSortOrder);
|
$("#sortorder").on("click", cycleSortOrder);
|
||||||
getSortOrder();
|
getSortOrder();
|
||||||
});
|
});
|
||||||
|
|
@ -93,10 +97,12 @@ function getFolderContents() {
|
||||||
redirectToLogin();
|
redirectToLogin();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
curpath = data.compath;
|
||||||
|
updatePathNavigator();
|
||||||
data.contents.forEach(function(entry, index) {
|
data.contents.forEach(function(entry, index) {
|
||||||
$("#list").append(entry.div);
|
$("#list").append(entry.div);
|
||||||
});
|
});
|
||||||
$(".folder").click(function() { changeFolder($(this).data("path")); });
|
$(".folder").click(function() { changeFolder($(this).data("name"), $(this).data("path")); });
|
||||||
$(".issue").click(function() { $(this).parent().addClass("readborder"); showComic($(this).data("relcomic"), $(this).data("comname")); });
|
$(".issue").click(function() { $(this).parent().addClass("readborder"); showComic($(this).data("relcomic"), $(this).data("comname")); });
|
||||||
toastr.remove();
|
toastr.remove();
|
||||||
},
|
},
|
||||||
|
|
@ -107,6 +113,23 @@ function getFolderContents() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the navigation path displayed in the element with id "path".
|
||||||
|
* If the current path is the root ("/"), it sets the navigation path to "/".
|
||||||
|
* Otherwise, it sets the navigation path to "/Comics" followed by the parent path.
|
||||||
|
*
|
||||||
|
* Assumes the existence of global variables `curpath` and `parentpath`.
|
||||||
|
*/
|
||||||
|
function updatePathNavigator() {
|
||||||
|
var navpath = "";
|
||||||
|
if ( curpath == "/" ) {
|
||||||
|
navpath = "/";
|
||||||
|
} else {
|
||||||
|
navpath = "/Comics" + parentpath;
|
||||||
|
}
|
||||||
|
$("#path").html(navpath);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the current folder by sending an AJAX request to update the path on the server.
|
* Changes the current folder by sending an AJAX request to update the path on the server.
|
||||||
* Displays a notification to the user and updates global variables upon success.
|
* Displays a notification to the user and updates global variables upon success.
|
||||||
|
|
@ -114,7 +137,7 @@ function getFolderContents() {
|
||||||
* @param {string} name - The display name of the folder to open.
|
* @param {string} name - The display name of the folder to open.
|
||||||
* @param {string} path - The path of the folder to open.
|
* @param {string} path - The path of the folder to open.
|
||||||
*/
|
*/
|
||||||
function changeFolder(path) {
|
function changeFolder(name, path) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : 'ajax/setpath.php',
|
url : 'ajax/setpath.php',
|
||||||
data : {path: path},
|
data : {path: path},
|
||||||
|
|
@ -124,6 +147,9 @@ function changeFolder(path) {
|
||||||
redirectToLogin();
|
redirectToLogin();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
curpath = path;
|
||||||
|
parentpath = data.parentpath;
|
||||||
|
foldername = data.foldername;
|
||||||
toastr.remove();
|
toastr.remove();
|
||||||
getFolderContents();
|
getFolderContents();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user