This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This snippet adds 'Add to Shelf' button while viewing legimi.pl catalogue | |
// How to add and run snippet: | |
// https://developers.google.com/web/tools/chrome-devtools/javascript/snippets#runcommandmenu | |
let books = document.querySelectorAll('.book-box'); | |
books.forEach(book => { | |
let link = book.querySelector("a.book-title"); | |
let url = link.href; | |
let bookId = url.slice(url.indexOf(',') + 2, url.lastIndexOf('.')); | |
let btn = document.createElement('button'); | |
btn.setAttribute("onclick", "addToShelf(this)"); |