A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Following comments in Fixing the Home Link in the Telem System (Open U) I’ve decided to fix the top bar links in the Sheilta system too.

The links in the top bar are javascript links that open in a new window when clicked. My Greasemonkey script turns them into regular links that you can open in a new tab.

// sheilta.user.js
// version 0.1 
// 2008-04-13
// Copyright (c) 2008, Guy Rutenberg
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name          Top menu fix for the Open University's Sheilta system.
// @namespace     http://www.guyrutenberg.org/
// @description   Fixes the top menu in the Open University's Sheilta system.
// @include       https://sheilta.apps.openu.ac.il/*
// ==/UserScript==
 
 
tds = document.getElementsByTagName('td');
if (tds) {
	for (i = 0; i<tds.length; i++) {
		if (tds[i].className != "atext") {
			continue;
		} else if (! tds[i].firstChild.attributes) {
			continue;
		} else if (! tds[i].firstChild.attributes.getNamedItem('onclick')) {
			continue;
		}

		onclick = tds[i].firstChild.attributes.getNamedItem('onclick').nodeValue;
		re = /window.open\("(.*?)",/
		match = re.exec(onclick)
		if (match) {
			tds[i].firstChild.href=match[1];
		}
		tds[i].firstChild.attributes.getNamedItem('onclick').nodeValue = '';
		tds[i].firstChild.target = '_top';

		if (tds[i].firstChild.firstChild.data=='הכימ×Ŗ') {
			tds[i].firstChild.href='/pls/dmyopt2/mabasheilta.hadracha';
		}
	}
}

I hope you will find this script useful. I didn’t find any major bugs, but there may be some. If you find one, please report it to me via the comments or email.

2 thoughts on “A Greasemonkey Fix to the Top Menu in Sheilta (Open University)”

  1. Well, very nice šŸ™‚
    In the moment when i’ll start study there i promise i’ll remember this.
    It’s pity that you have to reverse-engener they web-site for your needs šŸ™

  2. It’s a pity indeed. The sad part is this is just the tip of the glacier, as there a lot more stuff that isn’t designed in standards compliant way with accessibility in mind. However the Open University does improve its site and web systems so at least there is hope that it will be fixed in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *