Created
December 17, 2008 16:30
-
-
Save uhlenbrock/37123 to your computer and use it in GitHub Desktop.
Bookmarklet for BlueprintCSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); | |
} |
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
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);
})();