I wrote this UserScript for personal use to allow me to click the main comic panel in order to navigate to the next panel, a feature which I consider essential for any webcomic, to the point that before this script I simply did not bother trying to read any comics that don't have this feature.

This is for use on the comic series that starts with https://www.nuklearpower.com/2001/03/02/episode-001-were-going-where/. It's designed to only work with this comic series, and I was hoping to upload it to GreasyFork or some other way I could share it with other interested people. Before that, though, I wanted to get some feedback on the script, see if there are any glaring mistakes or flaws that can be improved upon.

// ==UserScript==
// @name         Click 8 Bit Theater to go to next Panel
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.nuklearpower.com/*
// @icon         https://www.google.com/s2/favicons?domain=nuklearpower.com
// @grant        none
// ==/UserScript==
/* globals comicDiv */

(function() {
    'use strict';
    // If there is a comic panel on the page
    var comicDiv = document.getElementById("comic");
        // Create a wrapper anchor element
        var wrapper = document.createElement("a");
        var nextLink = document.querySelector("a[rel=next]");
            // Set the wrapper's href to that of the next link, if found
            wrapper.href = nextLink.href;
            wrapper.title = "next";
            // Insert the wrapper between the comicDiv and the comic itself


1 Answer 1


What happens if you don't find the div? For example, if the site owners change their HTML so that's not the ID anymore?

I suggest at minimum a console.log() statement. However, you could also display an HTML banner on the page, or come up with some other way of communicating that the script isn't working as intended.

Before sharing this, it would be helpful to have a specific and concise description (and your name). Currently, your description and author fields still have the default values.

// @description  try to take over the world!
// @author       You

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.