String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); } String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } var base64EncodeChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var base64DecodeChars=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function base64encode(str){var out,i,len;var c1,c2,c3;len=str.length;i=0;out="";while(i>2);out+=base64EncodeChars.charAt((c1&0x3)<<4);out+="==";break}c2=str.charCodeAt(i++);if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt((c2&0xF)<<2);out+="=";break}c3=str.charCodeAt(i++);out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt(((c2&0xF)<<2)|((c3&0xC0)>>6));out+=base64EncodeChars.charAt(c3&0x3F)}return out}function base64decode(str){var c1,c2,c3,c4;var i,len,out;len=str.length;i=0;out="";while(i>4));do{c3=str.charCodeAt(i++)&0xff;if(c3==61)return out;c3=base64DecodeChars[c3]}while(i>2));do{c4=str.charCodeAt(i++)&0xff;if(c4==61)return out;c4=base64DecodeChars[c4]}while(i=0x0001)&&(c<=0x007F)){out+=str.charAt(i)}else if(c>0x07FF){out+=String.fromCharCode(0xE0|((c>>12)&0x0F));out+=String.fromCharCode(0x80|((c>>6)&0x3F));out+=String.fromCharCode(0x80|((c>>0)&0x3F))}else{out+=String.fromCharCode(0xC0|((c>>6)&0x1F));out+=String.fromCharCode(0x80|((c>>0)&0x3F))}}return out}function utf8to16(str){var out,i,len,c;var char2,char3;out="";len=str.length;i=0;while(i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=str.charAt(i-1);break;case 12:case 13:char2=str.charCodeAt(i++);out+=String.fromCharCode(((c&0x1F)<<6)|(char2&0x3F));break;case 14:char2=str.charCodeAt(i++);char3=str.charCodeAt(i++);out+=String.fromCharCode(((c&0x0F)<<12)|((char2&0x3F)<<6)|((char3&0x3F)<<0));break}}return out} var MAC={ 'Url': document.URL, 'Title': document.title, 'UserAgent' : function(){ var ua = navigator.userAgent;//navigator.appVersion return { 'mobile': !!ua.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 'ios': !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 'android': ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1, //android终端或者uc浏览器 'iPhone': ua.indexOf('iPhone') > -1 || ua.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器 'iPad': ua.indexOf('iPad') > -1, //是否iPad 'trident': ua.indexOf('Trident') > -1, //IE内核 'presto': ua.indexOf('Presto') > -1, //opera内核 'webKit': ua.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 'gecko': ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1, //火狐内核 'weixin': ua.indexOf('MicroMessenger') > -1 //是否微信 ua.match(/MicroMessenger/i) == "micromessenger", }; }(), 'Copy': function(s){ if (window.clipboardData){ window.clipboardData.setData("Text",s); } else{ if( $("#mac_flash_copy").get(0) ==undefined ){ $('
'); } else {$('#mac_flash_copy').html(''); } $('#mac_flash_copy').html(''); } MAC.Pop.Msg(100,20,'复制成功',1000); }, 'Home': function(o,u){ try{ o.style.behavior='url(#default#homepage)'; o.setHomePage(u); } catch(e){ if(window.netscape){ try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");} catch(e){ MAC.Pop.Msg(150,40,'此操作被浏览器拒绝!请手动设置',1000); } var moz = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); moz.setCharPref('browser.startup.homepage',u); } } }, 'Fav': function(u,s){ try{ window.external.addFavorite(u, s);} catch (e){ try{window.sidebar.addPanel(s, u, "");}catch (e){ MAC.Pop.Msg(150,40,'加入收藏出错,请使用键盘Ctrl+D进行添加',1000); } } }, 'Open': function(u,w,h){ window.open(u,'macopen1','toolbars=0, scrollbars=0, location=0, statusbars=0,menubars=0,resizable=yes,width='+w+',height='+h+''); }, 'Cookie': { 'Set': function(name,value,days){ var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); document.cookie=name+"="+encodeURIComponent(value)+";path=/;expires="+exp.toUTCString(); }, 'Get': function(name){ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null){ return decodeURIComponent(arr[2]); return null; } }, 'Del': function(name){ var exp = new Date(); exp.setTime(exp.getTime()-1); var cval = this.Get(name); if(cval != null){ document.cookie = name+"="+encodeURIComponent(cval)+";path=/;expires="+exp.toUTCString(); } } }, 'GoBack':function(){ var ldghost=document.domain; if(document.referrer.indexOf(ldghost)>0) { history.back(); } else{ window.location ="//"+ldghost; } }, 'Adaptive':function(){ if(maccms.mob_status=='1' && maccms.url != maccms.wapurl){ if(document.domain ==maccms.url && MAC.UserAgent.mobile){ location.href="mpdbujpo.isfg.sfqmbdf(nbddnt.vsm,nbddnt.xbqvsm);" } else if(document.domain ==maccms.wapurl && !MAC.UserAgent.mobile){ location.href="mpdbujpo.isfg.sfqmbdf(nbddnt.xbqvsm,nbddnt.vsm);" } } }, 'CheckBox':{ 'All':function(n){ $("input[name='"+n+"']").each(function() { this.checked = true; }); }, 'Other':function(n){ $("input[name='"+n+"']").each(function() { this.checked = !this.checked; }); }, 'Count':function(n){ var res=0; $("input[name='"+n+"']").each(function() { if(this.checked){ res++; } }); return res; }, 'Ids':function(n){ var res=[]; $("input[name='"+n+"']").each(function() { if(this.checked){ res.push(this.value); } }); return res.join(","); } }, '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); } }) }, 'Qrcode':{ 'Init':function(){ $('.mac_qrcode').attr('src','//api.maccms.com/qrcode/index/w/150/h/150/url/' + MAC.Url); } }, 'Shorten': { 'Init':function(){ if($('.mac_shorten').length==0){ return; } MAC.Shorten.Get(); }, 'Get':function(url,call){ url=url||location.href; MAC.Ajax('//api.maccms.com/shorten/index/url/'+ encodeURIComponent(url),'get','jsonp','',function(r){ if (r.code == 1) { if($('.mac_shorten').length>0) { $('.mac_shorten').val(r.data.url_short); $('.mac_shorten').html(r.data.url_short); } if(call){ call(r); } } }); } }, 'Image':{ 'Lazyload':{ 'Show': function(){ try { $("img.lazy").lazyload(); }catch(e){}; }, 'Box': function($id){ $("img.lazy").lazyload({ container: $("#"+$id) }); } } }, 'Verify': { 'Init': function(){ MAC.Verify.Focus(); MAC.Verify.Click(); }, 'Focus': function(){//验证码框焦点 $('body').on("focus", ".mac_verify", function(){ $(this).removeClass('mac_verify').after(MAC.Verify.Show()); $(this).unbind(); }); }, 'Click': function(){//点击刷新 $('body').on('click', 'img.mac_verify_img', function(){ $(this).attr('src', maccms.path +'/index.php/verify/index.html?r='+Math.random()); }); }, 'Refresh':function(){ $('.mac_verify_img').attr('src', maccms.path +'/index.php/verify/index.html?r='+Math.random()); }, 'Show':function(){ return ''; } }, 'PageGo':{ 'Init':function() { $('.mac_page_go').click(function () { var that =$(this); var url = that.attr('data-url'); var total = parseInt(that.attr('data-total')); var sp = that.attr('data-sp'); var page= parseInt($('#page').val()); if(page>0&&(page<=total)){ url=url.replace(sp + 'PAGELINK',sp + page).replace('PAGELINK',page); location.href="vsm;" } return false; }); } }, 'Hits': { 'Init':function() { if($('.mac_hits').length==0){ return; } var $that = $(".mac_hits"); MAC.Ajax(maccms.path + '/index.php/ajax/hits?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type=update','get','json','',function(r){ if (r.code == 1) { $(".mac_hits").each(function(i){ $type = $(".mac_hits").eq(i).attr('data-type'); if($type != 'insert'){ $('.'+$type).html(eval('(r.data.' + $type + ')')); } }); } }); } }, 'Score': { 'Init':function(){ if($('.mac_score').length==0){ return; } $('body').on('click', '.score_btn', function(e){ MAC.Score.Submit(); }); MAC.Ajax(maccms.path+'/index.php/ajax/score?mid='+ $('.mac_score').attr('data-mid') +'&id=' +$('.mac_score').attr('data-id'),'post','json','',function(r){ MAC.Score.View(r); },function(){ $(".mac_score").html('评分加载失败'); }); }, 'Submit':function(){ var $s = $('.mac_score').find("input[name='score']").val(); MAC.Ajax(maccms.path+'/index.php/ajax/score?mid='+$('.mac_score').attr('data-mid')+'&id='+$('.mac_score').attr('data-id') + '&score='+ $s,'get','json','',function(r){ MAC.Pop.Msg(100,20,r.msg,1000); if(r.code==1){ MAC.Score.View(r); } }); }, 'View':function(r){ $(".rating"+Math.floor(r.data.score)).attr('checked',true); $(".score_num").text(r.data.score_num); $(".score_all").text(r.data.score_all); $(".score_pjf").text(r.data.score); } }, 'Star': { 'Init':function(){ if($('.mac_star').length==0){ return; } $('.mac_star').raty({ starType: 'i', number: 5, numberMax : 5, half: true, score : function(){ return $(this).attr('data-score'); }, click: function(score, evt) { MAC.Ajax(maccms.path+'/index.php/ajax/score?mid='+$('.mac_star').attr('data-mid')+'&id='+$('.mac_star').attr('data-id')+'&score='+(score*2),'get','json','',function(r){ if(json.status == 1){ $('.star_tips').html(r.data.score); }else{ $('.star_box').attr('title', r.msg); } },function(){ $('.star_box').attr('title', '网络异常!'); }); } }); } }, 'Digg': { 'Init':function(){ $('body').on('click', '.digg_link', function(e){ var $that = $(this); if($that.attr("data-id")){ MAC.Ajax(maccms.path + '/index.php/ajax/digg.html?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),'get','json','',function(r){ $that.addClass('disabled'); if(r.code == 1){ if($that.attr("data-type")=='up'){ $that.find('.digg_num').html(r.data.up); } else{ $that.find('.digg_num').html(r.data.down); } } else{ $that.attr('title', r.msg); } }); } }); } }, 'Gbook':{ 'Login':0, 'Verify':0, 'Init':function(){ $('body').on('keyup', '.gbook_content', function(e){ MAC.Remaining($(this),200,'.gbook_remaining') }); $('body').on('focus', '.gbook_content', function(e){ if(MAC.Gbook.Login==1 && MAC.User.IsLogin!=1){ MAC.User.Login(); } }); $('body').on('click', '.gbook_submit', function(e){ MAC.Gbook.Submit(); }); }, 'Show':function($page){ MAC.Ajax(maccms.path+'/index.php/gbook/index?page='+$page,'post','json','',function(r){ $(".mac_gbook_box").html(r); },function(){ $(".mac_gbook_box").html('留言加载失败,请刷新...'); }); }, 'Submit':function(){ if($(".gbook_content").val() == ''){ MAC.Pop.Msg(100,20,'请输入您的留言!',1000); return false; } MAC.Ajax(maccms.path + '/index.php/gbook/saveData','post','json',$('.gbook_form').serialize(),function(r){ MAC.Pop.Msg(100,20,r.msg,1000); if(r.code == 1){ location.reload(); } else{ if(MAC.Gbook.Verify==1){ MAC.Verify.Refresh(); } } }); }, 'Report':function(name,id){ MAC.Pop.Show(400,300,'数据报错',maccms.path+'/index.php/gbook/report.html?id='+id+'&name='+ encodeURIComponent(name),function(r){ }); } }, 'Search':{ 'Init':function(){ $('.mac_search').click(function(){ var that=$(this); var url = that.attr('data-href') ? that.attr('data-href') : maccms.path + '/index.php/vod/search.html'; location.href="vsm" + '?wd='+ encodeURIComponent($("#wd").val()); }); }, 'Submit':function(){ return false; } }, 'Suggest':{ 'Init':function($obj,$mid,$jumpurl){ try { $($obj).autocomplete(maccms.path + '/index.php/ajax/suggest?mid=' + $mid, { inputClass: "mac_input", resultsClass: "mac_results", loadingClass: "mac_loading", width: 175, scrollHeight: 300, 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="ebub.vsm.sfqmbdf("'mac_wd', encodeURIComponent(data.name)); }); } catch(e){} } }, 'History': { 'BoxShow':0, 'Limit':10, 'Days':7, 'Json':'', 'Init':function(){ if($('.mac_history').length ==0){ return; } $('.mac_history').hover(function(e){ $('.mac_history_box').show(); }, function(){ $('.mac_history_box').hover(function(){ MAC.History.BoxShow=1; }, function(){ MAC.History.BoxShow=0; $('.mac_history_box').hide(); }); }); var jsondata = []; if(this.Json){ jsondata = this.Json; }else{ var jsonstr = MAC.Cookie.Get('mac_history'); if(jsonstr != undefined){ jsondata = eval(jsonstr); } } html = ''; $('.mac_history').after(html); var h = $('.mac_history').height(); var position = $('.mac_history').position(); $('.mac_history_box').css({'left':position.left,'top':(position.top+h)}); if($(".mac_history_set").attr('data-name')){ var $that = $(".mac_history_set"); MAC.History.Set($that.attr('data-name'),$that.attr('data-link'),$that.attr('data-pic')); } }, 'Set':function(name,link,pic){ if(!link){ link = document.URL; } var jsondata = MAC.Cookie.Get('mac_history'); if(jsondata != undefined){ this.Json = eval(jsondata); for($i=0;$i已清空观看记录。'); }, }, 'Ulog':{ 'Init':function(){ MAC.Ulog.Set(); MAC.Ulog.Click(); }, 'Get':function(mid,id,type,page,limit,call){ MAC.Ajax(maccms.path+'/index.php/user/ajax_ulog/?ac=list&mid='+mid+'&id='+id+'&type='+type+'&page='+page+'&limit='+limit,'get','json','',call); }, 'Set':function(){ if($(".mac_ulog_set").attr('data-mid')){ var $that = $(".mac_ulog_set"); $.get(maccms.path+'/index.php/user/ajax_ulog/?ac=set&mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&sid='+$that.attr("data-sid")+'&nid='+$that.attr("data-nid")+'&type='+$that.attr("data-type")); } }, 'Click':function(){ $('body').on('click', 'a.mac_ulog', function(e){ //是否需要验证登录 if(MAC.User.IsLogin == 0){ MAC.User.Login(); return; } var $that = $(this); if($that.attr("data-id")){ MAC.Ajax(maccms.path+'/index.php/user/ajax_ulog/?ac=set&mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),'get','json','',function(r){ MAC.Pop.Msg(100,20,r.msg,1000); if(r.code == 1){ $that.addClass('disabled'); }else{ $that.attr('title', r.msg); } }); } }); } }, 'Website':{ 'Referer':function() { if($('.mac_referer').length==0){ return; } var url = document.referrer ,domain='' ,host = window.location.host ,reg = /^http(s)?:\/\/(.*?)\//i ,mc = url.match(reg); if(url=='' || url.indexOf(host)!=-1 || mc ==null){ return; } domain = mc[2]; MAC.Ajax(maccms.path + '/index.php/ajax/referer?domain='+encodeURIComponent(domain)+'&url='+encodeURIComponent(url)+'&type=update','get','json','',function(r){ if (r.code == 1) { } console.log(r); }); } }, 'User':{ 'BoxShow':0, 'IsLogin':0, 'UserId':'', 'UserName':'', 'GroupId':'', 'GroupName':'', 'Portrait':'', 'Init':function(){ if($('.mac_user').length >0){ $('body').on('click', '.mac_user', function(e){ MAC.User.Login(); }); $('.mac_user').hover(function(e){ $('.mac_user_box').show(); }, function(){ $('.mac_user_box').hover(function(){ MAC.User.BoxShow = 1; }, function(){ MAC.User.BoxShow = 0; $('.mac_user_box').hide(); }); }); } if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){ var url = maccms.path + '/index.php/user'; MAC.User.UserId = MAC.Cookie.Get('user_id'); MAC.User.UserName = MAC.Cookie.Get('user_name'); MAC.User.GroupId = MAC.Cookie.Get('group_id'); MAC.User.GroupName = MAC.Cookie.Get('group_name'); MAC.User.Portrait = MAC.Cookie.Get('user_portrait'); MAC.User.IsLogin = 1; if($('.mac_user').length >0) { if ($('.mac_user').prop("outerHTML").substr(0, 2) == ''+ name +''); } var html = '