Creating userscripts...

Ichinisan

Lifer
Oct 9, 2002
28,298
1,236
136
I've experimented a bit with creating my own userscripts to make some systems at work more usable. Some of the web systems have problems with anything other than IE6. I've been able to make some minor tweaks and it's promising that I'll be able to improve efficiency a lot by making a few userscripts.

I use Google Chrome primarily. I can see that it auto-fills the fields on a log-in screen that I use every day, but the fields are immediately cleared by some initialization javascript that sets each field to null.

I tried making a userscript to set the value of the first text field, but it doesn't work. I'm not sure if the userscript executes before or after that bit of javascript clears the fields.

Is it possible to make a user script that cancels the initialization by removing the specific lines of javascript?

Thanks!
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,835
4,815
75
The easiest way to stop a Javascript script from running is to use AdBlock to block it. I do that for the image resizer script here on the forums; then I use CSS to resize the image more cleanly.
 

Ichinisan

Lifer
Oct 9, 2002
28,298
1,236
136
Haven't tried to do anything like that with AdBlock before.

Anyway, I just tried to do a basic "Hello, world!" on that lo-in page with a userscript and it won't do anything. I'm definitely failing somewhere.

Code:
// ==UserScript==
// @include     http*[removed]/index.do*
alert("Hello, world!");

Looking at the source, it seems there are no frames or anything to complicate the scope of the INCLUDE statement.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,835
4,815
75
I think you need a name and a /UserScript.
Code:
// ==UserScript==
// @name           Alert test
// @include        http*[removed]/index.do*
// ==/UserScript==
alert("Hello, world!");
 

Ichinisan

Lifer
Oct 9, 2002
28,298
1,236
136
My other two scripts work and they don't have names:

Code:
// ==UserScript==
// @include     http://[url removed]/*

document.getElementById("status").selectedIndex = 1;

Code:
// ==UserScript==
// @include     http://[url removed]/*

document.getElementById("descrpt").setAttribute("style","height: 170px; width: 500px;");