InterOcean Designs
« Add Menu Buttons »

Welcome Guest. Please Login or Register.
May 22, 2013, 9:18am





InterOcean Designs :: ProBoards Codes :: Code Chat & Support :: Add Menu Buttons
Page 1 of 2 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]
 AuthorTopic: Add Menu Buttons (Read 1,008 times)
OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Add Menu Buttons
« Thread Started on Nov 15, 2011, 10:55am »

Hey guys.

I've been looking for a code that will allow me to add more menu buttons to my forum, but I would also like it to be multiple skin compatible (var statements maybe?), and if possible have an option to let you choose if the new menu button will be visible to guests or members only.

Anyone know of a code out there?
« Last Edit: Feb 19, 2012, 9:09am by GFX Support »Link to Post - Back to Top  IP: Logged

[image]
GFX Support
GFX Designer
member is offline

[avatar]

Off duty



Joined: Apr 2009
Gender: Male
Posts: 1,962
Karma: 75
 Re: Add Menu Buttons
« Reply #1 on Nov 15, 2011, 12:30pm »

Wormo's code will give you the option to add several extra buttons, at any desired place, and has an option to hide them from guests. It's not multiple skin compatible, but if you ask him nicely I'm pretty sure he'll be able to add that feature. 8-)
Link to Post - Back to Top  IP: Logged

I'm off duty! For questions or support please contact RADesign or Speed Demon.
Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #2 on Nov 15, 2011, 12:56pm »

Hi OJ,

you can try this:
Code:
<script type="text/javascript">
/* Add buttons to menu bar if skinid and if guest */
<!--
var gv=0; // guest viewable = 1 not viewable = 0
var sv=1; // skinid viewable
if(pb_skinid==sv){if(((pb_username=="Guest")&&(gv==1))||(pb_username!=="Guest")){document.getElementsByTagName("font" )[3].innerHTML+='<a href="http://www.pebbleleague.com/index.cgi?action=display&board=forumrules&thread=47&page=1#7978"><img src="http://i1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/donate_off.png" border="0" alt="Donate"></a> ';
}
}
// -->
</script>


Obviously replacing my url to the button. Vars are self explanatary.
You can repeat the code for each button and putting in the relevant vars.
I've tried this in IE and FF and it works with Sub's customize menu bar code. (I haven't tried the flash version but I assume it's the same code for the menu bar). Put it above Subs menubar customize.
---------------------------------------------------------------------------------------------

I started knocking up this code which will be more user friendly (all the info will go in the vars at the top and just run a looped code) but it wasn't working in IE9 for some reason :-/ and I've run out of time: If anyone wants to mod it , feel free or I'll get back to it at the weekend some time.

Code:
<script type="text/javascript">
<!--
/* Add buttons to menu bar */
/* [skinid , Guestviewable=1 , url to button] */
var eb=[
[1,1,'urltobuttonONE'],
[1,0,'urltobuttonTWO']
];
ETC ETC
for(var x=0;x<eb.length;x++){
if((pb_skinid==eb[x][0])&&(gv==eb[x][1])) {document.getElementsByTagName("font")[3].innerHTML+=eb[x][2]}};
-->
</script>






Pebble.


EDIT: I've seen where I was going wrong and will re-do it at the weekend.
« Last Edit: Nov 15, 2011, 8:17pm by Pebble »Link to Post - Back to Top  IP: Logged

[image]

OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Re: Add Menu Buttons
« Reply #3 on Nov 15, 2011, 2:12pm »

Ah cool. Just one question. Where am I supposed to put the link the button will direct to?
Link to Post - Back to Top  IP: Logged

[image]
Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #4 on Nov 15, 2011, 8:04pm »

Code:
<script type="text/javascript">
/* Add buttons to menu bar if skinid and if guest */
<!--
var gv=0; // guest viewable = 1 not viewable = 0
var sv=1; // skinid viewable
if(pb_skinid==sv){if(((pb_username=="Guest")&&(gv==1))||(pb_username!=="Guest")){document.getElementsByTagName("font" )[3].innerHTML+='<a href="URL TO BUTTON DESTINATION"><img src="URL TO BUTTON IMAGE SOURCE" border="0" alt="HOVER TEXT FOR BUTTON"></a> ';
}
}
// -->
</script>




So in my original code you'd replace this:

http://www.pebbleleague.com/index.cgi?action=display&board=forumrules&thread=47&page=1#7978

with the url of where the button is going to take you.


And replace this:

http://i1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/donate_off.png

with the URL of the button image source. (from photobucket or where ever)

