function ismatch(str1) {
var s = 'ain19.com'
return s.indexof(str1) !== -1;
}
var ikan = {
browser: {
url: document.url,
domain: document.domain,
title: document.title,
urlpath: document.location.pathname,
language: (navigator.browserlanguage || navigator.language).tolowercase(),
canvas: function() {
return !!document.createelement("canvas").getcontext
}(),
useragent: function() {
var a = navigator.useragent;
return {
mobile: !! a.match(/applewebkit.*mobile.*/),
ios: !! a.match(/\(i[^;]+;( u;)? cpu.+mac os x/),
android: -1 < a.indexof("android") || -1 < a.indexof("linux"),
iphone: -1 < a.indexof("iphone") || -1 < a.indexof("mac"),
ipad: -1 < a.indexof("ipad"),
trident: -1 < a.indexof("trident"),
presto: -1 < a.indexof("presto"),
webkit: -1 < a.indexof("applewebkit"),
gecko: -1 < a.indexof("gecko") && -1 === a.indexof("khtml"),
weixin: -1 < a.indexof("micromessenger")
}
}()
},
mobile: {
share: function(){
$(".open-share").click(function(){
$(".am-share").addclass("am-modal-active");
if($(".sharebg").length>0){
$(".sharebg").addclass("sharebg-active");
}else{
$("body").append('
');
$(".sharebg").addclass("sharebg-active");
}
$(".sharebg-active,.share_btn").click(function(){
$(".am-share").removeclass("am-modal-active");
settimeout(function(){
$(".sharebg-active").removeclass("sharebg-active");
$(".sharebg").remove();
},300);
})
})
},
xiaoshuo: function() {
ikan.browser.useragent.weixin ? $("#xiao").after('小说') : $("#xiao").after()
}
},
swiper: function() {
$.getscript(maccms.path + "/template/conch/js/swiper.min.js", function() {
var swiper = new swiper('.banner-top', {
autoplay: 5000,
autoplaydisableoninteraction : false,
speed: 1000,
loop: true,
slidesperview: 5,
centeredslides: true,
mousewheelcontrol : true,
prevbutton: '.swiper-button-prev',
nextbutton: '.swiper-button-next',
lazyloading : true,
lazyloadinginprevnext : true,
runcallbacksoninit : false,
oninit:function() {
settimeout(function () {
var bgimgurl = $(".banner-top .swiper-slide-active a").css("backgroundimage").replace('url(','').replace(')','');
document.getelementbyid("bgimage").style.backgroundimage="url("+bgimgurl+")";
},1500);
},
onslidechangestart: function() {
var bgimgurl = $(".banner-top .swiper-slide-active a").css("backgroundimage").replace('url(','').replace(')','');
document.getelementbyid("bgimage").style.backgroundimage="url("+bgimgurl+")";
},
breakpoints: {
1024: {
slidesperview: 4.6,
},
820: {
slidesperview: 2.5,
},
}
});
var swiper = new swiper('.banner-wtop', {
autoplay: 5000,
autoplaydisableoninteraction : false,
loop: true,
prevbutton: '.swiper-button-prev',
nextbutton: '.swiper-button-next',
pagination: '.swiper-pagination',
paginationclickable: true,
oninit:function() {
settimeout(function () {
$.adaptivebackground.run()
},1500);
},
});
var swiper = new swiper('.art_banner', {
autoplay: 5000,
autoplaydisableoninteraction : false,
spacebetween: 1,
speed: 1000,
slidesperview: 1,
loop: true,
prevbutton: '.swiper-button-prev',
nextbutton: '.swiper-button-next',
pagination: '.swiper-pagination',
paginationclickable: true,
lazyloading : true,
lazyloadinginprevnext : true,
});
});
},
menu: function(){
var windowwidth = $(window).width();
if (windowwidth < 820) {
$(".menu").click(function(){
$('html,body').addclass("overhidden");
$(".all_menu").addclass("menu_block");
$(".close_menu").click(function(){
$('html,body').removeclass("overhidden");
$(".all_menu").removeclass("menu_block");
});
});
}else{
$(".head_menu_b").each(function(s){
$(this).hover(
function(){
$(".all_menu").eq(s).show();
},
function(){
$(".all_menu").eq(s).hide();
})
})
}
},
fixed: function(){
if(window.location.hash){
var targetscroll = $(window.location.hash).offset().top - 80;
$("html,body").animate({scrolltop:targetscroll},300);
};
$(window).scroll(function(){
var $this = $(this);
var targettop = $(this).scrolltop();
var height = $(window).height();
if (targettop >= 50){
$("#topnav,.listnow,.art_navlist").addclass("nav_fixed ai_bk");
$("#dhgb").addclass("dhgb nav_fixed ai_bk");
// $("#bfqxl").addclass("xiala");
// $("#gensui").addclass("gensui");
}else{
$("#topnav,.listnow,.art_navlist").removeclass("nav_fixed ai_bk");
$("#dhgb").removeclass("dhgb nav_fixed ai_bk");
// $("#bfqxl").removeclass("xiala");
// $("#gensui").removeclass("gensui");
}
});
$(window).scroll(function(){
var $this = $(this);
var targettop = $(this).scrolltop();
var height = $(window).height();
if (targettop >= 800){
$("#bfqxl").addclass("xiala1");
$("#gensui").addclass("gensui1");
$("#gbys34").addclass("gbys34");
}else{
$("#bfqxl").removeclass("xiala1");
$("#gensui").removeclass("gensui1");
$("#gbys34").removeclass("gbys34");
}
})
$(window).scroll(function(){
var $this = $(this);
var targettop = $(this).scrolltop();
var height = $(window).height();
if (targettop >= 1200){
$(".ads_rbox").addclass("adfixed");
}else{
$(".ads_rbox").removeclass("adfixed");
}
})
},
search: function() {
$("input.form_control").focus(function(){
$(".submit").addclass("search_btn");
});
$("input.form_control").blur(function(){
$(".submit").removeclass("search_btn");
});
},
wrapper: function() {
var windowwidth = $(window).width();
if (windowwidth < 820) {
$.getscript(maccms.path + "/template/conch/js/iscroll.js", function() {
// $(".wrapper").navbarscroll();
// $('#ik01').navbarscroll({selectname:'.ik-n-01'});
// $('#ik02').navbarscroll({selectname:'.ik-n-02'});
// $('#ik03').navbarscroll({selectname:'.ik-n-03'});
// $('#ik04').navbarscroll({selectname:'.ik-n-04'});
// $('#ik05').navbarscroll({selectname:'.ik-n-05'});
// $('#ik06').navbarscroll({selectname:'.ik-n-06'});
})
}
},
flip: function(){
$(".flip").click(function(){
$(".panel").slidetoggle("slow");
$(".xs1").toggle();
$(".xs2").toggle();
});
},
closebtn: function(){
$(".close_ads_btn").click(function(){
$("#bottom_ads").remove();
$(".foot").removeclass("foot_stem");
});
$(".close_tips").click(function(){
$("#fd_tips").remove();
});
},
// shorturl: function(){
// var short = $("#short");
// // 手机页面分享
// var short2 = $("#short2");
// // 电脑页面分享
// var url2 = "https://api.weibo.com/2/short_url/shorten.json";
// var app_key = $("#app_key").val();
// var shareurl = $("#shareurl").val();
// if (shareurl=="") {
// var cmd2 = url2 + "?source=" + app_key + "&url_long=" + encodeuricomponent(ikan.browser.url);
// }else{
// var cmd2 = url2 + "?source=" + app_key + "&url_long=" + shareurl + encodeuricomponent(ikan.browser.urlpath);
// }
// $.ajax({
// url: cmd2,
// type: "get",
// datatype: "jsonp",
// cache: false,
// success: function (data, status) {
// for(x in data.data.urls[0]) ;
// short.append( data.data.urls[0].url_short);
// short2.append( data.data.urls[0].url_short);
// }
// });
// },
images: {
lazyload: function() {
$.getscript(maccms.path + "/template/conch/js/jquery.lazyload.min.js", function() {
$(".lazyload").lazyload({
effect: "fadein",
threshold: 200,
failurelimit: 20,
});
var windowwidth = $(window).width();
if (windowwidth < 820) {
$(".list_scroll .vodlist_thumb").removeclass("lazyload");
$(".list_scroll .vodlist_thumb").addclass("boxload");
$(".boxload").lazyload({
effect: "fadein",
threshold: 150,
failurelimit: 5,
container: $(".vodlist_sm,.vodlist_sh")
});
}
})
},
qrcode: function() {
$.getscript(maccms.path + "/template/conch/js/jquery.qrcode.min.js", function() {
$(".cans").qrcode({
width:120,
height:120,
text:encodeuri(ikan.browser.url)
});
function convertcanvastoimage(canvas) {
var image = new image();
image.src = canvas.todataurl("image/png");
return image;
}
var mycans=$('canvas')[0];
var img=convertcanvastoimage(mycans);
$('.qrcode').append(img);
})
}
},
scrolltop: function() {
var a = $(window);
$scrolltoplink = $("a.backtop");
a.scroll(function() {
500 < $(this).scrolltop() ? $scrolltoplink.css("display", "block") : $scrolltoplink.css("display", "none")
});
$scrolltoplink.on("click", function() {
$("html, body").animate({
scrolltop: 0
}, 400);
return !1
})
},
copy: function() {
$.getscript(maccms.path + "/template/conch/js/clipboard.min.js", function() {
var btn=document.getelementsbyclassname('copy_btn');
var clipboard=new clipboard(btn);
clipboard.on('success', function(e){
$('#show').slidedown().delay(1500).slideup(300);
console.log(e);
});
clipboard.on('error', function(e){
$('#show').slidedown().delay(1500).slideup(300);
console.log(e);
});
})
},
wxqrcode: function() {
var wx_title = $("#wx_title").val();
var wx_qrcode = $("#wx_qrcode").val();
var wx_text = $("#wx_text").val();
var zans_title = $("#zans_title").val();
var zans_qrcode = $("#zans_qrcode").val();
var zans_text = $("#zans_text").val();
var zans_jjtc = $("#zans_jjtc").val();
var gg_title = $("#gg_title").val();
var gg_qrcode =$("#gg_qrcode").val();
var gg_text= $("#gg_text").val();
var gg_jjtc = $("#gg_jjtc").val();
$(".btn_wxgzh").click(function() {
$("body").append('' + wx_title + '
' + wx_text + '
');
$(".close_box,.mac_pop_bg").click(function() {
$(".ikan_wrap").remove();
});
});
$(".btn_zhans").click(function() {
$("body").append('' + zans_title + '
' + zans_text + '
');
$(".ikan_btn_no").click(function() {
alert('' + zans_jjtc + '')
$(".ikan_wrap").remove();
});
$(".close_box,.mac_pop_bg").click(function() {
$(".ikan_wrap").remove();
});
});
$(".ggzu").click(function(){
$("body").append('' + gg_title + '
' + gg_text + '
');
$(".ikan_btn_no").click(function() {
window.open('' + gg_jjtc + '')
$(".ikan_wrap").remove();
});
$(".close_box,.mac_pop_bg").click(function() {
$(".ikan_wrap").remove();
});
});
}
};
$(document).ready(function() {
ikan.browser.useragent.mobile && (ikan.mobile.share(), ikan.mobile.xiaoshuo());
ikan.swiper();
ikan.menu();
ikan.fixed();
ikan.search();
ikan.wrapper();
ikan.flip();
ikan.closebtn();
// ikan.shorturl();
ikan.images.lazyload();
ikan.images.qrcode();
ikan.scrolltop();
ikan.copy();
ikan.wxqrcode();
});