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.

Difference between revisions of "User:Lethosor/JSMenu"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (warn)
m (→‎Installation: mypage, rm monobook)
Line 4: Line 4:
  
 
==Installation (not really)==
 
==Installation (not really)==
You need to  import [[User:Lethosor/main.js|this script]] in your user JavaScript page. It is located at (USERPAGE)/common.js, although you can also use the script at (USERPAGE)/vector.js if you use the vector theme (the default), or at (USERPAGE)/monobook.js if you use the monobook theme. You can find your theme under Preferences → Appearance.  
+
You need to  import [[User:Lethosor/main.js|this script]] in your [[Special:Mypage/common.js|user JavaScript page]] (although technically you can also use [[Special:Mypage/vector.js|this page]] if you use the vector theme (the default). You can find your theme under Preferences → Appearance.)
  
 
Add the following line (don't worry if the page doesn't exist yet):
 
Add the following line (don't worry if the page doesn't exist yet):

Revision as of 19:01, 3 March 2013

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

BIG SCARY WARNING: This page is currently under construction, as is the project it describes. Continuing to read this page may lead to disappointment when my project fails to accomplish anything interesting.

Installation (not really)

You need to import this script in your user JavaScript page (although technically you can also use this page if you use the vector theme (the default). You can find your theme under Preferences → Appearance.)

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.