Guy Rutenberg

Keeping track of what I do

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

with 2 comments

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.

Share and Enjoy:
  • del.icio.us
  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google Bookmarks
  • Simpy

Written by Guy

April 14th, 2008 at 7:34 am

Posted in Greasemonkey

Tagged with ,

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

Subscribe to comments with RSS or TrackBack to '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 :(

    confiq

    27 Apr 08 at 02:11

  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.

    Guy

    27 Apr 08 at 15:35

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">