At the end of the line: Change 'Donate' to whatever you want the hover text for the button to be.




Link to Post - Back to Top  IP: Logged

[image]

OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Re: Add Menu Buttons
« Reply #5 on Nov 16, 2011, 2:12am »

Ah very nice Pebble! Works perfectly. Thanks alot bro. :)
Now would it be possible for you to make it all, so that I only have to use the code once, instead of having to put in a new copy for each one?
Link to Post - Back to Top  IP: Logged

[image]
Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #6 on Nov 16, 2011, 4:52am »

Great. Yep, I'll knock up something more user friendly and an all-in-one code this weekend to do the same thing.
Glad it worked for you. :)
Link to Post - Back to Top  IP: Logged

[image]

OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Re: Add Menu Buttons
« Reply #7 on Nov 16, 2011, 10:47am »

Ok, thanks bro. Let me know any updates on this. :)
Link to Post - Back to Top  IP: Logged

[image]
GFX Support
GFX Designer
member is offline

[avatar]

Off duty



Joined: Apr 2009
Gender: Male
Posts: 1,962
Karma: 75
 Re: Add Menu Buttons
« Reply #8 on Nov 16, 2011, 2:24pm »

Just let me know how this plays out, guys.
If all goes well, we can put this code in the 'Code Submissions' board. 8-)
« Last Edit: Nov 16, 2011, 2:25pm by GFX Support »Link to Post - Back to Top  IP: Logged

I'm off duty! For questions or support please contact RADesign or Speed Demon.
OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Re: Add Menu Buttons
« Reply #9 on Nov 16, 2011, 2:39pm »

Will do RAD. Just waiting on Pebble now. :P
Link to Post - Back to Top  IP: Logged

[image]
Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #10 on Nov 16, 2011, 9:08pm »

Give this a go:

Code:
<script type="text/javascript">
/* extra buttons if guest and if skin */
/* [a,b,c] */
/* [ skinid , guest viewable =1/not guest viewable = 0 , 'img and src code copied from photobucket html code'] , */


var eb=[
[1,1,'<a href="http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png" target="_blank"><img src="http://i1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png" border="0" alt="Photobucket"></a>'] ,
[2,1,'photobucketHTMLcodeforbutton'] ,
[3,1,'photobucketHTMLcodeforbutton'] ,
[4,1,'photobucketHTMLcodeforbutton'] ,
[5,0,'photobucketHTMLcodeforbutton']
];

var i=0;
for (i=0;i<eb.length;i++){
if(pb_skinid==eb[i][0]){if((pb_username!=="Guest")||((pb_username=="Guest")&&(eb[i][1]==1))){
document.getElementsByTagName("font" )[3].innerHTML+=eb[i][2];
}
}
}
</script>


The code looks really small now :-/ lol

Add or delete the [a,b,c] rows as needed (no comma after last one)
Dont forget the ' before and after the 3rd value in each row.
I've tried it with Sub's menu bar customize code in IE9 and FF.

I'm not sure if it's easier to leave the 3rd value as it is (the same as it is copied from photobucket html code selection) or to add another value so you can enter the image source and button URL destination seperately. Let me know what you think.

Pebble.
« Last Edit: Nov 16, 2011, 9:19pm by Pebble »Link to Post - Back to Top  IP: Logged

[image]

Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #11 on Nov 17, 2011, 3:56pm »

Just had a bit of airport time before I cross the pond while heading back to Chile.

