Skip to content

Instantly share code, notes, and snippets.

@phillipadsmith
Created April 24, 2009 23:41
Show Gist options
  • Save phillipadsmith/101403 to your computer and use it in GitHub Desktop.
Save phillipadsmith/101403 to your computer and use it in GitHub Desktop.
Allows you to check all of the delete checkboxes in the Story Profile
// ==UserScript==
// @name Bricolage Delete All
// @namespace http://wiki.bricolage.cc/greasemonkey
// @description Allows you to check all of the delete checkboxes in the Story Profile
// @include *
// ==/UserScript==
(function () {
var spans = document.getElementsByTagName("span");
for(var i = 0; i < spans.length; i++) {
var span = spans[i];
if(span.className != "label") continue;
if(span.firstChild.data == "Delete") {
var deleteLink = document.createElement("a");
deleteLink.href = "#";
deleteLink.onclick = checkAllDeletes;
deleteLink.appendChild(document.createTextNode("(all)"));
span.appendChild(document.createTextNode(" "));
span.appendChild(deleteLink);
}
}
function checkAllDeletes() {
var toCheck = (this.allChecked == false) ? true : false;
var checkboxes = document.getElementsByTagName("input");
for(var i = 0; i < checkboxes.length; i++) {
var checkbox = checkboxes[i];
if (checkbox.type != "checkbox") continue;
if (checkbox.name.indexOf("container_prof|delete_") != -1) {
checkbox.checked = toCheck;
}
}
this.allChecked = (this.allChecked == false) ? true : false;
return false;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment