Skip to content

Instantly share code, notes, and snippets.

@choffee
Created June 15, 2009 12:05
Show Gist options
  • Save choffee/130068 to your computer and use it in GitHub Desktop.
Save choffee/130068 to your computer and use it in GitHub Desktop.
Script to highlight day of month for sun calendar
// ==UserScript==
// @name Calender date
// @namespace http://choffee.co.uk/code/
// @include https://calendar.york.ac.uk/command.shtml?view=monthview:main*
// ==/UserScript==
//
// This is neither pretty or clever but it does fix a really annoying bit in sun calendar
// for me. It highlights the current day.
// Note: It should also check that you are looking at the correct month!
//
//
// Add jQuery
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();
// All your GM code must be inside this function
function letsJQuery() {
// alert($); // check if the dollar (jquery) function works
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var cssObj = {
'background-color' : '#FFFFFF',
'font-weight' : 'bold',
'color' : 'red'
}
$("font[size=2]:contains('"+ day + "')").css(cssObj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment