Skip to content

Instantly share code, notes, and snippets.

@tzi
Created July 7, 2012 21:29
Show Gist options
  • Save tzi/3068137 to your computer and use it in GitHub Desktop.
Save tzi/3068137 to your computer and use it in GitHub Desktop.
A #javascript #bookmarklet : To change CSS
(function(){
var is_old_view = false;
var current_css_href = "./themes/SilverScreen2/css/common.css";
var old_css_href = "./themes/SilverScreen2/css/common_old.css";
var link = document.querySelector( '[href="' + current_css_href + '"]' );
if ( link ) {
var popin = new bm_popin( 3068137 );
var switch_view = function() {
is_old_view = ! is_old_view ;
if ( is_old_view ) {
link.href = old_css_href;
popin.title( 'Old View' );
} else {
link.href = current_css_href;
popin.title( 'Current View' );
}
};
switch_view();
popin.add_button( 'Switch View', switch_view );
}
}) ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment