Skip to content

Instantly share code, notes, and snippets.

@noirscape
Last active December 26, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noirscape/829cc24e14d1a8d288c25d258c67cd7e to your computer and use it in GitHub Desktop.
Save noirscape/829cc24e14d1a8d288c25d258c67cd7e to your computer and use it in GitHub Desktop.
Userscript for automatically going to orig
// ==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