Last active
August 29, 2015 14:20
-
-
Save zhuth/e8a8f08d12af6cdb8ba2 to your computer and use it in GitHub Desktop.
ssreader link getter (works with TemperMonkey)
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 ssreader link getter | |
// @namespace http://tianhua.me/ | |
// @version 0.1 | |
// @description enter something useful | |
// @author ZTH | |
// @match http://10.55.100.203:8099/* | |
// @grant none | |
// ==/UserScript== | |
function ssreaderLinkMain() { | |
var l = document.getElementsByTagName('dl'); | |
if (l.length > 0) { | |
for (var i = 0; i < l.length; ++i) { | |
var a = l[i].getElementsByTagName('a')[0]; | |
var oc = a.getAttribute('onclick'); | |
oc = oc.replace('ToReadBook(', 'ssreaderGet('); | |
a.setAttribute('onclick', oc); | |
} | |
} | |
} | |
window.ssreaderGet = function (id, mode) { | |
var oReq = new XMLHttpRequest(); | |
oReq.context = this; | |
oReq.onload = function () { | |
var ss = this.responseText.match('book://[^\"]*')[0]; | |
console.log(ss); | |
document.getElementById('KeyWord').value = ss; | |
document.getElementById('KeyWord').setAttribute('onclick', "this.select();"); | |
}; | |
oReq.open("get", "/markbook/GoBook.jsp?BID=" + id, true); | |
oReq.send(); | |
} | |
ToReadBook = window.ssreaderGet; | |
ssreaderLinkMain(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment