/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.8.3
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2009 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 # ||
|| #################################################################### ||
\*======================================================================*/
var vB_UserList_Highlighters=new Object();var vB_UserList_Filters=new Object();vBulletin.events.systemInit.subscribe(function(){var C,A=null,B=null;if(vBulletin.elements.vB_UserList_Highlighter){for(C=0;C<vBulletin.elements.vB_UserList_Highlighter.length;C++){A=vBulletin.elements.vB_UserList_Highlighter[C][0];vB_UserList_Highlighters[A]=new vB_UserList_Highlighter(A)}vBulletin.elements.vB_UserList_Highlighter=null}if(vBulletin.elements.vB_UserList_Saver){for(C=0;C<vBulletin.elements.vB_UserList_Saver.length;C++){new vB_UserList_Saver(vBulletin.elements.vB_UserList_Saver[C][0])}vBulletin.elements.vB_UserList_Saver=null}if(vBulletin.elements.vB_UserList_Filter){for(C=0;C<vBulletin.elements.vB_UserList_Filter.length;C++){B=vBulletin.elements.vB_UserList_Filter[C];vB_UserList_Filters[C]=new vB_UserList_Filter(B[0],B[1],B[2])}vBulletin.elements.vB_UserList_Filter=null}});function vB_UserList_Saver(A){this.ajax_request=null;this.prefix=A;this.change_form=YAHOO.util.Dom.get(this.prefix+"_change_form");YAHOO.util.Event.on(this.change_form,"submit",this.handle_form_submit,this,true);this.add_form=YAHOO.util.Dom.get(this.prefix+"_add_form");YAHOO.util.Event.on(this.add_form,"submit",this.handle_form_submit,this,true)}vB_UserList_Saver.prototype.handle_form_submit=function(G){YAHOO.util.Event.stopEvent(G);var F=YAHOO.util.Event.getTarget(G);if(F.tagName!="FORM"){F=F.form}var B=null;var C=null;var H=YAHOO.util.Dom.get("incomingaction_reject");if(F.userlist.value=="buddy"){B="buddylist";C=false}else{if(F.userlist.value=="incoming"&&H.checked==true){B="incomingreqs";C=true}}if(B&&F.id.match(/_change_form$/)){for(var E=0;E<vB_UserList_Highlighters[B].items.length;E++){if(B=="buddylist"){if(vB_UserList_Highlighters[B].items[E].origfriend==true&&vB_UserList_Highlighters[B].items[E].friendcheck.checked==false){if(!confirm(vbphrase.remove_from_userlist_confirm)){return false}break}}if(vB_UserList_Highlighters[B].items[E].usercheck.checked==C){if(!confirm(vbphrase.remove_from_userlist_confirm)){return false}break}}}var A=F.id.replace(/_form$/,"_progress");YAHOO.util.Dom.setStyle(A,"display","");var D=new vB_Hidden_Form(F.action);if(YAHOO.util.Connect._submitElementValue&&YAHOO.util.Connect._submitElementValue.match(/^makefriends=/)){D.add_variable("makefriends",1)}D.add_variable("ajax",1);D.add_variables_from_object(F);this.ajax_request=YAHOO.util.Connect.asyncRequest("POST",F.action,{success:this.handle_ajax_response,failure:this.handle_ajax_failure,timeout:vB_Default_Timeout,scope:this,argument:[A,F.id]},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&"+D.build_query_string())};vB_UserList_Saver.prototype.handle_ajax_failure=function(A){vBulletin_AJAX_Error_Handler(A);YAHOO.util.Event.removeListener(this.change_form,"submit",this.handle_form_submit);YAHOO.util.Event.removeListener(this.add_form,"submit",this.handle_form_submit);YAHOO.util.Dom.get(A.argument[1]).submit()};vB_UserList_Saver.prototype.handle_ajax_response=function(F){if(F.responseXML){var G,E,C,A,D=null;YAHOO.util.Dom.setStyle(F.argument[0],"display","none");G=F.responseXML.getElementsByTagName("error");if(G.length){YAHOO.util.Dom.get(this.prefix+"_error_message").innerHTML=G[0].firstChild.nodeValue;YAHOO.util.Dom.setStyle(this.prefix+"_error","display","block");return }else{YAHOO.util.Dom.setStyle(this.prefix+"_error","display","none")}if(this.add_form&&this.add_form.username){this.add_form.username.value=""}buddycountobj=YAHOO.util.Dom.get("buddycount");if(buddycountobj){buddycountobj.innerHTML=F.responseXML.getElementsByTagName("buddycount")[0].firstChild.nodeValue}E=F.responseXML.getElementsByTagName("userlist");if(E.length){for(C=0;C<E.length;C++){A=E[C].getAttribute("type");if(vB_UserList_Highlighters[A]){vB_UserList_Highlighters[A].deactivate()}D=YAHOO.util.Dom.get(A);if(D&&E[C].firstChild){YAHOO.util.Dom.setStyle(A+"_container","display","block");YAHOO.util.Dom.setStyle(A+"_change_form","display","block");D.innerHTML=E[C].firstChild.nodeValue}else{if(D&&E[C]){YAHOO.util.Dom.setStyle(A+"_container","display","none");YAHOO.util.Dom.setStyle(A+"_change_form","display","none");D.innerHTML=""}}vB_UserList_Highlighters[A]=new vB_UserList_Highlighter(A)}}users=F.responseXML.getElementsByTagName("user");if(users.length){var B={};for(C=0;C<users.length;C++){B[users[C].getAttribute("username")]=users[C].getAttribute("userid")}for(filter in vB_UserList_Filters){vB_UserList_Filters[filter].update_userlist(B)}}}};function vB_UserList_Highlighter(E){var D,B,F,A,C;this.parentid=E;this.parent=YAHOO.util.Dom.get(E);this.items=new Array();F=this.parent.getElementsByTagName("label");if(F.length){for(D=0;D<F.length;D++){if(YAHOO.util.Dom.hasClass(F[D],"avatar_label")){A=F[D].getElementsByTagName("img");if(A.length){for(B=0;B<A.length;B++){if(A[B].id&&A[B].id.substr(0,8+this.parentid.length)==(this.parentid+"_avatar_")){C=new vB_UserList_UserObject(A[B].id.substr(8+this.parentid.length),this.parentid);this.items.push(C)}}}}}}this.check_all_checkbox=YAHOO.util.Dom.get(this.parentid+"_checkall");YAHOO.util.Event.on(this.check_all_checkbox,"click",this.check_all,this,true);this.show_avatars_checkbox=YAHOO.util.Dom.get(this.parentid+"_showavatars");YAHOO.util.Event.on(this.show_avatars_checkbox,"click",this.show_avatars,this,true);this.show_avatars_checkbox.checked=(parseInt(fetch_cookie("vbulletin_userlist_hide_avatars_"+this.parentid))?false:true);this.show_avatars()}vB_UserList_Highlighter.prototype.deactivate=function(){for(var A=0;A<this.items.length;A++){this.items[A].deactivate()}};vB_UserList_Highlighter.prototype.check_all=function(){var B,A;if(this.items.length){for(B=0;B<this.items.length;B++){this.items[B].usercheck.checked=this.check_all_checkbox.checked;this.items[B].shade_avatar()}}else{var A=this.parent.getElementsByTagName("input");for(B=0;B<A.length;B++){if(A[B].type=="checkbox"){A[B].checked=this.check_all_checkbox.checked}}}};vB_UserList_Highlighter.prototype.show_avatars=function(){if(this.items.length&&this.show_avatars_checkbox){if(this.show_avatars_checkbox.checked){YAHOO.util.Dom.replaceClass(this.parent,"userlist_hideavatars","userlist_showavatars");console.info("checked")}else{YAHOO.util.Dom.replaceClass(this.parent,"userlist_showavatars","userlist_hideavatars");console.info("not checked")}var A=new Date();A.setTime(A.getTime()+(1000*86400*365));set_cookie("vbulletin_userlist_hide_avatars_"+this.parentid,(this.show_avatars_checkbox.checked?0:1),A)}};function vB_UserList_UserObject(A,B){this.avatar=YAHOO.util.Dom.get(B+"_avatar_"+A);YAHOO.util.Event.on(this.avatar,"click",this.avatar_click,this,true);this.usercheck=YAHOO.util.Dom.get(B+"_usercheck_"+A);if(this.usercheck.tagName=="INPUT"&&this.usercheck.getAttribute("type")=="checkbox"){YAHOO.util.Event.on(this.usercheck,"click",this.usercheck_click,this,true);this.shade_avatar()}this.friendcheck=YAHOO.util.Dom.get(B+"_friendcheck_"+A);if(this.friendcheck){YAHOO.util.Event.on(this.friendcheck,"click",this.set_friend,this,true);this.friend=this.friendcheck.checked;this.origfriend=this.friendcheck.checked}}vB_UserList_UserObject.prototype.shade_avatar=function(){YAHOO.util.Dom.setStyle(this.avatar,"opacity",(this.usercheck.checked?1:0.25));if(this.friendcheck){this.friendcheck.checked=(this.usercheck.checked?this.friend:false)}};vB_UserList_UserObject.prototype.avatar_click=function(A){YAHOO.util.Event.stopEvent(A);if(this.usercheck.tagName=="SELECT"){this.usercheck.focus()}else{this.usercheck.checked=!this.usercheck.checked;this.shade_avatar()}};vB_UserList_UserObject.prototype.usercheck_click=function(A){this.shade_avatar()};vB_UserList_UserObject.prototype.set_friend=function(A){this.friend=this.friendcheck.checked;if(this.friend){this.usercheck.checked=true;this.shade_avatar()}};vB_UserList_UserObject.prototype.deactivate=function(){YAHOO.util.Event.removeListener(this.avatar,"click",this.avatar_click);YAHOO.util.Event.removeListener(this.usercheck,"click",this.usercheck_click);YAHOO.util.Event.removeListener(this.friendcheck,"click",this.set_friend)};function vB_UserList_Filter(A,C,B){this.filterbox=YAHOO.util.Dom.get(A);this.containers=C;this.userlist=B;YAHOO.util.Event.on(this.filterbox,"keydown",this.ignore_submit,this,true);YAHOO.util.Event.on(this.filterbox,"keyup",this.perform_filter,this,true);YAHOO.util.Event.on(this.filterbox,"focus",this.handle_focus,this,true);YAHOO.util.Event.on(this.filterbox,"blur",this.handle_blur,this,true);this.labeltext=new String(this.filterbox.value);YAHOO.util.Dom.setStyle(this.filterbox,"display","inline")}vB_UserList_Filter.prototype.ignore_submit=function(A){if(A.keyCode==13){YAHOO.util.Event.stopEvent(A)}};vB_UserList_Filter.prototype.update_userlist=function(A){this.userlist=A};vB_UserList_Filter.prototype.perform_filter=function(F){var C,A,G,D,E,B;C=this.filterbox.value;if(C==this.labeltext){return }A=PHP.trim(C.toLowerCase());console.log("vB_UserList_Filter :: Filtering results to users containing '%s'.",A);for(G in this.userlist){if(this.filterbox.value==C){E=(G.toLowerCase().indexOf(A)!=-1?"block":"none");for(B=0;B<this.containers.length;B++){D=YAHOO.util.Dom.get(this.containers[B]+"_user"+this.userlist[G]);if(D!=null){D.style.display=E}}}else{console.warn("vB_UserList_Filter :: Filter race condition; search string '%s' does not match input value '%s'. Aborting.",C,this.filterbox.value);return }}};vB_UserList_Filter.prototype.handle_focus=function(A){YAHOO.util.Dom.removeClass(this.filterbox,"filterbox_inactive");if(this.filterbox.value==this.labeltext){this.filterbox.value=""}};vB_UserList_Filter.prototype.handle_blur=function(A){if(PHP.trim(this.filterbox.value)==""){YAHOO.util.Dom.addClass(this.filterbox,"filterbox_inactive");this.filterbox.value=this.labeltext}};