The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Well, on memberlist search, there is the function for word (username) suggest:
![]() The HTML Code of this search field is: HTML Code:
<div class="fieldset"> Όνομα χρήστη (ψευδώνυμο) <div id="userfield"><input type="text" class="bginput" id="userfield_txt" size="50" name="ausername" value="" /></div> <div id="userfield_menu" class="vbmenu_popup" style="display:none"></div> <script type="text/javascript" src="clientscript/vbulletin_ajax_namesugg.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> <!-- vbmenu_register('userfield', true); snc = new vB_AJAX_NameSuggest('snc', 'userfield_txt', 'userfield'); //--> </script> </div> ---------------------------- function vB_AJAX_NameSuggest(C,A,D){var B=userAgent.match(/applewebkit\/([0-9]+)/);if(AJAX_Compatible&&!(is_saf&&!(B[1]>=412))){this.menuobj=fetch_object(D+"_menu");this .textobj=fetch_object(A);this.textobj.setAttribute ("autocomplete","off");this.textobj.onfocus=functi on(E){this.obj.active=true};this.textobj.onblur=fu nction(E){this.obj.active=false};this.textobj.obj= this;this.varname=C;this.menukey=D;this.fragment=" ";this.donenames="";this.selected=0;this.menuopen= false;this.timeout=null;this.names=new Array();this.active=false;this.ajax_req=null;this. allow_multiple=false;this.min_chars=3;this.get_tex t=function(){if(this.allow_multiple){var E=this.textobj.value.lastIndexOf(";");if(E==-1){this.donenames=new String("");this.fragment=new String(this.textobj.value)}else{this.donenames=new String(this.textobj.value.substring(0,E+1));this.f ragment=new String(this.textobj.value.substring(E+1))}}else{th is.fragment=new String(this.textobj.value)}this.fragment=PHP.trim( this.fragment)};this.set_text=function(E){if(this. allow_multiple){this.textobj.value=PHP.ltrim(this. donenames+" "+PHP.unhtmlspecialchars(this.names[E])+" ; ")}else{this.textobj.value=PHP.unhtmlspecialchars( this.names[E])}this.textobj.focus();this.menu_hide();return false};this.move_row_selection=function(E){var F=parseInt(this.selected,10)+parseInt(E,10);if(F<0 ){F=this.names.length-1}else{if(F>=this.names.length){F=0}}this.set_row_ selection(F);return false};this.set_row_selection=function(E){var F=fetch_tags(this.menuobj,"td");F[this.selected].className="vbmenu_option";this.selected=E;F[this.selected].className="vbmenu_hilite"};this.key_event_handler =function(E){E=E?E:window.event;if(this.menuopen){ switch(E.keyCode){case 38:this.move_row_selection(-1);return false;case 40:this.move_row_selection(1);return false;case 27:this.menu_hide();return false;case 13:this.set_text(this.selected);return false}}this.get_text();if(this.fragment.length>=th is.min_chars){clearTimeout(this.timeout);this.time out=setTimeout(this.varname+".name_search();",500) }else{this.menu_hide()}};this.name_search=function (){if(this.active){this.names=new Array();if(YAHOO.util.Connect.isCallInProgress(thi s.ajax_req)){YAHOO.util.Connect.abort(this.ajax_re q)}this.ajax_req=YAHOO.util.Connect.asyncRequest(" POST","ajax.php?do=usersearch",{success:this.handle_ajax_request,failure:vBulle tin_AJAX_Error_Handler,timeout:vB_Default_Timeout, scope:this},SESSIONURL+"securitytoken="+SECURITYTO KEN+"&do=usersearch&fragment="+PHP.urlencode(this. fragment))}};this.handle_ajax_request=function(F){ if(F.responseXML){var G=F.responseXML.getElementsByTagName("user");for(v ar E=0;E<G.length;E++){this.names[E]=G[E].firstChild.nodeValue}if(this.names.length>0){this .menu_build();this.menu_show()}else{this.menu_hide ()}}};this.menu_build=function(){this.menu_empty() ;var F=new RegExp("^("+PHP.preg_quote(this.fragment)+")","i") ;var G=document.createElement("table");G.cellPadding=4; G.cellSpacing=1;G.border=0;for(var E in this.names){if(YAHOO.lang.hasOwnProperty(this.name s,E)){var H=G.insertRow(-1).insertCell(-1);H.className=(E==this.selected?"vbmenu_hilite":" vbmenu_option");H.title="nohilite";H.innerHTML='<a onclick="return '+this.varname+".set_text("+E+')">'+this.names[E].replace(F,"<strong>$1</strong>")+"</a>"}}this.menuobj.appendChild(G);if(this.vbmenu==n ull){if(typeof (vBmenu.menus[this.menukey])!="undefined"){this.vbmenu=vBmenu.menus[this.menukey]}else{this.vbmenu=vBmenu.register(this.menukey,tru e)}}else{this.vbmenu.init_menu_contents()}};this.m enu_empty=function(){this.selected=0;while(this.me nuobj.firstChild){this.menuobj.removeChild(this.me nuobj.firstChild)}};this.menu_show=function(){if(t his.active){this.vbmenu.show(fetch_object(this.men ukey),this.menuopen);this.menuopen=true}};this.men u_hide=function(){try{this.vbmenu.hide()}catch(E){ }this.menuopen=false};this.textobj.onkeyup=functio n(E){return this.obj.key_event_handler(E)};this.textobj.onkeyp ress=function(E){E=E?E:window.event;if(E.keyCode== 13){return(this.obj.menuopen?false:true)}}}}; ------------------------------- For ajax.php?do=usersearch, in ajax.php there are these lines: PHP Code:
I want to use a similar word suggestion function on the search page of Mindestic GlosPro: ![]() HTML Code:
<td> $vbphrase[glossary_search_word]:<br /> <input type="text" class="bginput" name="search" value="$searchtermword" size="25"> </td> I think that I should create a copy of vbulletin_ajax_namesugg.js for example with the name vbulletin_ajax_termsugg.js with some changes, then to add an if ($_POST['do'] == 'glossarysearch') on ajax.php and finally to make some changes on the html code of the search field... Any help with these changes? ![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|