Last active
December 26, 2018 02:04
-
-
Save noirscape/829cc24e14d1a8d288c25d258c67cd7e to your computer and use it in GitHub Desktop.
Userscript for automatically going to orig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter auto :orig URL | |
// @version 1 | |
// @include https://pbs.twimg.com/media/* | |
// @grant none | |
// ==/UserScript== | |
if (!window.location.href.endsWith(":orig")) { | |
var pathname = window.location.pathname // Used later on, so setting it here | |
if (pathname.includes(":")) { // checking pathname -> https:// | |
var safeURL = window.location.origin + pathname.substring(0, pathname.indexOf(":")) | |
} else { | |
var safeURL = window.location.origin + pathname // pathname doesnt have ?s or anything like that. | |
} | |
window.location.replace(safeURL + ":orig") | |
} | |
// fuck js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment