Preference window for userscripts

By devnull69 Last update Sep 30, 2009 — Installed 22,309 times.

Quick question

in
Subscribe to Quick question 2 posts, 2 voices



Cface Scriptwright
FirefoxWindows

So i've never made a menu for my scripts before and am having one, pretty simple, problem.

How do i have the option from the settings affect the script?

For example
i have this option {theName:'floatnav', theText:'Enable Floating Navbar?', theDefault:true}

and if it's true it does this:

if (floatnav == true){
// do this code
}

So i want to know is how do i make this happen?

Thanks for any help,
Cface

 
devnull69 Script's Author
FirefoxWindows

Hi,

the values are stored the same way as if you used GM_setValue. So you can get the value with GM_getValue. You can also use USP.getValue especially when you need to retrieve array values (which is not completely possible using GM_getValue).

if (GM_getValue('floatnav') == true){
// do this code
}

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel