File: /www/wwwroot/bs.kntsleep.com/cache/js/theme.d7fc2c11.js
var $G=[];
$G['lang']=1;
$G['relative']='../';
$G['items']=87;
$G['type']=3;
$(document).ready(function(){
$('notice[type][id]').each(function(){
bosscms = true;
$.post($G['relative']+'api/notice/?lang='+$G['lang'],{
'type': $(this).attr('type'),
'id': $(this).attr('id')
},function(data){
if(data){
$('notice[type="'+data.type+'"][id="'+data.id+'"]').before(data.notice).remove();
}
},'json');
});
if($('div[comment*="_"]').length>0){
var comment=$('div[comment]').attr('comment').match(/^(\d+)_(\d+)$/);
$G['model']=comment[1];
$G['gid']=comment[2];
$(document).on('click','div[comment] a[pages][parent]',function(){
(function(the){
$.get($G['relative']+'api/member/?action=comment&lang='+$G['lang'],{
'model': $G['model'],
'gid': $G['gid'],
'pages': the.attr('pages'),
'parent': the.attr('parent')
},function(data){
div = $('<div>'+data.replace(/\.\.\/\.\.\//g,$G['relative'])+'</div>');
the.prev('ul').append(div.children('ul').html());
a = div.children('a');
if(a.length > 0){
the.attr('pages',a.attr('pages'));
the.attr('parent',a.attr('parent'));
the.html(a.html());
}else{
the.remove();
}
});
})($(this));
})
.on('click','div[comment] ul>li>dl>dd>a[like][did]',function(){
(function(the){
$.post($G['relative']+'api/member/?action=comment&func=like&jsonmsg=true&lang='+$G['lang'],{'id':the.attr('did')},function(data){
if(mat = data.msg.match(/^([+-])(\d+)$/)){
the.html(mat[2]);
if(mat[1] == '-'){
the.addClass('fa-thumbs-o-up').removeClass('fa-thumbs-up');
}else{
the.addClass('fa-thumbs-up').removeClass('fa-thumbs-o-up');
}
}else{
_alert(data.msg);
}
},'json');
})($(this));
})
.on('click','div[comment] ul>li>dl>dd>a[reply][did]',function(){
div = $(this).parent('dd').next('div');
if(div.find('textarea').length>0){
$(this).removeClass('fa-commenting on').addClass('fa-commenting-o');
div.html('');
}else{
$('div[comment] ul>li>dl>dd>a[reply][did]').removeClass('fa-commenting on').addClass('fa-commenting-o');
$(this).removeClass('fa-commenting-o').addClass('fa-commenting on');
$('div[comment] ul>li>dl>div').html('');
html = $('div[comment]>div').html();
html = $(html).attr('placeholder',$(this).html()+$(this).parent('dd').parent('dl').find('dt>b').html());
div.html( html );
}
})
.on('click','div[comment] div>p>button',function(){
(function(the){
div = the.parent('p').parent('div');
did = div[0].hasAttribute('did')?div.attr('did')*1:0;
pid = div[0].hasAttribute('pid')?div.attr('pid')*1:0;
$.post($G['relative']+'api/member/?action=comment&func=publish&jsonmsg=true&lang='+$G['lang'],{
'model': $G['model'],
'gid': $G['gid'],
'parent': pid?pid:did,
'superior': did,
'content': the.parent('p').prev('textarea').val(),
'anonymity': the.next('label').find('input').prop('checked')?1:0
},function(data){
if(!data.state.match(/^\w+$/)){
div = the.parent('p').parent('div');
if(div[0].hasAttribute('did')){
div.prev('dd').find('a[reply]').click();
}else{
div.find('textarea').val('');
div.find('input[type="checkbox"]').prop('checked',false);
}
_alert(data.msg,'green');
}else{
_alert(data.msg,'red');
}
},'json');
})($(this));
});
}
});
if($('.productdetail .images>ul>li').length>1){
$('.productdetail .images>ul').after('<ol></ol><dl><dt></dt><dd></dd></dl>');
new Swiper('.productdetail .images',{
wrapperClass: 'productdetail .images>ul',
slideClass: 'productdetail .images>ul>li',
autoplay: false,
loop: false,
watchSlidesProgress: true,
watchSlidesVisibility: true,
observer: true,
observeParents: true,
slidesPerView: 'auto',
simulateTouch: true,
keyboardControl: true,
pagination: '.productdetail .images>ol',
paginationElement: 'li',
paginationClickable: true,
paginationClickableClass: 'image-',
paginationModifierClass: 'image-',
bulletClass: 'image-number',
bulletActiveClass: 'active',
containerModifierClass: 'image-',
slideDuplicatedActiveClass: 'active',
slideDuplicatedPrevClass: 'prev',
slideDuplicatedNextClass: 'next',
slideDuplicateClass: 'duplicate',
slideVisibleClass: 'visible',
slideActiveClass: 'active',
slidePrevClass: 'prev',
slideNextClass: 'next',
prevButton: '.productdetail .images>dl>dt',
nextButton: '.productdetail .images>dl>dd',
onClick: function(swiper){
}
});
$(document).on('mouseover','.productdetail .images>ul>li',function(){
$('.productdetail .images>ul>li').removeClass('on');
$(this).addClass('on');
$('.productdetail .photo>span>a').attr('href', $(this).find('a').attr('href'));
$('.productdetail .photo>span>a>img').attr('src', $(this).find('img').attr('src'));
});
}
$('.productdetail .content>ul>li').click(function(){
$('.productdetail .content>ul>li').removeClass('on');
$(this).addClass('on');
$('.productdetail .content>aside').removeClass('on').eq($(this).index()).addClass('on');
});