Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Add Dropdowns; Simple Yet Effective :)
Topic Started: Dec 3 2007, 08:17 PM (4,007 Views)
Chris
Member Avatar
Member
[ *  *  *  * ]
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 CPReport CPPreferencesInbox
IDmenu_acpmenu_rcpmenu_ucpmenu_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.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
It's a good idea dude. I personally like it but I think it can be more user-friendly.
Offline Profile Quote Post Goto Top
 
Chris
Member Avatar
Member
[ *  *  *  * ]
Its part of my Easy Manager script series to be. I thought it would be nice to put it out separately from the main code :)
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Ah, well then I'm looking forward to that then. Best of luck dude.
Offline Profile Quote Post Goto Top
 
badtzmaru
Member Avatar
Member
[ *  *  * ]
Thank you! :) I'm going to track this topic in case I want to use it in the future. I read through your instructions a couple of time, and I think I get it although I haven't tried it out yet to see if I fully understand. You did a great job explaining this for newbies like me! :D

P.S. How did you make that table? @_@;;
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Using BBCode. :D

Here, I'll post his for you in code format.

Code:
 

[table=5,,1]
[c][b][color=#090]Admin CP[/color][/b]
[c][b][color=#090]Report CP[/color][/b]
[c][b][color=#090]Preferences[/color][/b]
[c][b][color=#090]Inbox[/color][/b]

[c][b][color=#090]ID[/color][/b]
[c]menu_acp
[c]menu_rcp
[c]menu_ucp
[c]menu_pm

[c][b][color=#090]Var[/color][/b]
[c]$("#menu_acp").children("A")
[c]$("#menu_rcp").children("A")
[c]$("#menu_ucp").children("A")
[c]$("#menu_pm").children("A")

[/table]
Edited by Eureka, Dec 4 2007, 02:01 PM.
Offline Profile Quote Post Goto Top
 
badtzmaru
Member Avatar
Member
[ *  *  * ]
Thank youu... +_+ Yess, this is what I wanted... >:)

*studies code*
Offline Profile Quote Post Goto Top
 
Chris
Member Avatar
Member
[ *  *  *  * ]
Its a little something different for documentation purposes. I've never tried it this way, but it is modeled after the http://php.net function pages.

I hope it makes some sense.

And for explanations of this:
Quote:
 
AddDropDown( String This [, String Dir [, String Name]]] );
The Blue is telling you what type of variable should be used.
In all three cases, it is a String - which can be anything.
Strings are not the only ones that exist though.

Parameter Types
TypeDescription
UndefinedNothing, basically. It is not yet defined. (Usually for return functions)
ObjectAny object created manually with new Object() or functionally created with .getElement(ById, sByTagName)(" (Id or TagName)");
FunctionA call back or something to be executed during the current function.
NumberAny Real Number (Cannot be imaginary)
BooleanEither "true" or "false"
StringSomething that doesn't fall under any above type

Edited by Chris, Dec 4 2007, 07:48 PM.
Offline Profile Quote Post Goto Top
 
Ruzarik
Member Avatar
Leader of the Rogue Army
[ *  * ]
It seems a bit complex. And I think I saw another one of this kind somewhere else on this site.
Offline Profile Quote Post Goto Top
 
Ambrosia
Member
[ *  * ]
So let's say I want a drop down menu and in it 2 names 'Jizo' & 'Rimbo' (under eachother offcourse).
When they are clicked on it takes a user to 'compose a message' to either one of those respectively (with the name automatically filled in and all.

Would that be possible?
And if it can be positioned between Preferences and Report CP that would be grand.
As users don't see ReportCP and AdminCP, unless the new menu will automatically allign itself next to whichever box a user sees.

If it's possible please write the full code and highlight the part I can edit with a particular users ID (so the PM doesn't get sent to someone else).
With the name of the dropdown menu being 'Admin PM'.

Example: Admin PM > Jizo/Rimbo> http://s1.zetaboards.com/Individual/msg/?c=2&mid=117463
Red being the part that can be changed and more users can be added to the list if necessary.
Edited by Ambrosia, May 21 2008, 07:37 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply