';
html += '
'
$('.mac_user').after(html);
$('.mac_user').removeClass('mac_user');
}
}
else{
}
},
'CheckLogin':function(){
if(MAC.User.IsLogin == 0){
MAC.User.Login();
}
},
'Login':function(){
var ac='ajax_login';
if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){
ac= 'ajax_info';
}
MAC.Pop.Show(400,380,'用户登录',maccms.path+'/index.php/user/'+ac,function(r){
$('body').off('click', '.login_form_submit');
$('body').on('click', '.login_form_submit', function(e){
$(this).unbind('click');
MAC.Ajax(maccms.path + '/index.php/user/login','post','json',$('.mac_login_form').serialize(),function(r){
alert(r.msg);
if(r.code == 1){
location.reload();
}
});
});
});
},
'Logout':function(){
MAC.Ajax(maccms.path + '/index.php/user/logout','post','json','',function(r){
MAC.Pop.Msg(100,20,r.msg,1000);
if(r.code == 1){
location.reload();
}
});
},
'PopedomCallBack':function(trysee,h) {
window.setTimeout(function(){
$(window.frames["player_if"].document).find(".MacPlayer").html(h);
},1000*10*trysee);
},
'BuyPopedom':function(o){
var $that = $(o);
if($that.attr("data-id")){
if (confirm('您确认购买此条数据访问权限吗?')) {
MAC.Ajax(maccms.path + '/index.php/user/ajax_buy_popedom.html?id=' + $that.attr("data-id") + '&mid=' + $that.attr("data-mid") + '&sid=' + $that.attr("data-sid") + '&nid=' + $that.attr("data-nid") + '&type=' + $that.attr("data-type"),'get','json','',function(r){
$that.addClass('disabled');
MAC.Pop.Msg(300, 50, r.msg, 2000);
if (r.code == 1) {
top.location.reload();
}
$that.removeClass('disabled');
});
}
}
}
},
'Pop':{
'Remove':function(){
$('.mac_pop_bg').remove();
$('.mac_pop').remove();
},
'RemoveMsg':function(){
$('.mac_pop_msg_bg').remove();
$('.mac_pop_msg').remove();
},
'Msg':function($w,$h,$msg,$timeout){
if($('.mac_pop_bg').length !=1) {
MAC.Pop.Remove();
}
$('body').append('
');
$('.mac_pop_msg .pop_close,.mac_pop_bg').click(function(){
$('.mac_pop_msg').remove();
});
$('.mac_pop_msg').width($w);
$('.mac_pop_msg').height($h);
$('.mac_pop_msg .pop-msg').html($msg);
$('.mac_pop_msg_bg,.mac_pop_msg').show();
setTimeout(MAC.Pop.RemoveMsg,$timeout);
},
'Show':function($w,$h,$title,$url,$callback) {
if($('.mac_pop_bg').length !=1) {
MAC.Pop.Remove();
}
$('body').append('
');
$('.mac_pop .pop_close,.mac_pop_bg').click(function(){
$('.mac_pop_bg,.mac_pop').remove();
});
$('.mac_pop').width($w);
$('.pop_content').html('');
$('.pop_top').find('h2').html($title);
MAC.Ajax($url,'post','json','',function(r){
$(".pop_content").html(r);
$callback(r);
},function(){
$(".pop_content").html('加载失败,请刷新...');
});
$('.mac_pop_bg,.mac_pop').show();
}
},
'Pwd':{
'Check':function(o){
var $that = $(o);
if($that.attr("data-id")){
MAC.Ajax(maccms.path + '/index.php/ajax/pwd.html?id=' + $that.attr("data-id") + '&mid=' + $that.attr("data-mid") + '&type=' + $that.attr("data-type") + '&pwd='+ $that.parents('form').find('input[name="pwd"]').val() ,'get','json','',function(r){
$that.addClass('disabled');
MAC.Pop.Msg(300, 50, r.msg, 2000);
if (r.code == 1) {
location.reload();
}
$that.removeClass('disabled');
});
}
}
},
'AdsWrap':function(w,h,n){
document.writeln('
!['+n+']()
');
},
'Css':function($url){
$("
").attr({ rel: "stylesheet",type: "text/css",href: $url}).appendTo("head");
},
'Js':function($url){
$.getScript($url, function(response, status) {
});
},
'Desktop':function(s){
location.href= maccms.path + '/index.php/ajax/desktop?name='+encodeURI(s)+'&url=' + encodeURI(location.href);
},
'Timming':function(){
if($('.mac_timming').length==0){
return;
}
var infile = $('.mac_timming').attr("data-file");
if(infile==undefined || infile == ''){
infile = 'api.php';
}
var t=(new Image());t.src=maccms.path + '/'+infile+'/timming/index?t='+Math.random();
},
'Error':function(tab,id,name){
},
'AddEm':function(obj,i){
var oldtext = $(obj).val();
$(obj).val( oldtext + '[em:' + i +']' );
},
'Remaining':function(obj,len,show){
var count = len - $(obj).val().length;
if(count < 0){
count = 0;
$(obj).val($(obj).val().substr(0,200));
}
$(show).text(count);
},
'Comment':{
'Login':0,
'Verify':0,
'Init':function(){
$('body').on('click', '.comment_face_box img', function(e){
var obj = $(this).parent().parent().parent().find('.comment_content');
MAC.AddEm(obj,$(this).attr('data-id'));
});
$('body').on('click', '.comment_face_panel', function(e){
// $('.comment_face_box').toggle();
$(this).parent().find('.comment_face_box').toggle();
});
$('body').on('keyup', '.comment_content', function(e){
var obj = $(this).parent().parent().parent().parent().find('.comment_remaining');
MAC.Remaining($(this),200,obj)
});
$('body').on('focus', '.comment_content', function(e){
if(MAC.Comment.Login==1 && MAC.User.IsLogin!=1){
MAC.User.Login();
}
});
$('body').on('click', '.comment_report', function(e){
var $that = $(this);
if($(this).attr("data-id")){
MAC.Ajax(maccms.path + '/index.php/comment/report.html?id='+$that.attr("data-id"),'get','json','',function(r){
$that.addClass('disabled');
MAC.Pop.Msg(100,20,r.msg,1000);
if(r.code == 1){
}
});
}
});
$('body').on('click', '.comment_reply', function(e){
var $that = $(this);
if($that.attr("data-id")){
var str = $that.html();
$('.comment_reply_form').remove();
if (str == '取消回复') {
$that.html('回复');
return false;
}
if (str == '回复') {
$('.comment_reply').html('回复');
}
var html = $('.comment_form').prop("outerHTML");
var oo = $(html);
oo.addClass('comment_reply_form');
oo.find('input[name="comment_pid"]').val( $that.attr("data-id") );
$that.parent().after(oo);
$that.html('取消回复');
}
});
$('body').on('click', '.comment_submit', function(e){
var $that = $(this);
MAC.Comment.Submit($that);
});
},
'Show':function($page){
if($(".mac_comment").length>0){
MAC.Ajax(maccms.path + '/index.php/comment/ajax.html?rid='+$('.mac_comment').attr('data-id')+'&mid='+ $('.mac_comment').attr('data-mid') +'&page='+$page,'get','json','',function(r){
$(".mac_comment").html(r);
},function(){
$(".mac_comment").html('
评论加载失败,点击我刷新...');
});
}
},
'Reply':function($o){
},
'Submit':function($o){
var form = $o.parents('form');
if($(form).find(".comment_content").val() == ''){
MAC.Pop.Msg(100,20,'请输入您的评论!',1000);
return false;
}
if($('.mac_comment').attr('data-mid') == ''){
MAC.Pop.Msg(100,20,'模块mid错误!',1000);
return false;
}
if($('.mac_comment').attr('data-id') == ''){
MAC.Pop.Msg(100,20,'关联id错误!',1000);
return false;
}
MAC.Ajax(maccms.path + '/index.php/comment/saveData','post','json',$(form).serialize() + '&comment_mid='+ $('.mac_comment').attr('data-mid') + '&comment_rid=' + $('.mac_comment').attr('data-id'),function(r){
MAC.Pop.Msg(100,20,r.msg,1000);
if(r.code == 1){
MAC.Comment.Show(1);
}
else{
if(MAC.Comment.Verify==1){
MAC.Verify.Refresh();
}
}
});
}
}
}
$(function(){
//异步加载图片初始化
MAC.Image.Lazyload.Show();
//自动跳转手机和pc网页地址
MAC.Adaptive();
//验证码初始化
MAC.Verify.Init();
//分页跳转初始化
MAC.PageGo.Init();
//用户部分初始化
MAC.User.Init();
//二维码初始化
MAC.Qrcode.Init();
//顶和踩初始化
MAC.Digg.Init();
//评分初始化
MAC.Score.Init();
//星星评分初始化
MAC.Star.Init();
//点击数量
MAC.Hits.Init();
//短网址
MAC.Shorten.Init();
//历史记录初始化
MAC.History.Init();
//用户访问记录初始化
MAC.Ulog.Init();
//联想搜索初始化
MAC.Suggest.Init('.mac_wd',1,'');
//定时任务初始化
MAC.Timming();
});