Bookmarklets, user scripts, etc.

About this page

This is a page for things to modify your browser. These are mainly things that I made for my own use; maybe someone else will want them too. Generally if I have multiple of these types of things (e.g., a bookmarklet and a user script), then they're alternatives that do the same/similar things.

Note that since most of these depend on aspects of how some particular websites work, they might break at any time (or they might stop being necessary). (I've moved some that no longer work here.)

Bookmarklets [B]

Bookmarklets are small pieces of JavaScript code that you can bookmark and then run on other websites to do various things. To use these, bookmark the link (drag it to the bookmark bar, or right-click and then choose "Bookmark this Link"); then when you're on the page you want to use the bookmark on, click on the bookmark.

On iOS (iPhone/iPad/iPod) Safari, it's a bit more complicated: you need to create a bookmark to some website, then edit the bookmark's location. That is, create a bookmark to an ordinary webpage, save it, copy the code, tap the bookmarks icon, tap Edit, delete the URL and then paste the code. (source)

User scripts [G]

These work with the Greasemonkey extension in Firefox. They may also work in other extensions or other browsers; I haven't tested that yet.

User styles [S]

These work with the Stylus extension in Firefox, and possibly other extensions or other browsers. You'll need to copy and paste from the stylesheet to a new style, since I don't know how to make a user style download link.

Contents

(Click the link to go to the section; actual bookmarklet links are within the section.)

No YT Autohide [G][S]

Before: The video controls are covering up the bottom of the video, which in this case, is a text caption that's not a closed caption.  The controls are semi-transparent, but the text under them still isn't very readable.  Caption: "What does that say?"  After: The video controls are opaque and completely outside the video.  The caption is visible; it says "In the 1970s, hovercraft were the future.  So what went wrong?"  Caption: "That's better!"

(↑ Not my video, just one I happened to watch where there was text at the bottom of the screen.)

Fix the new YouTube player so that the playback bar is always visible and doesn't cover up the bottom of the video; helpful if there's text at the bottom of the video that you want to pause and read, and (for the user script) now you can see how far you are into the video just by looking down. Install the user script (better) OR the user style. Not guaranteed to work if YouTube changes things again (not guaranteed to work in general; I hope it doesn't break anything, but it seems to work on my computer on Firefox). (If the user script breaks, the user style might still work.)

Known issues:

If you've previously installed an older version of the user style and you're now installing the user script, you should probably disable the user style.

User script: No YT Autohide (updated 2023-08-23; 2023-08-19 version also available)

User style: No YT Autohide (updated 2023-08-23; not necessary if you install the user script; 2023-08-19 version also available)

Play MIDI's [B]

Change all links to .mid or .midi files on the page so that they play the file using midijs.net's script. Useful for MIDIly-challenged computers (*glares in Apple's direction*).

Go to a page that has links to MIDIs, click this bookmarklet, and then click on a link to a MIDI to start playing.

Known issues:

The "Stop MIDIs" bookmarklet stops MIDI files that you've played using the Play MIDIs bookmarklet.

The bookmarklet: Play MIDIs (bookmark this link)

javascript:(function(){var s=document.createElement('script'),l=document.getElementsByTagName('a'),i=0;s.src='//www.midijs.net/lib/midi.js';document.body.appendChild(s);for(;i<l.length;i++)if(l[i].href.match(/\.midi?$/))l[i].onclick=function(){MIDIjs.play(this.href);return%20false;};})();

The other bookmarklet: Stop MIDIs (bookmark this link)

javascript:MIDIjs.stop()

Beautified:

Web archive [G][B]

Display the current page, or (in the user script version) any linked page, in Web Archive. Helpful for if you're browsing an old webpage and come across a bunch of broken links. (Also it offers to save the page if it's not there but available online.)

This is available as a bookmarklet and as a user script. The bookmarklet finds older versions of the current page. The user script adds an item to the context menu to find older versions of the current page or of any link (which is useful if the page now redirects somewhere unhelpful).

Known issues:

The bookmarklet: Web Archive (bookmark this link)

javascript:void(location.href='https://web.archive.org/web/*/'+location.href);

The user script: Web Archive context menu (updated 2021-04-11)

Disable mobile viewport [B]

