Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active November 11, 2016 15:19
Show Gist options
  • Save anthonybudd/a5b942280e208d1b0e3dd942a5973a9d to your computer and use it in GitHub Desktop.
Save anthonybudd/a5b942280e208d1b0e3dd942a5973a9d to your computer and use it in GitHub Desktop.
// PASTE INTO JS CONSOLE ON FREEAGENT
(function(){
var canvas = document.createElement("canvas");
canvas.width = 16;
canvas.height = 16;
var ctx = canvas.getContext('2d');
var loop = setInterval(function(){
if($('span.running').length == 0){
$('link[rel="Shortcut Icon"]').attr('href', '/favicon.ico');
}else{
if($('link[rel="Shortcut Icon"]').attr('href') == '/favicon.ico'){
ctx.beginPath();
ctx.arc((canvas.width/2), (canvas.height/2), 8, 0, 2 * Math.PI, false);
ctx.fillStyle = '#FF0000';
ctx.fill();
$('link[rel="Shortcut Icon"]').attr('href', canvas.toDataURL("image/png"));
}else{
$('link[rel="Shortcut Icon"]').attr('href', '/favicon.ico');
}
}
}, 1000);
$('.widget_main.widget_field input.button.add').click(function(){
var monthNames = [
"Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct",
"Nov", "Dec"
];
var date = new Date();
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear().toString().substr(2,2);
console.log(day +' '+ monthNames[monthIndex] +' '+ year);
$('input.timeslip_calendar').eq(0).val(day +' '+ monthNames[monthIndex] +' '+ year)
});
}());
@RussellBishop
Copy link

Tasty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment