Last active
November 16, 2022 14:32
-
-
Save andre-st/71c824fd1e8b61e6e29af2a962c60956 to your computer and use it in GitHub Desktop.
Force consistent Goodreads.com view settings, show link to user's comments-history, ... #injectjs
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
////////////////////////////////////////////////////////////////////////////// | |
// | |
// GOODREADS.COM | |
// | |
// Force shelf view settings: | |
// | |
redir( /(https:\/\/www\.goodreads\.com\/review\/list\/[^?]+)(?=(?:.*[?&](page=\d+))?)(?=(?:.*[?&](shelf=[^&]+))?)(.*)/, | |
'$1?per_page=100&sort=rating&order=d&view=covers&$2&$3' ); | |
// Force "All editions" view settings: | |
// | |
redir( /(https:\/\/www\.goodreads\.com\/work\/editions\/[^\?]*)\?*(.*)/, | |
'$1?expanded=true&$2&per_page=100' ); | |
// Show comment-history link for each user | |
// | |
mixin( ['https://www.goodreads.com'], () => | |
{ | |
const links = document.querySelectorAll( 'a[rel="acquaintance"]' ); | |
for( var i = 0; i < links.length; i++ ) | |
{ | |
const a = document.createElement( 'A' ); | |
const url = links[i].getAttribute( 'href' ); | |
const uid = (url.match( /\/([0-9]+)/ ) || ['', ''])[1]; | |
a.innerHTML = '💬'; // Speech bubble icon | |
a.href = 'https://www.goodreads.com/comment/list/' + uid; | |
a.target = '_blank'; | |
a.title = "Show user's comment history"; | |
links[i].after( a ); | |
links[i].after( document.createTextNode( ' ' )); | |
} | |
}); | |
// Full width book covers shelf column (more covers on screen/less scrolling) | |
mixin( "https://www.goodreads.com/review/list/", | |
` | |
.mainContent, | |
.mainContentFloat { width: unset; } | |
.mainContent #rightCol { width: calc( 100% - 210px ); } | |
.mainContent #rightCol .right { float: unset; } | |
#reviewPagination a { padding: 0.3em 0.75em; margin: 0.5em 0.1em; font-size: 1.15em; background-color: #182c44; color: #ffffff; } | |
#reviewPagination a:hover { filter: brightness(1.5); } | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be used with the Javascript injection extension https://github.com/andre-st/chrome-injectjs