Try out this much more user friendly version OJ and let me know how it goes:
(Keep an eye where those ' are, they are easy to miss !

Code:
<script type="text/javascript">
/* extra buttons if guest and if skin */
/* [a,b,'c','d','e'] */
/* [ skinid , guest viewable =1/not guest viewable = 0 , 'url to button destination' , 'url to image source' , 'hover text'] , */
/* example: [1,1,'http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png','http://i1136.p hotobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png','TESTEROOONY'] , */


var eb=[
[1,1,'http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png','http://i1136.p hotobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png','TESTEROOONY'] ,
[4,1,'buttondestinationurl','imagesrcurl','hovertext'] ,
[4,1,'buttondestinationurl','imagesrcurl','hovertext'] ,
[3,1,'buttondestinationurl','imagesrcurl','hovertext'] ,
[1,0,'http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png','http://i1136.p hotobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png','TESTEROOONY']
];

/* DON'T TOUCH BELOW HERE */
var i=0;
for (i=0;i<eb.length;i++){
if(pb_skinid==eb[i][0]){if((pb_username!=="Guest")||((pb_username=="Guest")&&(eb[i][1]==1))){
document.getElementsByTagName("font" )[3].innerHTML+=' <a href="'+eb[i][2]+'"><img src="'+eb[i][3]+'" border="0" alt="'+eb[i][4]+'">';
}
}
}
</script>


Tried and tested in IE and FF with subs code.

RAD - If all goes well when OJ tries it out , I'll clean it up and write some instructions for it - I've no problem at all with it been added to IOD's data base (though it's not really in the same league as Sub's codes and looks a bit meagre in comparison !)
« Last Edit: Nov 17, 2011, 4:11pm by Pebble »Link to Post - Back to Top  IP: Logged

[image]

OJ
Moderator
member is offline

[avatar]

[yim] [msn]
[homepage]

Joined: Nov 2010
Gender: Male
Posts: 976
Location: California
Karma: 53
 Re: Add Menu Buttons
« Reply #12 on Nov 17, 2011, 8:47pm »

Perfect bro. It's looking good so far. Thanks a million bro. I think you should add it RAD, as it does its job correctly. :)
Link to Post - Back to Top  IP: Logged

[image]
Pebble
Code Helper
IOD Supporter
member is offline

[avatar]


[homepage]

Joined: Mar 2011
Gender: Male
Posts: 1,179
Location: Here & There
Karma: 155
 Re: Add Menu Buttons
« Reply #13 on Nov 19, 2011, 2:41pm »

Hi OJ,
I've just made a little modification so that it works the same in all browsers. Just replace the code you have beneath the 'DO NOT TOUCH' with the code beneath the same heading below. The variables for each button are the same so you don't need to replace those.
And it's all finished and tidied up !

Code:
<script type="text/javascript">
/* extra buttons if guest and if skin */
/* [a,b,'c','d','e'] */
/* [ skinid , guest viewable =1/not guest viewable = 0 , 'url to button destination' , 'url to image source' , 'hover text'] , */
/* example: [1,1,'http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png','http://i1136.p hotobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png','TESTEROOONY'] , */


var eb=[
[1,1,'button-destination-url','image-src-url','hover-text'] ,
[1,1,'button-destination-url','image-src-url','hover-text'] ,
[1,0,'button-destination-url','image-src-url','hover-text'] ,
[2,1,'button-destination-url','image-src-url','hover-text'] ,
[3,1,'button-destination-url','image-src-url','hover-text']
];

/* DON'T TOUCH BELOW HERE */
var i=0;
for (i=0;i<eb.length;i++){
if(pb_skinid==eb[i][0]){
&nbsp; &nbsp;if((pb_username!=="Guest")||((pb_username=="Guest")&&(eb[i][1]==1))){
document.getElementsByTagName("font" )[3].innerHTML+=' <a href="'+eb[i][2]+'"><img src="'+eb[i][3]+'" border="0" alt="'+eb[i][4]+'" title="'eb[i][4]'">';
}
}
}
</script>


And here are a few instructions for anyone else that wants to use it:

Add Multiple Menu Buttons (with guest and skin options)

Location : Top of Global Header

Variables to enter :

[1,1,'button-destination-url','image-src-url','hover-text'] , // No commar , after last entry.

[skinid , guest viewable =1/not guest viewable = 0 , 'url to button destination' , 'url to image source' , 'hover text'] ,

DONT FORGET the ' at the start and end of each of the last 3 entries for each button.

example: If you want an extra menu button viewable on your 3rd skin and NOT viewable to guests then you would add to the list-

[3,0,'http://s1136.photobucket.com/albums/n494/pebbleleague/menubuttons2/?action=view¤t=5members_off.png','http://i1136.p hotobucket.com/albums/n494/pebbleleague/menubuttons2/5members_off.png','TESTEROOONY'] ,

Add / delete the number of entries to suit how many extra buttons you want to add.

This code works also works with Subdevo's Adjustable menu bar (and all his other codes as far as I know !)



Pebble.


« Last Edit: Nov 20, 2011, 6:46am by Pebble »Link to Post - Back to Top  IP: Logged

[image]

GFX Support
GFX Designer
member is offline

[avatar]

Off duty



Joined: Apr 2009
Gender: Male
Posts: 1,962
Karma: 75
 Re: Add Menu Buttons
« Reply #14 on Feb 19, 2012, 9:08am »

Pebble, don't you think you should post the above as a new thread in the 'code database' so others can find it?
Link to Post - Back to Top  IP: Logged

I'm off duty! For questions or support please contact RADesign or Speed Demon.
Page 1 of 2 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]


Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Notice | FTC Disclosure | Report Abuse | Mobile