Tells mobile browsers to use the default (wide) width and allow zooming, like they do for sites that aren't made for mobile devices. On some websites, this will switch them into desktop layout, rather than mobile layout.

The bookmarklet: Disable mobile viewport (bookmark this link)

javascript:+function(){var m=document.getElementsByTagName("meta");for(var i in m)if(m[i].name=="viewport"){m[i].content="";break}}()

Beautified:

Delete fixed elements [B]

Deletes all items on the page that don't scroll with the rest of the document. This can get rid of those cookie popups, some ads that overlap the content, possibly even some paywalls (depending on how they're implemented). It also enables scrolling for the document, in case a pop-up disabled that. Bookmark the link, then click the bookmark to delete the elements on the page. Known limitations:

The bookmarklet: Delete fixed elements (bookmark this link, or copy the code below into a new bookmark)

javascript:(function(){function f(e){if(e.nodeType==1)if(getComputedStyle(e).position=='fixed')e.parentNode.removeChild(e);else for(var i=e.childNodes.length-1;i>=0;i--)f(e.childNodes[i]);}f(document.body);document.documentElement.style.setProperty('overflow','visible','important');document.body.style.setProperty('overflow','visible','important');})();

Beautified:

Old version (doesn't enable scrollbars):

Current forum game scores (xkcd forums) [B]

(for example, with the Thread Necromancy Mexican Standoff thread open, clicking this bookmarklet takes you to the Thread Necromancy Mexican Standoff scores)

Go directly to the scores for the forum game you're currently viewing. If not available, go to the list of forum game scorekeepers. This is similar to clicking the link in my signature, except it works even if I haven't posted in the thread recently, and is more reliable when viewing new posts.

This should now work in the new forums at ramenchef.net, and also when viewing the forum on web archive/wayback machine.

The bookmarklet: Forum game scores (bookmark this link; updated 2021-09-01)

javascript:if(!function(){var h2=document.getElementsByTagName('h2');if(h2.length==0)return;var a=h2[0].getElementsByTagName('a');if(a.length==0)return;var f;var r=(f='rc',a[0].href.match(/https?:\/\/ramenchef\.net\/nxf\/viewtopic\.php\?([^#]+)/))||(f='xkcd',a[0].href.match(/https?:\/\/(?:www\.)?(?:(?:forums3?|fora)\.xkcd\.com|echochamber\.me)\/viewtopic\.php\?([^#]+)/));if(!r)return;r=('&'+r[1]+'&').match(/&t=(\d+)&/);if(!r)return;return location='https://chridd.nfshost.com/fg/referer?t='+r[1]+'&f='+f;}())void(location='https://chridd.nfshost.com/fg/');

Beautified:

Pitch shift when changing speed [B]

Open a YouTube video, click this bookmarklet, and then change the playback speed (gear icon, or press < and > keys). The pitch will increase if you speed up the video or decrease if you slow it down, rather than keeping the same pitch. This will likely also work on other websites with video or possibly audio where you can change the playback speed (though you might need to start the video/audio playing before clicking the bookmarklet).

The bookmarklet: Pitch shift (bookmark this link)

javascript:(function(){function f(t){var v=document.getElementsByTagName(t);for(var i=0;i<v.length;i++)v[i].mozPreservesPitch=v[i].webkitPreservesPitch=v[i].preservesPitch=false;}f('video');f('audio');})()

Beautified:

Miscellaneous [various]

Eval Javascript [B]: For browsers that don't allow directly entering javascript: URL's in the address bar and don't have a JavaScript console.


Translate [B]: Translates the current page to English using Google Translate.


Talkhaus post times [B][G]: Show actual post dates and times instead of "x days ago" on the Talkhaus forum.


Always show YouTube dates [S]: Sometimes YouTube has been showing the number of views with an ellipsis and not showing the date it was uploaded/published/premiered. This fixes that. Download YouTube dates style. (not sure this still works/is still necessary) (see video in the screenshot)


Fix backspace on Wordle [G]: At least on my browser, every time I press backspace on Wordle to try to delete a letter, it goes back to the previous page as if I'd pressed the Back button. This fixes that. Download Wordle backspace user script (updated 2022-02-11)