Skip to content

Instantly share code, notes, and snippets.

@gvlx
Created October 17, 2019 09:26
Show Gist options
  • Save gvlx/c9c6b0b72d34fbfb832dbaa5358d3439 to your computer and use it in GitHub Desktop.
Save gvlx/c9c6b0b72d34fbfb832dbaa5358d3439 to your computer and use it in GitHub Desktop.
Check selected / all boxes bookmarklet
// derived and corrected from https://blogs.uoregon.edu/developments/2010/01/28/check-selected-all-boxes-bookmarklet/
javascript:
if (typeof(G) == 'undefined' || !G)
G = true;
else
G = false;
(function() {
var C;
(function(W) {
if (W.frames.length > 0) {
C = W.frames[i].document.getElementsByTagName('input');
if (W.frames[i].getSelection && W.frames[i].getSelection().containsNode) {
if (W.frames[i].getSelection() != "") {
for (var j = 0; j < C.length; j++) {
if (W.frames[i].getSelection().containsNode(C[j], true)) {
C[j].checked = G;
}
}
} else {
for (var j = 0; j < c.length; j++) {
C[j].checked = G;
}
}
}
}
})(window.top);
C = document.getElementsByTagName('input');
if (window.getSelection && window.getSelection().containsNode) {
if (window.getSelection() != "") {
for (var i = 0; i < C.length; i++) {
if (window.getSelection().containsNode(C[i], true)) {
C[i].checked = G;
}
}
} else {
for (var i = 0; i < C.length; i++) {
C[i].checked = G;
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment