Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 03-23-2008, 10:29 PM
AbercrombieAron AbercrombieAron is offline
 
Join Date: Mar 2008
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Javascript Code Help

I'm looking to remove the menu_open.gif from the dropdowns, but JS is not my strong point.

Can somebody with a better understanding please help me to alter the script.

Thanks in advance.

Code:
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.7.0 Release Candidate 1
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000-2008 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
vBulletin.add_event("vBmenuShow");vBulletin.add_event("vBmenuHide");function vB_Popup_Handler(){this.open_steps=10;this.open_fade=false;this.active=false;this.menus=new Array();this.activemenu=null}vB_Popup_Handler.prototype.activate=function(A){this.active=A;console.log("vBmenu :: System Activated")};vB_Popup_Handler.prototype.register=function(D,A,C){this.menus[D]=new vB_Popup_Menu(D,A,C);var B=YAHOO.util.Dom.get("usercss");if(B&&YAHOO.util.Dom.isAncestor(B,D)){this.menus[D].imgsrc=IMGDIR_MISC+"/menu_open_usercss.gif"}this.menus[D].startup();return this.menus[D]};vB_Popup_Handler.prototype.hide=function(){if(this.activemenu!=null){this.menus[this.activemenu].hide()}};var vBmenu=new vB_Popup_Handler();function vbmenu_hide(A){if(A&&A.button&&A.button!=1&&A.type=="click"){return true}else{vBmenu.hide()}}function vB_Popup_Menu(C,A,B){this.controlkey=C;this.noimage=A;this.noslide=B;this.menuname=this.controlkey.split(".")[0]+"_menu";this.imgsrc=IMGDIR_MISC+"/menu_open.gif"}vB_Popup_Menu.prototype.startup=function(){this.init_control(this.noimage);if(fetch_object(this.menuname)){this.init_menu()}this.slide_open=(this.noslide?false:true);this.open_steps=vBmenu.open_steps;vBulletin.add_event("vBmenuShow_"+this.controlkey);vBulletin.add_event("vBmenuHide_"+this.controlkey)};vB_Popup_Menu.prototype.init_control=function(A){this.controlobj=fetch_object(this.controlkey);this.controlobj.state=false;if(this.controlobj.firstChild&&(this.controlobj.firstChild.tagName=="TEXTAREA"||this.controlobj.firstChild.tagName=="INPUT")){}else{if(!A&&!(is_mac&&is_ie)){var C=document.createTextNode(" ");this.controlobj.appendChild(C);var B=document.createElement("img");B.src=this.imgsrc;B.border=0;B.title="";B.alt="";this.img=this.controlobj.appendChild(B)}this.controlobj.unselectable=true;if(!A){this.controlobj.style.cursor=pointer_cursor}this.controlobj.onclick=vB_Popup_Events.prototype.controlobj_onclick;this.controlobj.onmouseover=vB_Popup_Events.prototype.controlobj_onmouseover}};vB_Popup_Menu.prototype.init_menu=function(){this.menuobj=fetch_object(this.menuname);this.select_handler=new vB_Select_Overlay_Handler(this.menuobj);if(this.menuobj&&!this.menuobj.initialized){this.menuobj.initialized=true;this.menuobj.onclick=e_by_gum;this.menuobj.style.position="absolute";this.menuobj.style.zIndex=50;if(is_ie&&!is_mac){if(!is_ie7){this.menuobj.style.filter+="alpha(enabled=1,opacity=100)"}else{this.menuobj.style.minHeight="1%"}}this.init_menu_contents()}};vB_Popup_Menu.prototype.init_menu_contents=function(){var E=new Array("td","li");for(var D=0;D<E.length;D++){var H=fetch_tags(this.menuobj,E[D]);for(var F=0;F<H.length;F++){if(H[F].className=="vbmenu_option"){if(H[F].title&&H[F].title=="nohilite"){H[F].title=""}else{H[F].controlkey=this.controlkey;H[F].onmouseover=vB_Popup_Events.prototype.menuoption_onmouseover;H[F].onmouseout=vB_Popup_Events.prototype.menuoption_onmouseout;var C=fetch_tags(H[F],"a");if(C.length==1){H[F].className=H[F].className+" vbmenu_option_alink";H[F].islink=true;var B=C[0];var A=false;H[F].target=B.getAttribute("target");if(typeof B.onclick=="function"){H[F].ofunc=B.onclick;H[F].onclick=vB_Popup_Events.prototype.menuoption_onclick_function;A=true}else{if(typeof H[F].onclick=="function"){H[F].ofunc=H[F].onclick;H[F].onclick=vB_Popup_Events.prototype.menuoption_onclick_function;A=true}else{H[F].href=B.href;H[F].onclick=vB_Popup_Events.prototype.menuoption_onclick_link}}if(A){var G=document.createElement("a");G.innerHTML=B.innerHTML;G.href="#";G.onclick=function(I){I=I?I:window.event;I.returnValue=false;return false};H[F].insertBefore(G,B);H[F].removeChild(B)}}else{if(typeof H[F].onclick=="function"){H[F].ofunc=H[F].onclick;H[F].onclick=vB_Popup_Events.prototype.menuoption_onclick_function}}}}}}};vB_Popup_Menu.prototype.show=function(B,A){if(!vBmenu.active){return false}else{if(!this.menuobj){this.init_menu()}}if(!this.menuobj||vBmenu.activemenu==this.controlkey){return false}console.log("vBmenu :: Show '%s'",this.controlkey);if(vBmenu.activemenu!=null&&vBmenu.activemenu!=this.controlkey){vBmenu.menus[vBmenu.activemenu].hide()}vBmenu.activemenu=this.controlkey;this.menuobj.style.display="";if(this.slide_open){this.menuobj.style.clip="rect(auto, 0px, 0px, auto)"}this.set_menu_position(B);if(!A&&this.slide_open){this.intervalX=Math.ceil(this.menuobj.offsetWidth/this.open_steps);this.intervalY=Math.ceil(this.menuobj.offsetHeight/this.open_steps);this.slide((this.direction=="left"?0:this.menuobj.offsetWidth),0,0)}else{if(this.menuobj.style.clip&&this.slide_open){this.menuobj.style.clip="rect(auto, auto, auto, auto)"}}this.select_handler.hide();if(this.controlobj.editorid){this.controlobj.state=true;vB_Editor[this.controlobj.editorid].menu_context(this.controlobj,"mousedown")}vBulletin.events["vBmenuShow_"+this.controlkey].fire(this.controlkey);vBulletin.events.vBmenuShow.fire(this.controlkey)};vB_Popup_Menu.prototype.set_menu_position=function(A){this.pos=this.fetch_offset(A);this.leftpx=this.pos.left;this.toppx=this.pos.top+A.offsetHeight;if((this.leftpx+this.menuobj.offsetWidth)>=document.body.clientWidth&&(this.leftpx+A.offsetWidth-this.menuobj.offsetWidth)>0){this.leftpx=this.leftpx+A.offsetWidth-this.menuobj.offsetWidth;this.direction="right"}else{this.direction="left"}if(this.controlkey.match(/^pagenav\.\d+$/)){A.appendChild(this.menuobj)}this.menuobj.style.left=this.leftpx+"px";this.menuobj.style.top=this.toppx+"px"};vB_Popup_Menu.prototype.hide=function(A){if(A&&A.button&&A.button!=1){return true}console.log("vBmenu :: Hide '%s'",this.controlkey);this.stop_slide();this.menuobj.style.display="none";this.select_handler.show();if(this.controlobj.editorid){this.controlobj.state=false;vB_Editor[this.controlobj.editorid].menu_context(this.controlobj,"mouseout")}vBmenu.activemenu=null;vBulletin.events["vBmenuHide_"+this.controlkey].fire(this.controlkey);vBulletin.events.vBmenuHide.fire(this.controlkey)};vB_Popup_Menu.prototype.hover=function(A){if(vBmenu.activemenu!=null){if(vBmenu.menus[vBmenu.activemenu].controlkey!=this.id){this.show(A,true)}}};vB_Popup_Menu.prototype.slide=function(C,B,A){if(this.direction=="left"&&(C<this.menuobj.offsetWidth||B<this.menuobj.offsetHeight)){C+=this.intervalX;B+=this.intervalY;this.menuobj.style.clip="rect(auto, "+C+"px, "+B+"px, auto)";this.slidetimer=setTimeout("vBmenu.menus[vBmenu.activemenu].slide("+C+", "+B+", "+A+");",0)}else{if(this.direction=="right"&&(C>0||B<this.menuobj.offsetHeight)){C-=this.intervalX;B+=this.intervalY;this.menuobj.style.clip="rect(auto, "+this.menuobj.offsetWidth+"px, "+B+"px, "+C+"px)";this.slidetimer=setTimeout("vBmenu.menus[vBmenu.activemenu].slide("+C+", "+B+", "+A+");",0)}else{this.stop_slide()}}};vB_Popup_Menu.prototype.stop_slide=function(){clearTimeout(this.slidetimer);this.menuobj.style.clip="rect(auto, auto, auto, auto)"};vB_Popup_Menu.prototype.fetch_offset=function(E){if(E.getBoundingClientRect){var C=E.getBoundingClientRect();var D=Math.max(document.documentElement.scrollTop,document.body.scrollTop);var F=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);if(document.documentElement.dir=="rtl"){F=F+document.documentElement.clientWidth-document.documentElement.scrollWidth}return{left:C.left+F,top:C.top+D}}var B=E.offsetLeft;var A=E.offsetTop;while((E=E.offsetParent)!=null){B+=E.offsetLeft;A+=E.offsetTop}return{left:B,top:A}};function vB_Popup_Events(){}vB_Popup_Events.prototype.controlobj_onclick=function(A){if(typeof do_an_e=="function"){do_an_e(A);if(vBmenu.activemenu==null||vBmenu.menus[vBmenu.activemenu].controlkey!=this.id){vBmenu.menus[this.id].show(this)}else{vBmenu.menus[this.id].hide()}}};vB_Popup_Events.prototype.controlobj_onmouseover=function(A){if(typeof do_an_e=="function"){do_an_e(A);vBmenu.menus[this.id].hover(this)}};vB_Popup_Events.prototype.menuoption_onclick_function=function(A){this.ofunc(A);vBmenu.menus[this.controlkey].hide()};vB_Popup_Events.prototype.menuoption_onclick_link=function(A){A=A?A:window.event;if(A.shiftKey||(this.target!=null&&this.target!=""&&this.target.toLowerCase()!="_self")){if(this.target!=null&&this.target.charAt(0)!="_"){window.open(this.href,this.target)}else{window.open(this.href)}}else{window.location=this.href;return false}A.cancelBubble=true;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}vBmenu.menus[this.controlkey].hide();return false};vB_Popup_Events.prototype.menuoption_onmouseover=function(A){this.className="vbmenu_hilite"+(this.islink?" vbmenu_hilite_alink":"");this.style.cursor=pointer_cursor};vB_Popup_Events.prototype.menuoption_onmouseout=function(A){this.className="vbmenu_option"+(this.islink?" vbmenu_option_alink":"");this.style.cursor="default"};
Reply With Quote
  #2  
Old 03-24-2008, 02:51 AM
briansol's Avatar
briansol briansol is offline
 
Join Date: Apr 2006
Location: CT
Posts: 254
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

change
this.imgsrc=IMGDIR_MISC+"/menu_open.gif"
to
this.imgsrc=/clear.gif"
Reply With Quote
  #3  
Old 03-24-2008, 12:05 PM
AbercrombieAron AbercrombieAron is offline
 
Join Date: Mar 2008
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A actually tried something similar to this and it worked in FireFox but not IE.
Your method also breaks the DHTML.
Reply With Quote
  #4  
Old 04-06-2008, 12:20 PM
AbercrombieAron AbercrombieAron is offline
 
Join Date: Mar 2008
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just to bump this back up.

Any suggestions?
Reply With Quote
  #5  
Old 04-06-2008, 03:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you put in exactly what he wrote or add an extra quote like this:
this.imgsrc="/clear.gif"

(Also, that javascript is very difficult to read like that. You'd do better pasting in the non-compressed version.)
Reply With Quote
  #6  
Old 06-22-2008, 06:24 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For specific elements, you can add a second parameter of 1 to vbmenu_register() to remove the arrow
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:09 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04938 seconds
  • Memory Usage 2,227KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete