Skip to content

Instantly share code, notes, and snippets.

@tobbez
Last active May 7, 2017 19:26
Show Gist options
  • Save tobbez/c23cd46ce37eade711d900ad653f05a4 to your computer and use it in GitHub Desktop.
Save tobbez/c23cd46ce37eade711d900ad653f05a4 to your computer and use it in GitHub Desktop.
Twitter: Redirect media to :orig (original size)
// ==UserScript==
// @name Twitter: Redirect media to :orig
// @namespace http://ryara.net/
// @version 0.21
// @author tobbez
// @match https://pbs.twimg.com/media/*
// @match https://pbs-h2.twimg.com/media/*
// @grant none
// @run-at document-start
// @downloadURL https://gist.github.com/tobbez/c23cd46ce37eade711d900ad653f05a4/raw/twitter-redirect-media-orig.user.js
// @updateURL https://gist.github.com/tobbez/c23cd46ce37eade711d900ad653f05a4/raw/twitter-redirect-media-orig.user.js
// ==/UserScript==
(function() {
'use strict';
let l = document.createElement('a');
l.href = document.location;
if (l.pathname.endsWith(':orig')) return;
let qre = /:[^:/]+$/;
if (l.pathname.match(qre)) {
l.pathname = l.pathname.replace(qre, ':orig');
} else {
l.pathname += ':orig';
}
document.location.replace(l.href);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment