Revert "Update reading list bookmarklet"
This reverts commit d288b295eb
.
This commit is contained in:
parent
1286ff0d68
commit
c0bd515c90
1 changed files with 11 additions and 64 deletions
|
@ -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.
|
// 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:(() => {
|
javascript:(() => {
|
||||||
const requestURL = "http://127.0.0.1:8080/api/readingList";
|
const requestURL = "http://127.0.0.1:8080/api/readingList";
|
||||||
const token = "gkjslxhdfkgljhsdklgjh";
|
const token = "dfgkjlhsdfgkljghklhj";
|
||||||
|
|
||||||
const pageTitle = document.title;
|
const pageTitle = document.title;
|
||||||
const pageURL = window.location.href;
|
const pageURL = window.location.href;
|
||||||
|
@ -53,67 +53,14 @@ javascript:(() => {
|
||||||
|
|
||||||
console.log("BOOKMARKET PRESSED:", pageTitle, pageURL, metaDescription, metaImage);
|
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 = `<!DOCTYPE html>
|
window.location.href = url;
|
||||||
<html>
|
})();
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
input[type=text] {
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td><label for="title">Title</label></td>
|
|
||||||
<td><input type="text" id="title" name="title"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="description">Description</label></td>
|
|
||||||
<td><input type="text" id="description" name="description"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="description">Tags</label></td>
|
|
||||||
<td><input type="text" id="tags" name="tags"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="favourite">Favourite?</label></td>
|
|
||||||
<td><input type="checkbox" id="favourite" name="favourite"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<input type="submit" id="submit" value="Submit">
|
|
||||||
</body>
|
|
||||||
</html>`
|
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue