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.
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 below.)
Fix the new YouTube player so that the playback bar is always visible and doesn't cover up the bottom of the video. Apply the user style (better), OR put the bookmarklet in your bookmarks bar, and click it when you have a video open (the bookmarklet will apply only to that tab). 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 both Firefox and Safari).
Known issues:
User style: No YT Autohide (updated 2019-03-19)
Bookmarklet: No YT Autohide (bookmark this link)
javascript:document.getElementsByClassName('ytp-chrome-bottom')[0].style.bottom='-41px';document.getElementById('movie_player').style.overflow='visible';document.getElementById('placeholder-player').style.marginBottom='51px';document.getElementsByClassName('ytp-gradient-bottom')[0].style.display='none';document.getElementsByClassName('ytp-chrome-bottom')[0].style.opacity='1.0';document.getElementsByClassName('ytp-chrome-bottom')[0].style.background='black';document.getElementById('movie_player').style.cursor='default';undefined;
Beautified:
javascript:
document.getElementsByClassName('ytp-chrome-bottom')[0].style.bottom = '-41px';
document.getElementById('movie_player').style.overflow = 'visible';
document.getElementById('placeholder-player').style.marginBottom = '51px';
document.getElementsByClassName('ytp-gradient-bottom')[0].style.display = 'none';
document.getElementsByClassName('ytp-chrome-bottom')[0].style.opacity = '1.0';
document.getElementsByClassName('ytp-chrome-bottom')[0].style.background = 'black';
document.getElementById('movie_player').style.cursor = 'default';
undefined;
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*).
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:
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).
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
Update: This script seems to no longer be necessary since their latest redesign.
On each page in TV Tropes, there are various display options. When you're not logged in, only "Show Spoilers" is enabled, with the other options prompting you to log in if you click them. However, if you enable the options, they work perfectly fine, and there's even perfectly working code to save the options locally like how Show Spoilers works (except for Wide Load, but this script also fixes that). Thus, this script enables those options.
Notes:
The user script: Enable TVTropes display options
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.
The bookmarklet: Forum game scores (bookmark this link)
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 r=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];}())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 r = 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];
// (returns a true value)
}())
void (location = 'https://chridd.nfshost.com/fg/');
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
}
}()
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='
Fix Bitbucket scrolling [S]: Bitbucket for no apparent reason has the main content scrolling separately from the window, which makes scrolling work weirdly (scrolling diagonally doesn't work). User style: Fix Bitbucket scrolling