Created
April 15, 2009 00:41
-
-
Save hitode909/95515 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 RitsOnlineSyllabusShortTitle | |
// @namespace http://d.hatena.ne.jp/hitode909 | |
// @description make online syllabus shorter. | |
// @include http://online-kaikou.ritsumei.ac.jp/* | |
// ==/UserScript== | |
function xpath(query) { | |
return document.evaluate(query, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); | |
} | |
(function(){ | |
var paths = | |
["/html/body/h1", "/html/body/h2/a"]; | |
var contents = new Array(); | |
contents.push(" - "); | |
for(i=0; i<paths.length; i++){ | |
var x = xpath(paths[i]); | |
if(x.snapshotLength) | |
contents.push(x.snapshotItem(0).textContent); | |
} | |
for(i=0; i<contents.length; i++) | |
document.title = document.title.replace(new RegExp(contents[i], "g"), ""); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment