Skip to content

Instantly share code, notes, and snippets.

@simoneau
Created October 8, 2014 16:38
Show Gist options
  • Save simoneau/808570b57dd519b7a4e1 to your computer and use it in GitHub Desktop.
Save simoneau/808570b57dd519b7a4e1 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. Note that you may need to reload the page if you are flipping through images.
// ==UserScript==
// @name HTTPS for reddit.com on imgur.com
// @description Rewrite links to use HTTPS for reddit.com on imgur.com.
// @author Matthew Simoneau
// @namespace http://www.matthewsim.com/
// @version 0.1
// @include https://imgur.com/*
// ==/UserScript==
var a = document.getElementsByTagName('a');
for (var i = 0; i < a.length; i++) {
var p = /^http:\/\/(www\.reddit\.com\/.*)$/;
var res = p.exec(a[i].href);
if (res != null) {
a[i].href = 'https://' + res[1];
}
}
@simoneau
Copy link
Author

Analytics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment