diff options
Diffstat (limited to 'src/app.ts')
| -rw-r--r-- | src/app.ts | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/app.ts b/src/app.ts index e56db0b..6bef2c2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -137,7 +137,6 @@ class AppCommon { applyNightMode(is_night: any) { console.log("night mode changed to", is_night); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#theme_css").attr("href", "lib/bootstrap/v3/css/" + (is_night ? "theme-dark.min.css" : "bootstrap-theme.min.css")); } @@ -165,7 +164,6 @@ class AppCommon { '`': '`' }; - // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message return p.replace(/[&<>"'`/]/g, function(m) { return map[m]; }); } } @@ -206,26 +204,19 @@ class AppClass extends AppCommon { // Update navbar active states if (this.index_mode === "favorites") { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".index_favorites").addClass("active"); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".download_all_link").show(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".logout_link").hide(); } else { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".index_all").addClass("active"); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".download_all_link").hide(); } - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".search_query").val(this.index_query); // Auth check: call backend with a minimal request; 401 means unauthorized try { const checkParams = new URLSearchParams({op: "list", limit: "1"}); - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. await Http.get("backend.php?" + checkParams.toString()); // If we get here without error, we're authenticated } catch (e) { @@ -243,13 +234,9 @@ class AppClass extends AppCommon { Http.setCsrfToken(this.csrf_token); if (typeof EpubeApp != "undefined") { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".navbar").hide(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".epube-app-filler").show(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".separate-search").show(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("body").addClass("is-epube-app"); if (this.index_mode == "favorites") @@ -267,7 +254,6 @@ class AppClass extends AppCommon { this.showCovers(); this.updateOfflinePrompts(); } else { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".container-main") .addClass("alert alert-danger") .html("Service worker support missing in browser (are you using plain HTTP?)."); @@ -275,29 +261,24 @@ class AppClass extends AppCommon { } initCommonEventHandlers() { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".remove_all_downloads").on('click', () => { this.removeAll(); }); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".logout_link").on('click', () => { this.logout(); }); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".download_all_link").on('click', (e: any) => { e.preventDefault(); this.getAll(); }); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".update_link").on('click', (e: any) => { e.preventDefault(); window.location.reload(); }); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".cosmetic_version").attr('title', this.cosmeticVersion); } @@ -330,24 +311,18 @@ class AppClass extends AppCommon { const comment = data.comment ? data.comment : 'No description available'; - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal .modal-title").text(data.title); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal .book-summary").html(comment); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal").modal(); } else { const data = await localforage.getItem("epube-book." + bookId); const comment = data.comment ? data.comment : 'No description available'; - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal .modal-title").text(data.title); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal .book-summary").html(comment); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#summary-modal").modal(); } @@ -355,13 +330,10 @@ class AppClass extends AppCommon { } showCovers() { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("img[data-book-id]").each((i: any, elem: any) => { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const e = $(elem); if (e.attr('data-cover-link')) { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const img = $("<img>") .on("load", () => { e.css("background-image", "url(" + e.attr('data-cover-link') + ")") @@ -379,7 +351,6 @@ class AppClass extends AppCommon { * @param {boolean} is_fav */ updateFavoritePrompt(elem: any, is_fav: any) { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(elem) .text(is_fav ? "Remove from favorites" : "Add to favorites") .attr('data-is-fav', is_fav ? 1 : 0); @@ -402,7 +373,6 @@ class AppClass extends AppCommon { this.updateFavoritePrompt(elem, resp.data.status == "1"); if (this.index_mode == "favorites" && resp.data.status == 0) { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#cell-" + bookId).remove(); } } @@ -415,10 +385,8 @@ class AppClass extends AppCommon { } updateOfflinePrompts() { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const elems = $(".offline_dropitem"); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $.each(elems, (i: any, elem: any) => { this.updateOfflinePrompt(elem); }); @@ -464,11 +432,8 @@ class AppClass extends AppCommon { console.log('cache version, current:', this.cacheVersion, 'worker:', await this.getActiveCacheVersion()); if (typeof EpubeApp != "undefined") { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".navbar").hide(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".epube-app-filler").show(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("body").addClass("is-epube-app"); EpubeApp.setPage("PAGE_OFFLINE"); @@ -477,7 +442,6 @@ class AppClass extends AppCommon { this.initNightMode(); this.initCommonEventHandlers(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".search_query").val(this.urlParam("query")); this.populateOfflineList(); @@ -504,26 +468,22 @@ class AppClass extends AppCommon { const promises = []; - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. promises.push(Http.blob('backend.php?op=download&id=' + data.epub_id).then((resp) => { console.log(cacheId + ' got book'); return localforage.setItem(cacheId + '.book', resp.blob); }).catch((e) => console.warn('failed to download book', e))); - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. promises.push(Http.text("backend.php?op=getpagination&id=" + data.epub_id).then((resp) => { console.log(cacheId + ' got pagination'); return localforage.setItem(cacheId + '.locations', JSON.parse(resp.text)); }).catch((e) => console.warn('failed to download pagination', e))); - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. promises.push(Http.text("backend.php?op=getlastread&id=" + data.epub_id).then((resp) => { console.log(cacheId + ' got lastread'); return localforage.setItem(cacheId + '.lastread', JSON.parse(resp.text)); }).catch((e) => console.warn('failed to download lastread', e))); if (data.has_cover) { - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. promises.push(Http.blob("backend.php?op=cover&id=" + bookId).then((resp) => { console.log(cacheId + ' got cover'); return localforage.setItem(cacheId + '.cover', resp.blob); @@ -535,7 +495,6 @@ class AppClass extends AppCommon { callback(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".dl-progress") .show() .html("Finished downloading <b>" + this.escapeHtml(data.title) + "</b>"); @@ -543,7 +502,6 @@ class AppClass extends AppCommon { window.clearTimeout(this._dl_progress_timeout); this._dl_progress_timeout = window.setTimeout(() => { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".dl-progress").fadeOut(); }, 5*1000); } @@ -552,11 +510,8 @@ class AppClass extends AppCommon { getAll() { if (confirm("Download all books on this page?")) { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $(".row > div").each((i: any, row: any) => { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const bookId = ($(row).attr("id") ?? "").replace("cell-", ""); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const dropitem = $(row).find(".offline_dropitem")[0] ?? null; if (bookId) { @@ -581,7 +536,6 @@ class AppClass extends AppCommon { const bookId = elem.getAttribute("data-book-id"); this.remove(bookId, () => { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message $("#cell-" + bookId).remove(); }); } @@ -623,7 +577,6 @@ class AppClass extends AppCommon { /** @type {HttpResponse} */ let resp; try { - // @ts-expect-error TS(2554): Expected 2 arguments, but got 1. resp = await Http.get("backend.php?" + params.toString()); } catch (e) { const err = /** @type {HttpError} */(e); @@ -635,7 +588,6 @@ class AppClass extends AppCommon { /** @type{BookList} */ const data = resp.data; - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const books = $("#books_container"); books.html(""); @@ -679,11 +631,8 @@ class AppClass extends AppCommon { * @param {BookList} data */ updateIndexPagination(data: any) { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const prevLi = $(".pager .previous"); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const nextLi = $(".pager .next"); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const pagerInfo = $(".pager .pager-info"); const prevParams = new URLSearchParams({ @@ -756,7 +705,6 @@ class AppClass extends AppCommon { ${this.escapeHtml(book.series_name) + " [" + book.series_index + "]"} </a></div>` : ''; - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const cell = $(`<div class="col-xxs-6 col-xs-3 col-sm-3 col-md-2" id="cell-${book.id}"> ${isOpenable ? `<a class="thumbnail ${cellThumbClass}" href="${readUrl}">` : @@ -798,7 +746,6 @@ class AppClass extends AppCommon { } async search() { - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const query = $(".search_query").val(); await localforage.setItem("epube.search-query", query); @@ -829,7 +776,6 @@ class AppClass extends AppCommon { let query = this.urlParam("query"); if (query) query = String(query).toLowerCase(); - // @ts-expect-error TS(2581): Cannot find name '$'. Do you need to install type ... Remove this comment to see the full error message const books = $("#books_container"); books.html(""); |
