init
This commit is contained in:
140
static/home/js/top.js
Normal file
140
static/home/js/top.js
Normal file
@@ -0,0 +1,140 @@
|
||||
define(function() {
|
||||
var SendAjax = function (url,callback){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
cache : true,
|
||||
url : url,
|
||||
dataType : 'jsonp',
|
||||
jsonp : 'jsonpCallback',
|
||||
async : false,
|
||||
success : callback
|
||||
});
|
||||
};
|
||||
|
||||
var insertHtml = function(bah,url){
|
||||
var jc = location.href.split('/')[2].split('.')[0];
|
||||
var bah = bah||'文网游备字〔2022〕W-RPG 001 号';
|
||||
var url = url||'';
|
||||
|
||||
var htmlft='<div id="footer_b">';
|
||||
htmlft+='<div class="top">';
|
||||
htmlft+='<div class="footer_logo">';
|
||||
htmlft+='<a class="footer_logo_a" title="网页游戏平台">网页游戏</a>';
|
||||
htmlft+='</div>';
|
||||
htmlft+='<div class="footer_link">';
|
||||
htmlft+='<a>关于我们</a> | <a>商务合作</a> | <a>客服中心</a> | <a>人才招聘</a> | <a>家长监护</a><br>';
|
||||
htmlft+='</div>';
|
||||
htmlft+='</div>';
|
||||
htmlft+='<div class="footer_info">';
|
||||
htmlft+='<div class="footer_1002">';
|
||||
htmlft+='<p style="height: 30px;line-height: 30px;">游戏平台—做玩家最爱,最信任的游戏平台!适龄提示:本游戏适合18岁以上玩家进入!</p>';
|
||||
htmlft+='<p style="height: 30px;line-height: 30px;">游戏版权所有 Copyright (c) 2022 317743968Game All Rights Reserved </p>';
|
||||
htmlft+='<p style="line-height: 40px;height: 40px"><a style="color: #666">粤ICP备123456789号-2</a> ';
|
||||
htmlft+='<a style="color: #666">粤公网安备007号</a> ';
|
||||
htmlft+='<a style="color: #666">粤网文[2022] 001-007号 </a>';
|
||||
htmlft+=' '+bah;
|
||||
htmlft+='</p>';
|
||||
htmlft+='</div>';
|
||||
htmlft+='</div>';
|
||||
htmlft+='</div>';
|
||||
$("#top .top-pay").attr("href", 'http://' + location.host + '/?g=' + jc);
|
||||
$("body").append(htmlft);
|
||||
};
|
||||
|
||||
var insertGameList = function () {
|
||||
/*var url = '//' + location.host + '/?m=game&c=gameApi&a=getHomeGameApi&random=' + Math.random();
|
||||
var html = "";
|
||||
SendAjax(url,function(result){
|
||||
if(!result){return false}
|
||||
html += "<dt>热门游戏</dt>";
|
||||
for(var i in result){
|
||||
if(result[i].g_org&&result[i].g_name){
|
||||
if(i%3==0){html+="<tr>"}
|
||||
html+= "<dd><a class='hot-icon' href='"+result[i].g_org+"'>"+result[i].g_name+"<span class='n'></span></a></dd>";
|
||||
if(i%3==2){html+="</tr>"}
|
||||
}
|
||||
}
|
||||
html += '<dd class="last-dd"><a href="//' + location.host + '/game/" target="_blank" title="更多游戏" ">更多>></a></dd>'
|
||||
$("#TopAllGameName").html(html);
|
||||
});*/
|
||||
var html = '';
|
||||
html += '<dt>热门游戏</dt>';
|
||||
html += '<dd><a class="hot-icon">热血传奇<span class="n"></span></a></dd>';
|
||||
html += '<dd class="last-dd"><a href="//' + location.host + '/game/" target="_blank" title="更多游戏" ">更多>></a></dd>';
|
||||
$("#TopAllGameName").html(html);
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
insertImg:function(obj){
|
||||
var createHtml = function () {
|
||||
var html =""
|
||||
if(obj.url&&obj.src){
|
||||
html+='<a href="'+obj.url+'" target="_blank"><img src="'+obj.src+'" alt=""></a>';
|
||||
}else if(obj.src){
|
||||
html+='<img src="'+obj.src+'" alt="">';
|
||||
}else {
|
||||
html=''
|
||||
}
|
||||
return html;
|
||||
}
|
||||
this.html(createHtml())
|
||||
}
|
||||
});
|
||||
|
||||
/*var inserImg = function(){
|
||||
$(".top-wrap .default-flash").insertImg({
|
||||
src:'//' + location.host + '/js/require/top/images/27090636xnhZ8.jpg',
|
||||
url:'//' + location.host
|
||||
});
|
||||
$(".top-wrap .show-flash").insertImg({
|
||||
src:'//' + location.host + '/js/require/top/images/27090715hwvpB.png',
|
||||
url:'//' + location.host
|
||||
});
|
||||
};*/
|
||||
|
||||
var elementEvent = function(){
|
||||
$(".all-game,.top-allGame").hover(function(){
|
||||
$(".top-allGame").show()
|
||||
}, function(){
|
||||
$(".top-allGame").hide()
|
||||
});
|
||||
|
||||
$("#allGame").hover(function(){
|
||||
$("#allGameList").show()
|
||||
$(this).addClass('active');
|
||||
},function(){
|
||||
$("#allGameList").hide();
|
||||
$(this).removeClass('active');
|
||||
});
|
||||
$("#allGameList").hover(function(){
|
||||
$("#allGameList").show()
|
||||
$("#allGame").addClass('active');
|
||||
},function(){
|
||||
$("#allGameList").hide()
|
||||
$("#allGame").removeClass('active');
|
||||
});
|
||||
|
||||
$(".top-wrap .top-flash").hover(function(){
|
||||
$(".top-wrap .show-flash").show();
|
||||
$(".default-flash").hide();
|
||||
},function(){
|
||||
$(".top-wrap .show-flash").hide();
|
||||
$(".top-wrap .default-flash").show();
|
||||
});
|
||||
|
||||
$("#top .top-login").click(function(){
|
||||
AL.Init({"box":"login"})
|
||||
});
|
||||
|
||||
$("#top .top-register").click(function(){
|
||||
AL.Init({"box":"register"})
|
||||
});
|
||||
};
|
||||
|
||||
return topInit = function(obj,url){
|
||||
insertHtml(obj,url);
|
||||
insertGameList();
|
||||
elementEvent();
|
||||
//inserImg()
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user