Last active
February 27, 2018 16:10
-
-
Save masaakif/49823 to your computer and use it in GitHub Desktop.
Open 2ch in 2chbbsreader
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 Open 2ch in 2chbbsreader | |
// @namespace http://swdyh.yu.to/ | |
// @description loading next page and inserting into current page. | |
// @include http://www.google.co.jp/search* | |
// ==/UserScript== | |
// | |
// auther: masaakif | |
// version: 0.0.1 2009-01-14T09:52:07+09:00 | |
// | |
// this script based on | |
// | |
// Released under the GPL license | |
// http://www.gnu.org/copyleft/gpl.html | |
// | |
var replaceUrl = { | |
execute: function() { | |
var nodes = document.evaluate('id("res")//a[@class="l"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | |
for (var i = 0; i < nodes.snapshotLength; i++) { | |
this.processNode(nodes.snapshotItem(i)); | |
} | |
}, | |
processNode: function(anchor) { | |
var href = anchor.href; | |
if (href.match(/2ch\.net/)) { | |
if (href.match(/html$/)) { | |
exit; | |
} | |
href = "http://127.0.0.1:8823/thread/" + href; | |
href = encodeURIComponent(href); | |
newHref = "http://www.google.co.jp/url?sa=t&source=web&ct=res&cd=4&url=" + href; | |
anchor.href = newHref; | |
} | |
}, | |
}; | |
replaceUrl.execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment