New bookmarklet: Alphabetize

Here’s a time saver:
Check selected / all boxes
One click and you can check or uncheck all the checkboxes on the page. That is unless you have a selection of checkboxes highlighted; then it only operates on your selection. It works across frames too.

It’s based on the check all boxes bookmarklet which is a number of years old now. I’ve never needed to restrict my checking to a selection until today when setting permissions in drupal.

Here’s a few screenshots:

Selecting a portion of the permissions

Selecting a portion of the permissions

Next I click the bookmarklet:

Now all the highlighted boxes are checked

Now all the highlighted boxes are checked

Ahh, that is handy.

I can also use it on editing privileges to check all and the I only need to uncheck the first two boxes on each line (anonymous and authenticated).

It works in FF and Safari on my Mac. I usually see the same results on PC.
Not compatible with Opera, IE or Chrome.
I suppose it could be re-written to work in other browsers but I’m not compelled to do it.

Here are some testing grounds. If you haven’t already dragged the bookmarklet to your bookmarks toolbar then I pasted the link below the checkbox table. Give it a click!


Permission anonymous user authenticated user administrator administrator coder advanced editor camp editor moderator
view field_age_high

view field_age_low

view field_camp_email

view field_camp_website

view field_cost

view field_dates

view field_email

view field_end_date

view field_gender

view field_parent_signup

view field_paying

view field_times

view field_website


 

The link:
Check selected / all boxesBe sure to try highlighting several lines of the table and click the link again.


Here’s the code:

javascript:
if(typeof(G)=='undefined'||!G)
  G=true;
else
  G=false;
(function(){
  var C;
  (function(W){
    if (W.frames.length>0){
      for(i=0;i0)arguments.callee(W.frames[i]);else{
          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;
              }
            }
          }

        }
      }
    }
  })(top);
  C=document.getElementsByTagName(&#039;input&#039;);
  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;
      }
    }
  }
}
)();
Leave a Comment