Skip to content

Instantly share code, notes, and snippets.

@carldanley
Last active April 29, 2016 15:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carldanley/02bf4f29593e5389df31 to your computer and use it in GitHub Desktop.
Save carldanley/02bf4f29593e5389df31 to your computer and use it in GitHub Desktop.
JSConf 2014 Schedule Bookmarker
( function() {
function highlightSchedule( tableIndex, scheduleValues ) {
var tables = document.querySelectorAll( 'table.schedule' );
if( tableIndex >= tables.length ) {
return;
}
var table = tables[ tableIndex ];
var rows = table.querySelectorAll( 'tr' );
for( var i = 0, len = scheduleValues.length; i < len; i++ ) {
var rowIndex = i + 1;
var childIndex = scheduleValues[ i ];
if( childIndex === -1 ) {
continue;
}
var rowElements = rows[ rowIndex ].querySelectorAll( 'td' );
var element = rowElements[ childIndex ];
element.style.backgroundColor = '#ffffcc';
}
}
highlightSchedule(0, [1,1,1,2,1,2,1,1,2,1,2,3,2,1,2,-1,1,1] );
highlightSchedule(1, [] );
} )();
/*
To Use:
1. Create a new bookmark in your browser
2. Copy the code above.
3. For the bookmark URL, type: "javascript:" and paste in the code you copied in step 2.
4. When you're on http://2014.jsconf.us/schedule.html, you can click your new bookmarklet to see your schedule.
How it works:
* the `tableIndex` refers to which schedule you want to outline.
* the `scheduleValues` refer to the `td` element in each row.
* the table header row is skipped.
* if you want to skip a row (ignore highlighting for that row), use a value of -1
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment