Created
July 29, 2008 05:51
-
-
Save umq/3027 to your computer and use it in GitHub Desktop.
force https in wassr.{com|jp}
This file contains 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 wassr-https-hack | |
// @description wassr.{jp|com} is not yet fully applies https | |
// @include http://wassr.com/* | |
// @include http://wassr.jp/* | |
// @include https://wassr.com/* | |
// @include https://wassr.jp/* | |
// @namespace http://slashdot.jp/~umq/ | |
// @version 1.1 | |
// ==/UserScript== | |
(function(){ | |
if (/^http\:/.test(location.href)) { | |
location.href = location.href.replace(/^http\:/, 'https:'); | |
} | |
var scripts = document.getElementsByTagName('script'); | |
for (var i = 0; i < scripts.length; i++) { | |
var url = scripts[i].getAttribute('src'); | |
if (/^http\:\/\/maps\.google\.com\//.test(url)) { | |
scripts[i].src = url.replace(/^http\:/, 'https:'); | |
} | |
} | |
var links = document.getElementsByTagName('a'); | |
var linkCount = 0; | |
for (var i = 0; i < links.length; i++) { | |
var url = links[i].getAttribute('href'); | |
if (/^http\:\/\/wassr\.(com|jp)\//.test(url)) { | |
links[i].href = url.replace(/http:/, 'https:'); | |
linkCount++; | |
} | |
} | |
var links = document.getElementsByTagName('img'); | |
for (var i = 0; i < links.length; i++) { | |
var url = links[i].getAttribute('src'); | |
if (/^http\:\/\/wassr\.(com|jp)\//.test(url)) { | |
links[i].href = url.replace(/^http\:/, 'https:'); | |
count++; | |
} | |
if (/users_reply/.test(url)) { | |
links[i].href = '#'; | |
} | |
} | |
if (linkCount == 0) { | |
alert('no replacement, wassr-https-hack.user.js can be removed.'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment