Skip to content

Instantly share code, notes, and snippets.

@kswedberg
Forked from paulirish/gist:221905
Created October 30, 2009 19:59
Show Gist options
  • Save kswedberg/222658 to your computer and use it in GitHub Desktop.
Save kswedberg/222658 to your computer and use it in GitHub Desktop.
// easy refresh-css keybinding to alt-w
// alt-r was taken in IE, so consider this a CSS Weefresh
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/
$(document).keyup(function(e){
if ( e.which == 87 && e.altKey){
var h=0,a=document.getElementsByTagName('link'),l=a.length,f;
for(;h<l;h++){
f=a[h];
if((/stylesheet/i).test(f.rel)&&f.href){
var g=f.href.replace(/(&|\?)forceReload=\d+/,'');
f.href=g+((/\?/).test(g)?'&':'?')+'forceReload='+new Date;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment