Jump to content

Grease monkey script


jmaxxz

Recommended Posts

I want to make a greasemonkey script to auto magical increase the length of a password field. The site in question has a log form that ties into an active directory server, so passwords can be up to 127 chars in length. However this site has the password field limited to 32chars. (which is too small for my password, so I have been Manuel modifying the html each time I visit this site.)

How via javascript would I go about changing the length limit of a password field?

Thanks in advanced!

Link to comment
Share on other sites

first, get the <input> element of the password field

then, do the following with it:

pw_field.setAttribute('maxlength', 128);

i'm assuming you know how to get the element though.

if you know the id, its easy:

var pw_field = document.getElementById('pw_field_id')

if you dont know the id, you can loop through the inputs on the page:

var inputs = document.getElementsByTagName('input');
var pw_field;

for (var i = 0; i &lt; inputs.length; i++) {
    if (inputs[i].type == 'password') {
        pw_field = inputs[i];
    }
}

Link to comment
Share on other sites

first, get the <input> element of the password field

then, do the following with it:

pw_field.setAttribute('maxlength', 128);

i'm assuming you know how to get the element though.

if you know the id, its easy:

var pw_field = document.getElementById('pw_field_id')

if you dont know the id, you can loop through the inputs on the page:

var inputs = document.getElementsByTagName('input');
var pw_field;

for (var i = 0; i &lt; inputs.length; i++) {
    if (inputs[i].type == 'password') {
        pw_field = inputs[i];
    }
}

Ok thanks, I will give that a shot. I remember trying something similar before butI prolly just screwed up the attribute name.

THANKS :)

Link to comment
Share on other sites

Works like a charm!

var pw_field = document.getElementById('pw_field_id')

var inputs = document.getElementsByTagName('input');
var pw_field;

for (var i = 0; i &lt; inputs.length; i++) {
    if (inputs[i].type == 'password') {
        pw_field = inputs[i];
        pw_field.setAttribute('maxlength', 127);
    }
}

Thanks again!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...