Compare commits
2 Commits
cb0a1fed97
...
2222f6df9e
| Author | SHA1 | Date | |
|---|---|---|---|
| 2222f6df9e | |||
| dacf7ce6d5 |
|
|
@ -31,11 +31,6 @@ function compareNames($a, $b) {
|
|||
return strnatcmp($a["name"], $b["name"]);
|
||||
}
|
||||
|
||||
$data["compath"] = $compath;
|
||||
$pathparts = pathinfo($compath);
|
||||
$data["parentpath"] = $pathparts['dirname'];
|
||||
$data["foldername"] = $pathparts['basename'];
|
||||
|
||||
$adultcomics = getAdultComics();
|
||||
|
||||
$compath = $_SESSION['compath'];
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ if ( ($newpath == "/") || ($comicfull === false) || (substr($comicfull, 0, strle
|
|||
}
|
||||
$data["message"] = "New comic path: {$_SESSION["compath"]}";
|
||||
$pathparts = pathinfo($_SESSION['compath']);
|
||||
$data["parentpath"] = $pathparts["dirname"];
|
||||
$data["foldername"] = $pathparts["basename"];
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ require_once 'htmlheader.php';
|
|||
?>
|
||||
<div class='header' id='header'>
|
||||
<div class='sorter'>Sort: <span id="sortorder"></span></div>
|
||||
<div id="path" class='name link'></div>
|
||||
<div id="path" class='name link'>/Comics/</div>
|
||||
</div>
|
||||
<div id="list" class='list'></div>
|
||||
<?php
|
||||
|
|
|
|||
32
js/comics.js
32
js/comics.js
|
|
@ -1,12 +1,8 @@
|
|||
const NOREFRESH = false;
|
||||
|
||||
var curpath = "/";
|
||||
var parentpath = "/";
|
||||
var foldername = "";
|
||||
|
||||
// This function is executed after the page load completes on the client
|
||||
$(document).ready(function() {
|
||||
$("#path").click(function() { changeFolder(parentpath, parentpath); });
|
||||
$("#path").click(function() { changeFolder("/"); });
|
||||
$("#sortorder").on("click", cycleSortOrder);
|
||||
getSortOrder();
|
||||
});
|
||||
|
|
@ -97,12 +93,10 @@ function getFolderContents() {
|
|||
redirectToLogin();
|
||||
return;
|
||||
}
|
||||
curpath = data.compath;
|
||||
updatePathNavigator();
|
||||
data.contents.forEach(function(entry, index) {
|
||||
$("#list").append(entry.div);
|
||||
});
|
||||
$(".folder").click(function() { changeFolder($(this).data("name"), $(this).data("path")); });
|
||||
$(".folder").click(function() { changeFolder($(this).data("path")); });
|
||||
$(".issue").click(function() { $(this).parent().addClass("readborder"); showComic($(this).data("relcomic"), $(this).data("comname")); });
|
||||
toastr.remove();
|
||||
},
|
||||
|
|
@ -113,23 +107,6 @@ 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.
|
||||
* Displays a notification to the user and updates global variables upon success.
|
||||
|
|
@ -137,7 +114,7 @@ function updatePathNavigator() {
|
|||
* @param {string} name - The display name of the folder to open.
|
||||
* @param {string} path - The path of the folder to open.
|
||||
*/
|
||||
function changeFolder(name, path) {
|
||||
function changeFolder(path) {
|
||||
$.ajax({
|
||||
url : 'ajax/setpath.php',
|
||||
data : {path: path},
|
||||
|
|
@ -147,9 +124,6 @@ function changeFolder(name, path) {
|
|||
redirectToLogin();
|
||||
return;
|
||||
}
|
||||
curpath = path;
|
||||
parentpath = data.parentpath;
|
||||
foldername = data.foldername;
|
||||
toastr.remove();
|
||||
getFolderContents();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user