v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

User:Lethosor/JSMenu

From Dwarf Fortress Wiki
< User:Lethosor
Revision as of 23:50, 28 February 2013 by Lethosor (talk | contribs) (Created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is my project page for JavaScript plugins. The script can be found [[./main.js|here]]. Note that it uses jQuery - the version on this wiki is 1.4.2.

Installation (not really)

You need to import [[./main.js|this script]] in your user JavaScript page. It could be at (USERPAGE)/common.js or (USERPAGE)/monobook.js (if you don't know, it's probably common.js). Add the following line (don't worry if the page doesn't exist yet):

importScript("User:Lethosor/main.js");

If you don't have permission to create that page, send me a message.

Save the page, then reload again. "LethosorMenu" should appear in the navigation bar at the top (by the "Log out" link). If it doesn't, follow the instructions on your user JavaScript page to empty the cache.

Advanced options

Under construction for now, most of this is still to be worked on before it's released.

This script accepts multiple options to control execution. You can set plugins to run on page load or with a shortcut.

This script uses JSON to pass options.

Create the following page, anywhere under your user page that you want:

LE_USER_OPTS = {}

Then import it in your user JavaScript file with the following:

importScript("User:(USERNAME)/(Script you just created).js");
importScript("User:Lethosor/main.js");

Note that you can import your settings after this script, but you will need to use this code instead:

importScript("User:Lethosor/main.js");
importScript("User:(USERNAME)/(Script you just created).js");
LE.update_opts();

menu

This object controls basic appearance and functionality of the menu itself.

show_overlay

true shows the grey overlay when the menu appears. false doesn't.

Technical

I use delegate() for some event handlers, which won't work prior to jQuery 1.4.2. It's deprecated in 1.9.0, but it works.