-
Notifications
You must be signed in to change notification settings - Fork 2
/
utime.user.js
45 lines (38 loc) · 1.01 KB
/
utime.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// ==UserScript==
// @name uTime link adder
// @author Galgo
// @version 0.9
// @match https://www.ims.tau.ac.il/Tal/TL/Marechet_L.aspx?*
// ==/UserScript==
function idPage()
{
return (document.getElementById("LblPage").innerText == "מערכת שעות");
}
function createLinks()
{
baseUrl = "http://google.com/search?btnI=1&q=site:utime.co.il%20";
table = document.getElementsByTagName("table")[1].tBodies[0];
for(i=1; i<table.rows.length-1; ++i)
{
var row = table.rows[i];
var courseNumCell = row.cells[9];
if(courseNumCell != null)
{
var courseId = courseNumCell.innerText;
var searchString = baseUrl + courseId;
// TODO: add target to link
courseNumCell.innerHTML = "<A HREF=\"" + searchString + "\" />" + courseId + "</A>";
}
}
}
try
{
if(idPage())
createLinks();
}
catch(x)
{
// Comment this out if you want error messages displayed
//var myStackTrace = x.stack || x.stacktrace || "";
//alert('TAU Auto-login extension encountered an error: '+ x.message + '\n\n' + myStackTrace);
}