Last active
August 16, 2016 01:27
-
-
Save simoneau/6930848ef0a840481270 to your computer and use it in GitHub Desktop.
A user script to rewrite links to imgur.com on https://www.reddit.com to use HTTPS
This file contains hidden or 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 HTTPS for imgur.com on reddit.com | |
// @description Rewrite links to use HTTPS for imgur.com on reddit.com. | |
// @author Matthew Simoneau | |
// @namespace http://www.matthewsim.com/ | |
// @version 0.1 | |
// @include https://www.reddit.com/* | |
// ==/UserScript== | |
var a = document.getElementsByTagName('a'); | |
for (var i = 0; i < a.length; i++) { | |
var p = /^http:\/\/((:?[im]\.)?imgur\.com\/.*)$/; | |
var res = p.exec(a[i].href); | |
if (res != null) { | |
a[i].href = 'https://' + res[1]; | |
} | |
} |
Author
simoneau
commented
Sep 10, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment