Greasemonkey script to click “Show more” buttons on web pages

A lot of web sites have “show more” buttons. I am not sure if they are just used for tracking purposes or if some people really thinks that they improve the usability of a page, but I just find them annoying.  It is possible to click these buttons automatically when the page is loaded using the Greasemonkey add-on for Firefox. Here is some scripts that do this.

Kanopy (change the winnipeg.kanopy.com to your library’s URL):

// ==UserScript==
// @name Kanopy more clicker
// @include https://winnipeg.kanopy.com/*
// ==/UserScript==

// wait for page to finish loading
window.addEventListener('load', function() {
    console.log(document.getElementsByClassName("more")[0].click());
}, false);

Kijiji:

// ==UserScript==
// @name kijiji more clicker
// @include https://www.kijiji.ca/*
// ==/UserScript==

// wait for page to finish loading
window.addEventListener('load', function() {
    console.log(document.getElementsByClassName("showMoreButton-4078245409")[0].click());
}, false);

Overdrive (again, change it to your library’s URL):

// ==UserScript==
// @name Overdrive AutoExpander
// @version 1.0
// @include https://winnipeg.overdrive.com/*
// ==/UserScript==

window.addEventListener('load', function() {
console.log(document.getElementsByClassName("TitleDetailsDescription-descriptionArrow js-description-arrow is-unexpanded")[0].click());
}, false);

Goodreads uses a link instead, so an additional library is needed:

// ==UserScript==
// @name Goodreads more clicker
// @description click the "more" button on goodreads pages
// @include https://www.goodreads.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// ==/UserScript==

//--- find "...more" link; the contains() text is case-sensitive.
var TargetLink = $("a:contains('...more')")

if (TargetLink.length) {
console.log('clicking "more..." button')
TargetLink.click()
}

Leave a Reply

Your email address will not be published. Required fields are marked *