Welcome Guest [Log In] [Register]
Viewing Single Post From: Add more links to Submenu
Reid.
C'est un piège!
[ *  *  * ]
This allows you to add as many links to the submenu as necessary. It does require a bit of setup, but it isn't really hard.

First: you have to decide if you want the link to come before or after the links that are already there (search, members, .... etc.) This isn't really hard to do either. You can chose quite a few options.

So here we go. Here's the code.
Code:
 
<script type='text/javascript'>
// <![CDATA[
var links = [], n = 0;
//start editing here
var before = false;
links[n++] = ['http://www.google.com/','Google','before'];
links[n++] = ['http://www.yahoo.com/','Yahoo'];
links[n++] = ['http://if.invisionfree.com/','Support Board'];
//your ride ends here. :(
//if you do know how to edit this, feel free to, though.
var l = links.length;
while (l--){
var c = document.getElementById('submenu'), urlstr = "<a href='" + links[l][0] + "'>" + links[l][1] + "</a>";
if (before && links[l][2] && links[l][2].toLowerCase().indexOf("after") == -1) c.innerHTML = urlstr + " " + c.innerHTML;
else if (before && links[l][2] && links[l][2].toLowerCase().indexOf("after")!=-1) c.innerHTML += " " + urlstr;
else if (before && !links[l][2]) c.innerHTML = urlstr + " " + c.innerHTML;
else if (links[l][2] && links[l][2].indexOf("before")!=-1) c.innerHTML = urlstr + " " + c.innerHTML;
else c.innerHTML += " " + urlstr;
}
// ]]>
</script>
Okay... looks like a lot, right? It's not THAT bad.

See the part that says
Code:
 
var before = false;
? That's where the setup starts.

Basically... you can chose if you want all links to go before the links or not. If you want them all to go before, change that to
Code:
 
var before = true;
If not, just leave it how it is.

Here comes the adding links part. So here's the basic format:
Code:
 
links[n++] = ['url to link','What you want the link to say','before or after (optional)'];
Be sure not to get your commas and quotation marks mixed up - this is coding, not grammar, so the comma will go after the quotation mark most of the time.

You can add more or less of these links as needed. Here's another example:
Spoiler: click to toggle

If there are any questions setting it up, feel free to post in this topic or PM me on this or any board you may find me on.

And, another example, just for you guys.
Spoiler: click to toggle


Good luck!
Offline Profile Quote Post
Add more links to Submenu · Code & Modification Database