Created
November 29, 2008 11:37
-
-
Save miya2000/30228 to your computer and use it in GitHub Desktop.
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 flash - remove kuso | |
// @author miya2000 | |
// @namespace http://d.hatena.ne.jp/miya2000/ | |
// @version 1.0.0 | |
// @include http://* | |
// ==/UserScript== | |
(function() { | |
function parseQuery(query) { | |
var result = {}; | |
var q = query.slice(query.indexOf('?') + 1); | |
var params = q.split('&'); | |
for (var i = 0; i < params.length; i++) { | |
var param = params[i]; | |
var pair = param.split('='); | |
var name = decodeURIComponent(pair.shift().replace(/\+/g, ' ')); | |
var value = decodeURIComponent(pair.join('').replace(/\+/g, ' ')); | |
if (!result[name]) { | |
result[name] = value; | |
} | |
else { | |
if (result[name] instanceof Array) result[name].push(value); | |
else result[name] = [result[name], value]; | |
} | |
} | |
return result; | |
} | |
function main() { | |
var kuso = document.evaluate('//embed[contains(@src, "flash_detection.swf")]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
if (!kuso) return; | |
kuso.parentNode.removeChild(kuso); | |
var query = parseQuery(kuso.src); | |
if (query.flashContentURL) { | |
location.replace(query.flashContentURL); | |
} | |
} | |
document.addEventListener('DOMContentLoaded', main, false); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment