Skip to content

Instantly share code, notes, and snippets.

@mcfearsome
Created August 26, 2008 15:51
Show Gist options
  • Save mcfearsome/7285 to your computer and use it in GitHub Desktop.
Save mcfearsome/7285 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name dvr1
// @description TV Planner - add DVR button
// @include http://tvplanner.comcast.net/*
// ==/UserScript==
// john javes 8/26/2008
var thisElement;
var onTimeout = function(){
alert('time');
var classarray = document.getElementsByClassName('grid-listing-container');
//alert(classarray.length); // its 1242 !!!!
for (var i = 0; i < 60; i++) { //just do the first 60; its barfing on full array of 1242
thisElement = classarray[i];
thisElement.addEventListener('click', fillinDVR, false);
var dvrlink = document.createElement('a');
dvrlink.id = 'dvr';
thisElement.appendChild(dvrlink);
dvrlink.style.display = 'block';
dvrlink.style.clear = 'both';
dvrlink.style.cssFloat = 'left';
dvrlink.style.border = '1px solid blue';
dvrlink.style.backgroundColor = 'wheat';
dvrlink.style.margin = '18px 0 0 15px';
dvrlink.style.padding = '1px';
dvrlink.style.fontSize = '8px';
dvrlink.innerHTML = 'DVR';
dvrlink.style.width = '25px';
dvrlink.setAttribute("href", "http://dvr.comcast.net/recordshow/" + thisElement.id);
}
}
setTimeout(onTimeout, 10000); //it takes a while to load the grid listings!
function fillinDVR(){
//alert(this.id);
var DC = document.getElementById('details-header');
var DCdvrlink = document.createElement('a');
DC.appendChild(DCdvrlink);
DCdvrlink.id = 'dvr';
//DCdvrlink.style.display = 'block';
//DCdvrlink.style.clear = 'both';
//DCdvrlink.style.cssFloat = 'left';
DCdvrlink.style.border = '1px solid blue';
DCdvrlink.style.backgroundColor = 'wheat';
DCdvrlink.style.margin = '18px 0 0 15px';
DCdvrlink.style.padding = '1px';
DCdvrlink.style.fontSize = '8px';
DCdvrlink.innerHTML = 'DVR';
DCdvrlink.style.width = '25px';
DCdvrlink.setAttribute("href", "http://dvr.comcast.net/recordshow/" + thisElement.id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment