Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions locales/template/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,15 @@ msgstr "Your keyboard arrows (and the spacebar)"
msgid "Touching the left/right side of the image."
msgstr "Touching the left/right side of the image."

msgid "When reading an archive from search results, you can also navigate between archives using:"
msgstr "When reading an archive from search results, you can also navigate between archives using:"

msgid "The square bracket keys"
msgstr "The square bracket keys"

msgid "Reading past the first/last page"
msgstr "Reading past the first/last page"

msgid "Other keyboard shortcuts:"
msgstr "Other keyboard shortcuts:"

Expand Down Expand Up @@ -1100,6 +1109,9 @@ msgstr "B: toggle bookmark"
msgid "N: toggle auto next page"
msgstr "N: toggle auto next page"

msgid "shift+Left/Right: go to first page/last page"
msgstr "shift+Left/Right: go to first page/last page"

msgid "G: go to page number"
msgstr "G: go to page number"

Expand Down
12 changes: 12 additions & 0 deletions locales/template/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,15 @@ msgstr "键盘方向键(和空格键)"
msgid "Touching the left/right side of the image."
msgstr "点击图像的左/右侧。"

msgid "When reading an archive from search results, you can also navigate between archives using:"
msgstr "从搜索结果阅读时,您也可以尝试以下方式读前后档案:"

msgid "The square bracket keys"
msgstr "方括号键"

msgid "Reading past the first/last page"
msgstr "跨书翻页"

msgid "Other keyboard shortcuts:"
msgstr "其他键盘快捷键:"

Expand All @@ -967,6 +976,9 @@ msgstr "F:切换全屏模式"
msgid "B: toggle bookmark"
msgstr "B:切换书签"

msgid "shift+Left/Right: go to first page/last page"
msgstr "shift+箭头键:跳到首尾页"

msgid "To return to the archive index, touch the arrow pointing down or use Backspace."
msgstr "要返回档案索引,请点击向下的箭头或使用退格键。"

Expand Down
25 changes: 25 additions & 0 deletions public/css/lrr.css
Original file line number Diff line number Diff line change
Expand Up @@ -998,3 +998,28 @@ body.infinite-scroll .fullscreen-infinite img {
text-overflow: ellipsis;
white-space: nowrap;
}

/* Prevent absolute options from blocking the paginator */
@media (max-width: 768px) {
.absolute-options {
position: fixed !important;
z-index: 100;
}

.absolute-left {
bottom: 15px !important;
left: 10px !important;
top: auto !important;
}

.absolute-right {
bottom: 15px !important;
right: 10px !important;
top: auto !important;
}

/* Ensure the paginator isn't blocked */
.sn {
margin-bottom: 60px !important;
}
}
8 changes: 7 additions & 1 deletion public/js/mod/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import * as marked from "marked";
import DOMPurify from "dompurify";

let selectedCategory = "";
export let selectedCategory = "";
let awesomplete = {};

Check warning on line 13 in public/js/mod/index.js

View workflow job for this annotation

GitHub Actions / ESLint

'awesomplete' is assigned a value but never used. Allowed unused vars must match /^_/u
let carouselInitialized = false;
let swiper = {};
let serverVersion = "";
Expand Down Expand Up @@ -57,6 +57,11 @@
if (id) toggleArchiveSelection(id);
});

// Mark carousel-originated reader links so Reader can decide whether to enable cross-archive navigation
$(document).on("click.carousel-navstate", ".swiper-wrapper .swiper-slide a[href*='/reader?id=']", () => {
sessionStorage.setItem("navigationState", "carousel");
});

// 0 = List view
// 1 = Thumbnail view
// List view is at 0 but became the non-default state later so here's some legacy weirdness
Expand Down Expand Up @@ -233,7 +238,7 @@
Server.loadBookmarkCategoryId()
.then(() => loadCategories())
.then(() => IndexTable.initializeAll())
.catch(error => console.error("Error initializing index:", error));

Check warning on line 241 in public/js/mod/index.js

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected console statement
});

const columnCountSelect = document.getElementById("columnCount");
Expand Down Expand Up @@ -1043,6 +1048,7 @@
break;
}
case "read":
sessionStorage.setItem("navigationState", window.contextMenuSource === "carousel" ? "carousel" : "datatables");
LRR.openInNewTab(new LRR.ApiURL(`/reader?id=${id}`));
break;
case "download":
Expand Down
29 changes: 29 additions & 0 deletions public/js/mod/index_datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export function initializeAll() {
doSearch();
});

// Mark datatables-originated reader links so Reader can decide whether to enable cross-archive navigation.
// Excludes anything inside the carousel; that's tagged separately in Index.initializeAll.
$(document).on("click.datatables-navstate", "a[href*='/reader?id=']", function () {
if ($(this).closest(".swiper-wrapper").length > 0) return;
sessionStorage.setItem("navigationState", "datatables");
});

// Add a listen event to window.popstate to update the search accordingly
// if the user goes back using browser history
$(window).on("popstate", () => {
Expand Down Expand Up @@ -67,6 +74,9 @@ export function initializeAll() {
data: "tags", className: "tags itd", name: "tags", orderable: false, render: renderTags,
});

// Store the page size in localStorage for use in the reader
localStorage.setItem("datatablesPageSize", Index.pageSize.toString());

// Datatables configuration
dataTable = $(".datatables").DataTable({
serverSide: true,
Expand Down Expand Up @@ -116,6 +126,10 @@ export function doSearch(page) {
// This allows for the regular search bar to be used in conjunction with categories.
dataTable.column(".tags.itd").search(Index.selectedCategory);

// Store search parameters in localStorage for archive navigation
localStorage.setItem("currentSearch", currentSearch);
localStorage.setItem("selectedCategory", Index.selectedCategory);

// Update search input field
$("#search-input").val(currentSearch);
dataTable.search(currentSearch);
Expand Down Expand Up @@ -298,6 +312,21 @@ export function drawCallback() {
$(".itg").show();
}

// Store archive IDs in localStorage in the order they appear in the table,
// so the Reader can navigate to neighbors without re-querying.
const archiveIds = [];
const archives = dataTable.rows().data();
for (let i = 0; i < archives.length; i++) {
archiveIds.push(archives[i].arcid);
}
localStorage.setItem("currArchiveIds", JSON.stringify(archiveIds));
localStorage.setItem("currDatatablesPage", pageInfo.page + 1);

// Clear previous/next archive IDs when changing pages manually
// to avoid stale neighbors when using the browser back button.
localStorage.removeItem("previousArchiveIds");
localStorage.removeItem("nextArchiveIds");

// Update url to contain all search parameters, and push it to the history
if (isComingFromPopstate) {
// But don't fire this if we're coming from popstate
Expand Down
6 changes: 5 additions & 1 deletion public/js/mod/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export function callAPIBody(endpoint, method, body, successMessage, errorMessage
*/
export function checkJobStatus(jobId, useDetail, callback, failureCallback, progressCallback = null) {
let endpoint = new LRR.ApiURL(useDetail ? `/api/minion/${jobId}/detail` : `/api/minion/${jobId}`);
fetch(endpoint, { method: "GET" })
fetch(endpoint, {
method: "GET",
mode: "same-origin",
credentials: "same-origin",
})
.then((response) => response.json())
.then((data) => {
if (data.error) throw new Error(data.error);
Expand Down
Loading
Loading