There are 2 previous versions of this script.
// ==UserScript==
// @name better berkley webcasts
// @author Matt Katz
// @namespace berkley webcasts
// @description every time I click on the background stupid thickbox closes so I changed it
// @include http://webcast.berkeley.edu/course_details_new.php*
// ==/UserScript==
var urlRegex = /\b(https?:\/\/[^\s+\"\<\>]+)/i;
var allLinks, thisLink;
var fileUrl, row;
var clicktext;
allLinks = document.evaluate(
'//a[@class="hVlogTarget"]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < allLinks.snapshotLength; i++) {
thisLink = allLinks.snapshotItem(i);
// remove the thickbox which is annoying
clicktext = thisLink.getAttribute("onclick");
thisLink.setAttribute("onclick", clicktext.replace("active=true","active=false"));
//lets get the url from that text so folks can save this CC video and audio
var match = urlRegex.exec(clicktext);
fileUrl = match[0];
fileUrl = fileUrl.replace("&autostart=true',",'');
row = thisLink.parentNode.parentNode;
var downloadLink = document.createElement('div');
downloadLink.innerHTML = '<a href="' + fileUrl + '" >Save</a>';
row.insertBefore(downloadLink,row.firstChild);
}
