Skip to content

Instantly share code, notes, and snippets.

@crabtw
Created November 14, 2009 07:10
Show Gist options
  • Save crabtw/234423 to your computer and use it in GitHub Desktop.
Save crabtw/234423 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name portal corse list
// @namespace portal
// @include https://portal.yzu.edu.tw/VC2/Student/classLeft_S.aspx
// ==/UserScript==
var sw = GM_getValue("switch", null) || "on";
if(sw == "on") {
document.body.innerHTML = document.body.innerHTML.replace(
/(課程名稱【(\W+)[A-Z] ?班】[^>]*>)[^<]+<\/a>/g, "$1$2</a>"
);
}
var link = document.createElement("a");
link.href = "#";
link.textContent = "switch: " + sw;
link.className = "left_menu";
link.addEventListener("click", function(e) {
sw = sw == "on" ? "off" : "on";
GM_setValue("switch", sw);
location.reload();
}, false);
var menu = document.getElementsByClassName("menu")[0];
var thead = menu.createTHead();
thead.align = "center";
thead.appendChild(link);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment