Skip to content

Instantly share code, notes, and snippets.

@wisq
Created February 18, 2016 19:38
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 wisq/dfee3b013e2c240ab588 to your computer and use it in GitHub Desktop.
Save wisq/dfee3b013e2c240ab588 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name RPS mixed-content defuckifier
// @namespace rps-img-https
// @include https://www.rockpapershotgun.com/*
// @version 1
// @grant none
// ==/UserScript==
var images = document.getElementsByTagName('img');
var length = images.length;
var match = new RegExp('^http://(www\.)?rockpapershotgun\.com/');
var proto = new RegExp('^http://');
for (var i = 0; i < length; i++) {
var img = images[i];
if (match.test(img.src)) {
img.src = img.src.replace(proto, "https://");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment