Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created April 15, 2009 00:41
Show Gist options
  • Save hitode909/95515 to your computer and use it in GitHub Desktop.
Save hitode909/95515 to your computer and use it in GitHub Desktop.
// ==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