Skip to content

Instantly share code, notes, and snippets.

@uhlenbrock
Created December 17, 2008 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhlenbrock/37123 to your computer and use it in GitHub Desktop.
Save uhlenbrock/37123 to your computer and use it in GitHub Desktop.
Bookmarklet for BlueprintCSS
/**
* Make this a "bookmarklet"
* 1. Remove the function enclosure
* 2. Remove spaces (http://userjs.up.seesaa.net/js/bookmarklet.html)
* 3. Add to your browser's bookmarks bar
*/
function toggle_showgrid() {
var d = Array.prototype.slice.call(document.getElementsByClassName('container'));
var id = document.getElementById('container');
if (id) { d.push(id); }
for (var i = 0; i < d.length; i++){
if (d[i].className.indexOf('showgrid') == -1) {
d[i].className = d[i].className + ' showgrid';
} else {
d[i].className = d[i].className.replace(/showgrid/,'');
}
}
void(0);
}
@procload
Copy link

procload commented Aug 9, 2011

javascript:(function toggle_showgrid() {
var d = document.getElementById('container');
if (d.className.indexOf('showgrid') == -1) {
d.className = d.className + ' showgrid';
} else {
d.className = d.className.replace(/showgrid/,'');
}
void(0);
})();

@uhlenbrock
Copy link
Author

Thanks, Ryan. I have updated the bookmarklet to account for both scenarios.

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