var MAC={'Ajax':function(url,type,dataType,data,sfun,efun,cfun){type=type||'get';dataType=dataType||'json';data=data||'';efun=efun||'';cfun=cfun||'';$.ajax({url:url,type:type,dataType:dataType,data:data,timeout:5000,beforeSend:function(XHR){},error:function(XHR,textStatus,errorThrown){if(efun)efun(XHR,textStatus,errorThrown);},success:function(data){sfun(data);},complete:function(XHR,TS){if(cfun)cfun(XHR,TS);}})},'Suggest':{'Init':function($obj,$mid,$jumpurl){try{$($obj).autocomplete('/index.php/ajax/suggest?mid='+$mid,{inputClass:"ac_input",resultsClass:"ac_items",loadingClass:"ac_loading",minChars:1,matchSubset:0,cacheLength:10,multiple:false,matchContains:true,autoFill:false,dataType:"json",parse:function(r){if(r.code==1){var parsed=[];$.each(r['list'],function(index,row){row.url=r.url;parsed[index]={data:row};});return parsed;}else{return{data:''};}},formatItem:function(row,i,max){return row.name;},formatResult:function(row,i,max){return row.text;}}).result(function(event,data,formatted){$($obj).val(data.name);location.href=data.url.replace('mac_wd',encodeURIComponent(data.name));});} catch(e){}}},'Gbook':{'Init':function(){$('body').on('keyup','.report-content',function(e){MAC.Remaining($(this),200,'.gbook_remaining')});$('body').on('click','.gbook_submit',function(e){MAC.Gbook.Submit();});},'Submit':function(){if($(".report-content").val()==''){MAC.Pop.Msg('内容不能为空',1500);return false;} MAC.Ajax(maccms.path+'/index.php/gbook/saveData','post','json',$('.gbook_form').serialize(),function(r){MAC.Pop.Msg(r.msg,5000);if(r.code==1){location.reload();} else{if(MAC.Gbook.Verify==1){MAC.Verify.Refresh();}}});},'Report':function(name,id){MAC.Pop.Show('我要报错',maccms.path+'/index.php/gbook/report.html?id='+id+'&name='+encodeURIComponent(name),function(r){});}},'Pop':{'Remove':function(){$('.shortcuts-overlay').remove();$('.popup').remove();},'RemoveMsg':function(){$('.popup-msg').remove();},'Msg':function($msg,$timeout){if($('.shortcuts-overlay').length!=1){MAC.Pop.Remove();} $('body').append('
');$('.popup-msg').html($msg);$('.popup-msg').show();setTimeout(MAC.Pop.RemoveMsg,$timeout);},'Show':function($title,$url,$callback){if($('.shortcuts-mobile-overlay').length!=1){MAC.Pop.Remove();} $('body').append('