From c0bd515c903e2da91f99106414c0c5a0462fdeeb Mon Sep 17 00:00:00 2001 From: AKP Date: Sun, 17 Apr 2022 20:04:03 +0100 Subject: [PATCH] Revert "Update reading list bookmarklet" This reverts commit d288b295eb8cce626b433fec2a7218651b1e3dcc. --- readingListBookmarklet.js | 75 ++++++--------------------------------- 1 file changed, 11 insertions(+), 64 deletions(-) diff --git a/readingListBookmarklet.js b/readingListBookmarklet.js index 1793576..0c62870 100644 --- a/readingListBookmarklet.js +++ b/readingListBookmarklet.js @@ -1,7 +1,7 @@ // TO USE: Replace the value of `token` with your value for `WEBSITE_READINGLIST_TOKEN`, then minify this script and set it as a bookmark. javascript:(() => { const requestURL = "http://127.0.0.1:8080/api/readingList"; - const token = "gkjslxhdfkgljhsdklgjh"; + const token = "dfgkjlhsdfgkljghklhj"; const pageTitle = document.title; const pageURL = window.location.href; @@ -53,67 +53,14 @@ javascript:(() => { console.log("BOOKMARKET PRESSED:", pageTitle, pageURL, metaDescription, metaImage); - // make HTML page + const url = new URL(requestURL); + const searchParams = url.searchParams; + searchParams.set("title", pageTitle); + searchParams.set("url", pageURL); + searchParams.set("description", metaDescription); + searchParams.set("image", metaImage); + searchParams.set("nexturl", pageURL); + searchParams.set("token", token); - const page = ` - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - ` - - document.open("text/html"); - document.write(page); - document.close(); - - const titleBox = document.getElementById("title"); - const descriptionBox = document.getElementById("description"); - const tagsBox = document.getElementById("tags"); - const favouriteCheck = document.getElementById("favourite"); - - titleBox.value = pageTitle; - descriptionBox.value = metaDescription; - - document.getElementById("submit").addEventListener("click", function() { - const url = new URL(requestURL); - const searchParams = url.searchParams; - searchParams.set("title", titleBox.value); - searchParams.set("url", pageURL); - searchParams.set("description", descriptionBox.value); - searchParams.set("image", metaImage); - searchParams.set("nexturl", pageURL); - searchParams.set("token", token); - searchParams.set("tags", tagsBox.value); - searchParams.set("favourite", favouriteCheck.checked ? "true" : "false"); - - window.location.href = url; - }); -})(); \ No newline at end of file + window.location.href = url; +})();