35 Zeilen
1.4 KiB
JavaScript
35 Zeilen
1.4 KiB
JavaScript
|
// ==UserScript==
|
||
|
// @name Kobo library easy archive
|
||
|
// @namespace https://sebastian-tobie.de/
|
||
|
// @version 0.1
|
||
|
// @description Helps with archiving kobo books
|
||
|
// @author Sebastian Tobie
|
||
|
// @source https://gitea.sebastian-tobie.de/sebastian/cookiedb/raw/branch/stable/userscripts/kobo_easy_archive.js
|
||
|
// @run-at document-idle
|
||
|
// @match https://www.kobo.com/de/de/library/books
|
||
|
// @match https://www.kobo.com/de/de/library/books?*
|
||
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=kobo.com
|
||
|
// @grant none
|
||
|
// @unwrap
|
||
|
// ==/UserScript==
|
||
|
(function() {
|
||
|
'use strict';
|
||
|
let he = document.getElementsByClassName("headers-end")[0];
|
||
|
let header = document.createElement("span");
|
||
|
header.classList.add("heading");
|
||
|
header.classList.add("more-actions");
|
||
|
he.appendChild(header);
|
||
|
let library_list = document.getElementsByClassName("library-items")[0];
|
||
|
for(let c = 0; c < library_list.childElementCount; c++) {
|
||
|
let child = library_list.children[c];
|
||
|
let item_bar = child.getElementsByClassName("item-bar")[0];
|
||
|
if(!child.classList.contains("pre-order")){
|
||
|
let button = child.getElementsByClassName("remove-from-library")[0];
|
||
|
let parent = button.parentNode
|
||
|
parent.removeChild(button);
|
||
|
item_bar.appendChild(button);
|
||
|
} else {
|
||
|
item_bar.appendChild(document.createElement("span"));
|
||
|
}
|
||
|
}
|
||
|
})();
|