|
Viewing Single Post From: Add Dropdowns
|
|
Chris
|
Dec 3 2007, 08:17 PM
|
- Posts:
- 605
- Group:
- Members
- Member
- #103
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
- ZB Board URL
- http://s1.zetaboards.com/chris_codes/
|
Name: Add Dropdowns
Description This script will add a drop down to any menu at the top, such as Preferences, or Inbox. You just need to know how tell the script which section to add to. This function can be used any amount of times as needed. However, you need to make sure you ID correctly or it will not work.
I've taken the liberty of providing the ID's of the four, as well as an example of the first Variable in the function:
| Admin CP | Report CP | Preferences | Inbox
|
|---|
| ID | menu_acp | menu_rcp | menu_ucp | menu_pm
| | Var | $("#menu_acp").children("A") | $("#menu_rcp").children("A") | $("#menu_ucp").children("A") | $("#menu_pm").children("A")
|
Preview No preview at this time.
Installation [The Function]: Admin CP → Board Template: Below The Board
- Code: HTML
-
<script type='text/javascript'> var AddDropDown = function(This, Dir, Name){ Parent = This.parent(); Next= This.next(); if (!Parent.html().match("<ul>")){ Parent.append("<ul><li><a href='"+main_url+Dir+"'>"+Name+"</a></li></ul>"); } if (Parent.html().match("<ul>")){ Next.append("<li><a href='"+main_url+Dir+"'>"+Name+"</a></li>"); } } </script>
[The Execution]: Wherever
- Code: HTML
-
AddDropDown( String This [, String Dir [, String Name]]] );
- Paramaters
-
- This
-
The Menu to which drop downs may be added. Example for adding the the "Admin CP" drop down: $("#menu_acp").children("A")
The .children("A") is most important because the script checks if the next html code is a <ul> tag, and if not - it adds the tag. - Dir
-
Any path that comes after the ZetaBoard name. Example: forum/1/ Would output: http://s#Number#.zetaboards.com/#ZetaBoard Name#/forum/1/
The root path "http://s #Number#.zetaboards.com/ #ZetaBoard Name#/forum/1/" is stored in the variable: main_url- Name
-
The text which appears on each certain level of the single dropdown.
Just as a notice, you would not simply put out the Execution part. It needs to be inside a script tag wherever you need it. Ex:
- Code: HTML
-
<script type='text/javascript'> AddDropDown($("#menu_acp").children("A"), "admin/?menu=acp", "Controls"); </script>
Edited by Chris, Dec 3 2007, 08:27 PM.
|
|
|