Learn how to use jQuery at the Blog

We Game « visit

  • Added 11 months ago
  • 184 Lines of Code shown
  • 3 Links of Interest
http://wegame.com
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to We Game - http://wegame.com

	$(document).ready(function(){
		AutoComplete('global-search-input','global-search-results','/autocomplete/query/');
		AC['global-search-input']['autosubmit'] = false;
		AC['global-search-input']['requirevalid'] = false;
		AC['global-search-input']['hide'].change(function(e) { window.location = $(this).val(); e.stopPropagation(); }).removeAttr('name');
		AC['global-search-input']['src'].attr('name','query');
		AC['global-search-input']['autoselect'] = false;
	});



        $("ul.hd-tabs li a").click(function(e) {
            var ele_id = $(this).attr("id");
            $("ul.hd-tabs li").removeClass("active");
            $("a#"+ele_id).parent("li").addClass("active");
            $("div.tab-content").hide();
            $("div#"+ele_id+"-content").show();
        });



	    $(".btn-signup").click(function() {
	    	$(".btn-login").parent().attr("id", "");
	    	$(".btn-signup").parent().attr("id", "selected");
	    	$("form#tb-login-form").hide();
	        $("form#tb-sign-up-form").show();
	    });
	    
	    $(".btn-login").click(function() {
	    	$(".btn-signup").parent().attr("id", "");
	    	$(".btn-login").parent().attr("id", "selected");
	    	$("form#tb-sign-up-form").hide();
	    	$("form#tb-login-form").show();
	    });
	    
	    function thickbox_login() {
	        $("ul.tb-tabs li").attr("id", "");
	        $("ul.tb-tabs li:last").attr("id", "selected");
	        $("form#tb-sign-up-form").hide();
	        $("form#tb-login-form").show();
	        return true;
	    }
	    
	    function thickbox_signup() {
	        $("ul.tb-tabs li").attr("id", "");
	        $("ul.tb-tabs li:first").attr("id", "selected");
	        $("form#tb-sign-up-form").show();
	        $("form#tb-login-form").hide();
	        return true;
	    }
	    
	    $("a.thickbox").click(function(e) {
	        $("#flash_player object").css("visibility", "hidden");
	        tb_show(null,'#TB_inline?height=375&width=340&inlineId=popLogin');
	    });
	    
	    /* Main Nav Water Polo! */
	    $("body").click(function(ele){
	        if($(ele.target).hasClass('tb-close')) {
    	        var tmp = $("#flash_player object");
    	        if(tmp.length > 0)
        	        tmp.css("visibility", "visible");
        	    tb_remove();
        	    return false;
        	} else {
    	        if( $(ele.target).hasClass("menu-arrow") ) {
        		    var link = $(ele.target);
    		        var tmp = $(link).parent().next("div");
    		        if(link.parent().parent().hasClass("selected")) {
    		       	    link.parent().parent().removeClass("selected");
        		        $("div.header-drop-down").hide();
        		        $("#flash_player object").css("visibility", "visible");
        		    } else {
        		    	$("a.menu-arrow").each(function() {
        		            $(this).parent().parent().removeClass("selected");
        		        });
        		        $("a.menu-arrow").removeClass("selected");
        		        $("div.header-drop-down").hide();
        		        link.parent().parent().addClass("selected");
        		        tmp.show();
        		        $("#flash_player object").css("visibility", "hidden");
        		    }
    	        } else {
    	            var tmp = $("div#TB_ajaxContent");
    	            if(tmp.length == 0) {
        		        $("a.menu-arrow").each(function() {
        		            $(this).parent().parent().removeClass("selected");
        		            $(this).parent().next("div").hide(); 
        		            $("#flash_player object").css("visibility", "visible");
        		        });
        		    }
    		    }
    		}
	    });
	    
	    
	    /* Tabs for Recent Activity */
	    $("#activity-friends-tab").click(function(){
	    	$("#activity-everyone-tab").parent().removeClass("active")
		 	$("#activity-friends-tab").parent().addClass("active")
	    	$("#activity-everyone").hide();
			$("#activity-friends-wrapper").show();
		});
		$("#activity-everyone-tab").click(function(){
			$("#activity-friends-tab").parent().removeClass("active")
		 	$("#activity-everyone-tab").parent().addClass("active")
			$("#activity-friends-wrapper").hide();
			$("#activity-everyone").show();
		});
	    
	    
	    /* This is for drop downs on hover instead of click */
	   	/*$(".ramrod").hover(
			function(){
				$(this).addClass('selected');
				$(this).children(1).show();
				$("#flash_player object").css("visibility", "hidden");
			},
			function(){
				$(this).removeClass('selected');
				$("div.header-drop-down").hide();
				$("#flash_player object").css("visibility", "visible");
			}
	    );*/
	    
		
		/* Puts the bone into the chicken */
		$("#user-nav").hover(
			function(){
				$("#user-nav").addClass("user-nav-hover");
				$("#user-nav em").addClass("user-nav-text-hover");
				$("#dash-nav").show();
			},
			function(){
				$("#user-nav").removeClass("user-nav-hover");
				$("#user-nav em").removeClass("user-nav-text-hover");
				$("#dash-nav").hide();
			}
	    );
	    
	    $("#dash-nav").hover(
			function(){
				$("#user-nav").addClass("user-nav-hover");
				$("#user-nav em").addClass("user-nav-text-hover");
				$(this).show();
			},
			function(){
				$("#user-nav").removeClass("user-nav-hover");
				$("#user-nav em").removeClass("user-nav-text-hover");
				$(this).hide();
			}
	    );
	    
	    $("#logo a").hover(
	    	function(){
				$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
				if($.browser.chrome){
					$("img#logo-hover").css("top", "-48px");
					$("img#logo-hover").show();
				} else {
					$("#logo-hover").fadeIn(800);
				}
			},
			
			function(){
				$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
				if($.browser.chrome){
					$("img#logo-hover").hide();
				} else {
					$("#logo-hover").fadeOut(1300);
				}
			}
	    );
	    
        $("form.spin-form").submit(function(e) {
            var button = $(this).find("button[@type=submit]");
            $(button).attr("disabled", "disabled");
            $(button).addClass("disabled");
            $(button).after("<div class='ajax-spinner'><img src='/static/images/loading-white.gif' style='vertical-align: middle;' alt='' /></div>");
            return true;
        });
        
		/* Load download hover image into memory */
		new Image().src = "/static/images/global-download-icon-bounce.gif";