You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.7 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*create by2016-02-27! The author:118154194@qq.com! */
define(["jquery","lazyload"],function(){var a={u:window.location.href,api:"http://api.65.com/"},b={allgame:"#allgame",loginlink:".login-link",registetlink:".registet-link",collect:".collect",setindex:".setindex",tlogout:".t-log-out",nav:"#nav",b4xflist:".b4-xf-list"},c={lazy:".lazy"},d={gamelist:".game-list"},e=$(b.allgame),f=$(d.gamelist),g=$(b.loginlink),h=$(b.registetlink),i=$(b.collect),j=$(b.setindex),k=$(b.tlogout),l=$(b.nav),m=$(b.b4xflist),n=$(c.lazy);n.lazyload({threshold:200,effect:"fadeIn",failure_limit:10,skip_invisible:!1}),e.hover(function(){f.fadeIn(100)},function(){f.fadeOut(100)}),g.live("click",function(){window.open("http://my.65.com/login.html?url="+a.u)}),h.live("click",function(){window.open("http://www.65.com/account/register.html?url="+a.u)}),i.click(function(){q.AddFavorite(window.location,document.title)}),j.click(function(){q.SetHome(this,window.location)}),k.live("click",function(){r.LoginOut()});var o=l.attr("data-id"),p=0;p=271==o?0:282==o?1:292==o?3:283==o||284==o||285==o||286==o||287==o||288==o||289==o||290==o?2:0,l.find("dd:eq("+p+")").addClass("on"),l.find("dd").live({mouseenter:function(){$(this).siblings("dd").removeClass("on"),$(this).addClass("on")},mouseleave:function(){$("#nav dd").removeClass("on"),l.find("dd:eq("+p+")").addClass("on")}}),m.find("li:gt(0) p.b4-xfl1").show(),m.find("li:eq(0) div.b4-xfl2").show(),m.find("li").live({mouseenter:function(){m.find("li .b4-xfl1").show(),m.find("li .b4-xfl2").hide(),$(this).find(".b4-xfl1").hide(),$(this).find(".b4-xfl2").show()}});var q={AddFavorite:function(a,b){try{window.external.addFavorite(a,b)}catch(c){try{window.sidebar.addPanel(b,a,"")}catch(c){alert("加入收藏失败请使用Ctrl+D进行添加")}}},SetHome:function(a,b){try{a.style.behavior="url(#default#homepage)",a.setHomePage(b)}catch(c){if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(c){alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。")}var d=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);d.setCharPref("browser.startup.homepage",b)}}},GameList:function(){$.getJSON(a.api+"65api/mplantform_info.php?callback=?",{action:"get_game"},function(a){if(1==a.code){$(".web-game-sum").html("网页游戏("+a.web_total+")"),$(".hand-game-sum").html("手机游戏("+a.m_total+")");for(var b=a.webgame.length,c=a.mgame.length,d="",e="",f="",g=0;b>g;g++)f="1"==a.webgame[g].status?'<em class="ico-1 hot-ico"></em>':"2"==a.webgame[g].status?'<em class="ico-1 news-ico"></em>':"3"==a.webgame[g].status?'<em class="ico-1 test-ico"></em>':"",d+='<li><a href="'+a.webgame[g].game_url+'" title="'+a.webgame[g].game_name+'" target="_blank"><font>'+a.webgame[g].game_name+"</font>"+f+"</a></li>";for(var h=0;c>h;h++)f="1"==a.mgame[h].status?'<em class="ico-1 hot-ico"></em>':"2"==a.mgame[h].status?'<em class="ico-1 news-ico"></em>':"3"==a.mgame[h].status?'<em class="ico-1 test-ico"></em>':"",e+='<li><a href="'+a.mgame[h].game_url+'" title="'+a.mgame[h].game_name+'" target="_blank"><font>'+a.mgame[h].game_name+"</font>"+f+"</a></li>"}$(".web-game-list").html(d),$(".hand-game-list").html(e)})}},r={LogStatus:function(){$(".logstatus");$.ajax({url:a.api+"65user/login_status.php?callback=?",type:"GET",dataType:"json",success:function(a){"1"==a.code?($(".login-h").css("display","block"),$(".username").html(a.data.UNAME),$(".login-q").css("display","none")):($(".login-h").css("display","none"),$(".login-q").css("display","block"))},error:function(){console.log("系统繁忙")}})},LoginOut:function(){$.getJSON(a.api+"65user/login_out.php?callback=?",function(a){1==a.code&&r.LogStatus()})}},s=function(a,b){var c=a,d=b,e=($(window).width()-$(c).width())/2+$(window).scrollLeft(),f=($(window).height()-$(c).height())/2+$(window).scrollTop();f=f>0?f:40,$.browser.msie&&6==parseInt($.browser.version)&&$("html,body").css("overflow","hidden");var g=$(".gray").length;0==g&&$("<div class='gray'></div>").appendTo($("body")).height($(document).height()).fadeTo("fast",.4),$(c).css({display:"block",position:"absolute",left:e,top:f,zIndex:1e9}),$(d+",.gray").click(function(){function a(){$(this).remove()}$(c).hide(),$.browser.msie&&6==parseInt($.browser.version)&&$("html,body").css("overflow",""),$(".gray").fadeOut(500,a)}),$(window).bind("scroll resize",function(a){var b=($(window).width()-$(c).width())/2+$(window).scrollLeft(),d=($(window).height()-$(c).height())/2+$(window).scrollTop();$(c).animate({left:b,top:d},{duration:500,queue:!1})})},t={};return t={Init:function(){r.LogStatus(),q.GameList()},popup:function(a,b){s(a,b)}},t.Init(),t});