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 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)
These work with the Greasemonkey extension in Firefox. They may also work in other extensions or other browsers; I haven't tested that yet.
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.
(Click the link to go to the section; actual bookmarklet links are within the section.)
(↑ 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)
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:
.mid
or .midi
won't work (such as Wikipedia file description pages).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:
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 false;
};
})();
Show blue outlines around all unvisited links, and orange outlines around all visited links. Useful on sites that for some reason set visited and unvisited links to the same color. Clicking on the bookmarklet again will remove the outlines.
The bookmarklet: Link borders (bookmark this link)
javascript:if(document.getElementById('chridd_linkborders')!=null)void%20document.head.removeChild(document.getElementById('chridd_linkborders'));else(function(){var%20l=document.createElement('style');l.id='chridd_linkborders';l.innerHTML='a%20{outline-style:solid%20!important;%20outline-width:1px%20!important}%20a:link%20{outline-color:blue%20!important;}%20a:visited%20{outline-color:orange%20!important;}';document.head.appendChild(l);})();
The stylesheet, which you can use as a user style or base a user style on, if you want to do it that way instead.
Beautified:
javascript:
if(document.getElementById('chridd_linkborders')!=null)
void document.head.removeChild(
document.getElementById('chridd_linkborders'));
else (function(){
var l=document.createElement('style');
l.id='chridd_linkborders';
l.innerHTML='a {outline-style:solid !important; outline-width:1px !important} a:link {outline-color:blue !important;} a:visited {outline-color:orange !important;}';
document.head.appendChild(l);
})();
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:
<menu>
is deprecated and only supported on Firefox; the user script won't work on other browsers, and at some point it might stop working on Firefox. This issue only applies to the user script.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)
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:
javascript:
+function() {
var m = document.getElementsByTagName("meta");
for(var i in m)
if(m[i].name=="viewport") {
m[i].content="";
break
}
}()
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:
position: fixed
; doesn't get rid of all annoyances/ads, not a fully-featured ad blocker. Doesn't (currently) affect position: sticky
, and doesn't affect fixed backgrounds or things that scripts keep in place by manually updating them.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:
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');
})();
Old version (doesn't enable scrollbars):
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);})();
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:
javascript:
if(!function() {
var h2 = document.getElementsByTagName('h2');
if(h2.length == 0) return; // (returns undefined, which is falsey)
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;
// (returns a true value)
}())
void (location = 'https://chridd.nfshost.com/fg/');
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:
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');
})()
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.
javascript:eval(prompt('Type some JavaScript',''));
Translate [B]: Translates the current page to English using Google Translate.
javascript:location.href='https://translate.google.com/translate?prev=hp&hl=en&js=y&u='+escape(location.href)+'&sl=auto&tl=en&history_state0='
Talkhaus post times [B][G]: Show actual post dates and times instead of "x days ago" on the Talkhaus forum.
javascript:(function(){var t=document.getElementsByTagName('time');for(var i=0;i<t.length;i++)t[i].innerHTML=new Date(t[i].getAttribute('datetime')).toLocaleString();})()
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)