File: /www/wwwroot/bs.kntsleep.com/cache/js/theme.b38eb903.js
var $G=[];
$G['lang']=1;
$G['relative']='../';
$G['items']=19;
$G['type']=2;
$(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));
});
}
});