1 2String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); } 3String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } 4var 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<len){c1=str.charCodeAt(i++)&0xff;if(i==len){out+=base64EncodeChars.charAt(c1>>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<len){do{c1=base64DecodeChars[str.charCodeAt(i++)&0xff]}while(i<len&&c1==-1);if(c1==-1)break;do{c2=base64DecodeChars[str.charCodeAt(i++)&0xff]}while(i<len&&c2==-1);if(c2==-1)break;out+=String.fromCharCode((c1<<2)|((c2&0x30)>>4));do{c3=str.charCodeAt(i++)&0xff;if(c3==61)return out;c3=base64DecodeChars[c3]}while(i<len&&c3==-1);if(c3==-1)break;out+=String.fromCharCode(((c2&0XF)<<4)|((c3&0x3C)>>2));do{c4=str.charCodeAt(i++)&0xff;if(c4==61)return out;c4=base64DecodeChars[c4]}while(i<len&&c4==-1);if(c4==-1)break;out+=String.fromCharCode(((c3&0x03)<<6)|c4)}return out}function utf16to8(str){var out,i,len,c;out="";len=str.length;for(i=0;i<len;i++){c=str.charCodeAt(i);if((c>=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<len){c=str.charCodeAt(i++);switch(c>>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} 5 6var MAC={ 7 'Url': document.URL, 8 'Title': document.title, 9 'UserAgent' : function(){ 10 var ua = navigator.userAgent;//navigator.appVersion 11 return { 12 'mobile': !!ua.match(/AppleWebKit.*Mobile.*/), //æ¯å¦ä¸ºç§»å¨ç»ç«¯ 13 'ios': !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //iosç»ç«¯ 14 'android': ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1, //androidç»ç«¯æè ucæµè§å¨ 15 'iPhone': ua.indexOf('iPhone') > -1 || ua.indexOf('Mac') > -1, //æ¯å¦ä¸ºiPhoneæè QQHDæµè§å¨ 16 'iPad': ua.indexOf('iPad') > -1, //æ¯å¦iPad 17 'trident': ua.indexOf('Trident') > -1, //IEå æ ¸ 18 'presto': ua.indexOf('Presto') > -1, //operaå æ ¸ 19 'webKit': ua.indexOf('AppleWebKit') > -1, //è¹æãè°·æå æ ¸ 20 'gecko': ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1, //ç«çå æ ¸ 21 'weixin': ua.indexOf('MicroMessenger') > -1 //æ¯å¦å¾®ä¿¡ ua.match(/MicroMessenger/i) == "micromessenger", 22 }; 23 }(), 24 'Copy': function(s){ 25 if (window.clipboardData){ window.clipboardData.setData("Text",s); } 26 else{ 27 if( $("#mac_flash_copy").get(0) ==undefined ){ $('<div id="mac_flash_copy"></div>'); } else {$('#mac_flash_copy').html(''); } 28 $('#mac_flash_copy').html('<embed src='+maccms.path+'"images/_clipboard.swf" FlashVars="clipboard='+escape(s)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'); 29 } 30 MAC.Pop.Msg(100,20,'å¤å¶æå',1000); 31 }, 32 'Home': function(o,u){ 33 try{ 34 o.style.behavior='url(#default#homepage)'; o.setHomePage(u); 35 } 36 catch(e){ 37 if(window.netscape){ 38 try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");} 39 catch(e){ MAC.Pop.Msg(150,40,'æ¤æä½è¢«æµè§å¨æç»ï¼è¯·æå¨è®¾ç½®',1000); } 40 var moz = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); 41 moz.setCharPref('browser.startup.homepage',u); 42 } 43 } 44 }, 45 'Fav': function(u,s){ 46 try{ window.external.addFavorite(u, s);} 47 catch (e){
48 try{window.sidebar.addPanel(s, u, "");}catch (e){ MAC.Pop.Msg(150,40,'å å ¥æ¶èåºéï¼è¯·ä½¿ç¨é®çCtrl+Dè¿è¡æ·»å ',1000); } 49 } 50 }, 51 'Open': function(u,w,h){ 52 window.open(u,'macopen1','toolbars=0, scrollbars=0, location=0, statusbars=0,menubars=0,resizable=yes,width='+w+',height='+h+''); 53 }, 54 'Cookie': { 55 'Set': function(name,value,days){ 56 var exp = new Date(); 57 exp.setTime(exp.getTime() + days*24*60*60*1000); 58 var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); 59 document.cookie=name+"="+encodeURIComponent(value)+";path=/;expires="+exp.toUTCString(); 60 }, 61 'Get': function(name){ 62 var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); 63 if(arr != null){ return decodeURIComponent(arr[2]); return null; } 64 }, 65 'Del': function(name){ 66 var exp = new Date(); 67 exp.setTime(exp.getTime()-1); 68 var cval = this.Get(name); 69 if(cval != null){ document.cookie = name+"="+encodeURIComponent(cval)+";path=/;expires="+exp.toUTCString(); } 70 } 71 }, 72 'GoBack':function(){ 73 var ldghost=document.domain; 74 if(document.referrer.indexOf(ldghost)>0) { 75 history.back(); 76 } 77 else{ 78 window.location ="//"+ldghost; 79 } 80 }, 81 'Adaptive':function(){ 82 if(maccms.mob_status=='1' && maccms.url != maccms.wapurl){ 83 if(document.domain ==maccms.url && MAC.UserAgent.mobile){ 84 location.href = location.href.replace(maccms.url,maccms.wapurl); 85 } 86 else if(document.domain ==maccms.wapurl && !MAC.UserAgent.mobile){ 87 location.href = location.href.replace(maccms.wapurl,maccms.url); 88 } 89 } 90 }, 91 'CheckBox':{ 92 'All':function(n){ 93 $("input[name='"+n+"']").each(function() { 94 this.checked = true; 95 }); 96 }, 97 'Other':function(n){ 98 $("input[name='"+n+"']").each(function() { 99 this.checked = !this.checked; 100 }); 101 }, 102 'Count':function(n){ 103 var res=0; 104 $("input[name='"+n+"']").each(function() { 105 if(this.checked){ res++; } 106 }); 107 return res; 108 }, 109 'Ids':function(n){ 110 var res=[]; 111 $("input[name='"+n+"']").each(function() { 112 if(this.checked){ res.push(this.value); } 113 }); 114 return res.join(","); 115 } 116 }, 117 'Ajax':function(url,type,dataType,data,sfun,efun,cfun){ 118 type=type||'get'; 119 dataType=dataType||'json'; 120 data=data||''; 121 efun=efun||''; 122 cfun=cfun||''; 123 124 $.ajax({ 125 url:url, 126 type:type, 127 dataType:dataType, 128 data:data, 129 timeout: 5000, 130 beforeSend:function(XHR){ 131 132 }, 133 error:function(XHR,textStatus,errorThrown){ 134 if(efun) efun(XHR,textStatus,errorThrown); 135 }, 136 success:function(data){ 137 sfun(data); 138 }, 139 complete:function(XHR, TS){ 140 if(cfun) cfun(XHR, TS); 141 } 142 }) 143 }, 144 'Qrcode':{ 145 'Init':function(){ 146 $('.mac_qrcode').attr('src', maccms.path +'/index.php/qrcode/index.html?url='+ MAC.Url); 147 } 148 }, 149 'Shorten': { 150 'Init':function(){ 151 if($('.mac_shorten').length==0){ 152 return; 153 } 154 MAC.Shorten.Get(); 155 }, 156 'Get':function(url,call){ 157 url=url||location.href; 158 MAC.Ajax('//api.maccms.la/shorten/index/url/'+ encodeURIComponent(url),'get','jsonp','',function(r){ 159 if (r.code == 1) { 160 if($('.mac_shorten').length>0) { 161 $('.mac_shorten').val(r.data.url_short); 162 $('.mac_shorten').html(r.data.url_short); 163 } 164 if(call){ 165 call(r); 166 } 167 168 } 169 }); 170 } 171 }, 172 'Image':{ 173 'Lazyload':{ 174 'Show': function(){ 175 try { $("img.lazy").lazyload(); }catch(e){}; 176 }, 177 'Box': function($id){ 178 $("img.lazy").lazyload({ 179 container: $("#"+$id) 180 }); 181 } 182 } 183 }, 184 'Verify': { 185 'Init': function(){ 186 MAC.Verify.Focus(); 187 MAC.Verify.Click(); 188 }, 189 'Focus': function(){//éªè¯ç æ¡ç¦ç¹ 190 $('body').on("focus", ".mac_verify", function(){ 191 $(this).removeClass('mac_verify').after(MAC.Verify.Show()); 192 $(this).unbind(); 193 }); 194 }, 195 'Click': function(){//ç¹å»å·æ° 196 $('body').on('click', 'img.mac_verify_img', function(){
197 $(this).attr('src', maccms.path +'/index.php/verify/index.html?r='+Math.random()); 198 }); 199 }, 200 'Refresh':function(){ 201 $('.mac_verify_img').attr('src', maccms.path +'/index.php/verify/index.html?r='+Math.random()); 202 }, 203 'Show':function(){ 204 return '<img class="mac_verify_img" src="'+ maccms.path +'/index.php/verify/index.html?" title="ç䏿¸ æ¥? æ¢ä¸å¼ ï¼">'; 205 } 206 }, 207 'PageGo':{ 208 'Init':function() { 209 $('.mac_page_go').click(function () { 210 var that =$(this); 211 var url = that.attr('data-url'); 212 var total = parseInt(that.attr('data-total')); 213 var sp = that.attr('data-sp'); 214 var page= parseInt($('#page').val()); 215 216 if(page>0&&(page<=total)){ 217 url=url.replace(sp + 'PAGELINK',sp + page).replace('PAGELINK',page); 218 location.href=url; 219 } 220 return false; 221 }); 222 } 223 }, 224 'Hits': { 225 'Init':function() { 226 if($('.mac_hits').length==0){ 227 return; 228 } 229 var $that = $(".mac_hits"); 230 231 MAC.Ajax(maccms.path + '/index.php/ajax/hits?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type=update','get','json','',function(r){ 232 if (r.code == 1) { 233 $(".mac_hits").each(function(i){ 234 $type = $(".mac_hits").eq(i).attr('data-type'); 235 if($type != 'insert'){ 236 $('.'+$type).html(eval('(r.data.' + $type + ')')); 237 } 238 }); 239 } 240 }); 241 242 } 243 }, 244 'Score': { 245 'Init':function(){ 246 if($('.mac_score').length==0){ 247 return; 248 } 249 $('body').on('click', '.score_btn', function(e){ 250 MAC.Score.Submit(); 251 }); 252 253 MAC.Ajax(maccms.path+'/index.php/ajax/score?mid='+ $('.mac_score').attr('data-mid') +'&id=' +$('.mac_score').attr('data-id'),'post','json','',function(r){ 254 MAC.Score.View(r); 255 },function(){ 256 $(".mac_score").html('è¯åå 载失败'); 257 }); 258 259 }, 260 'Submit':function(){ 261 var $s = $('.mac_score').find("input[name='score']").val(); 262 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){ 263 MAC.Pop.Msg(100,20,r.msg,1000); 264 if(r.code==1){ 265 MAC.Score.View(r); 266 } 267 }); 268 }, 269 'View':function(r){ 270 $(".rating"+Math.floor(r.data.score)).attr('checked',true); 271 $(".score_num").text(r.data.score_num); 272 $(".score_all").text(r.data.score_all); 273 $(".score_pjf").text(r.data.score); 274 } 275 }, 276 'Star': { 277 'Init':function(){ 278 if($('.mac_star').length==0){ 279 return; 280 } 281 282 $('.mac_star').raty({ 283 starType: 'i', 284 number: 5, 285 numberMax : 5, 286 half: true, 287 score : function(){ 288 return $(this).attr('data-score'); 289 }, 290 click: function(score, evt) { 291 292 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){ 293 if(json.status == 1){ 294 $('.star_tips').html(r.data.score); 295 }else{ 296 $('.star_box').attr('title', r.msg); 297 } 298 },function(){ 299 $('.star_box').attr('title', 'ç½ç»å¼å¸¸ï¼'); 300 }); 301 302 } 303 }); 304 } 305 }, 306 'Digg': { 307 'Init':function(){ 308 $('body').on('click', '.digg_link', function(e){ 309 var $that = $(this); 310 if($that.attr("data-id")){ 311 312 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){ 313 $that.addClass('disabled'); 314 if(r.code == 1){ 315 if($that.attr("data-type")=='up'){ 316 $that.find('.digg_num').html(r.data.up); 317 } 318 else{ 319 $that.find('.digg_num').html(r.data.down); 320 } 321 } 322 else{ 323 $that.attr('title', r.msg); 324 } 325 }); 326 327 } 328 }); 329 } 330 }, 331 'Gbook':{ 332 'Login':0, 333 'Verify':0, 334 'Init':function(){ 335 $('body').on('keyup', '.gbook_content', function(e){ 336 MAC.Remaining($(this),200,'.gbook_remaining') 337 }); 338 $('body').on('focus', '.gbook_content', function(e){ 339 if(MAC.Gbook.Login==1 && MAC.User.IsLogin!=1){ 340 MAC.User.Login(); 341 } 342 }); 343 $('body').on('click', '.gbook_submit', function(e){ 344 MAC.Gbook.Submit(); 345 }); 346 }, 347 'Show':function($page){ 348 MAC.Ajax(maccms.path+'/index.php/gbook/index?page='+$page,'post','json','',function(r){ 349 $(".mac_gbook_box").html(r); 350 },function(){ 351 $(".mac_gbook_box").html('çè¨å 载失败ï¼è¯·å·æ°...'); 352 }); 353 }, 354 'Submit':function(){ 355 if($(".gbook_content").val() == ''){ 356 MAC.Pop.Msg(100,20,'请è¾å ¥æ¨ççè¨!',1000); 357 return false;
358 } 359 MAC.Ajax(maccms.path + '/index.php/gbook/saveData','post','json',$('.gbook_form').serialize(),function(r){ 360 MAC.Pop.Msg(100,20,r.msg,1000); 361 if(r.code == 1){ 362 location.reload(); 363 } 364 else{ 365 if(MAC.Gbook.Verify==1){ 366 MAC.Verify.Refresh(); 367 } 368 } 369 }); 370 }, 371 'Report':function(name,id){ 372 MAC.Pop.Show(400,300,'æ°æ®æ¥é',maccms.path+'/index.php/gbook/report.html?id='+id+'&name='+ encodeURIComponent(name),function(r){ 373 374 }); 375 } 376 }, 377 'Search':{ 378 'Init':function(){ 379 $('.mac_search').click(function(){ 380 var that=$(this); 381 var url = that.attr('data-href') ? that.attr('data-href') : maccms.path + '/index.php/vod/search.html'; 382 location.href = url + '?wd='+ encodeURIComponent($("#wd").val()); 383 }); 384 }, 385 'Submit':function(){ 386 387 return false; 388 } 389 }, 390 'Suggest':{ 391 'Init':function($obj,$mid,$jumpurl){ 392 try { 393 $($obj).autocomplete(maccms.path + '/index.php/ajax/suggest?mid=' + $mid, { 394 inputClass: "mac_input", 395 resultsClass: "mac_results", 396 loadingClass: "mac_loading", 397 width: 175, scrollHeight: 300, minChars: 1, matchSubset: 0, 398 cacheLength: 10, multiple: false, matchContains: true, autoFill: false, 399 dataType: "json", 400 parse: function (r) { 401 if (r.code == 1) { 402 var parsed = []; 403 $.each(r['list'], function (index, row) { 404 row.url = r.url; 405 parsed[index] = { 406 data: row 407 }; 408 }); 409 return parsed; 410 } else { 411 return {data: ''}; 412 } 413 }, 414 formatItem: function (row, i, max) { 415 return row.name; 416 }, 417 formatResult: function (row, i, max) { 418 return row.text; 419 } 420 }).result(function (event, data, formatted) { 421 $($obj).val(data.name); 422 location.href = data.url.replace('mac_wd', encodeURIComponent(data.name)); 423 }); 424 } 425 catch(e){} 426 } 427 }, 428 'History': { 429 'BoxShow':0, 430 'Limit':10, 431 'Days':7, 432 'Json':'', 433 'Init':function(){ 434 if($('.mac_history').length ==0){ 435 return; 436 } 437 438 $('.mac_history').hover(function(e){ 439 $('.mac_history_box').show(); 440 }, function(){ 441 $('.mac_history_box').hover(function(){ 442 MAC.History.BoxShow=1; 443 }, function(){ 444 MAC.History.BoxShow=0; 445 $('.mac_history_box').hide(); 446 }); 447 }); 448 449 var jsondata = []; 450 if(this.Json){ 451 jsondata = this.Json; 452 }else{ 453 var jsonstr = MAC.Cookie.Get('mac_history'); 454 if(jsonstr != undefined){ 455 jsondata = eval(jsonstr); 456 } 457 } 458 459 html = '<dl class="mac_drop_box mac_history_box" style="display:none;">'; 460 html +='<dt><a target="_self" href="javascript:void(0)" onclick="MAC.History.Clear();">æ¸ ç©º</a></dt>'; 461 462 if(jsondata.length > 0){ 463 for($i=0; $i<jsondata.length; $i++){ 464 if($i%2==1){ 465 html +='<dd class="odd">'; 466 }else{ 467 html +='<dd class="even">'; 468 } 469 html +='<a href="'+jsondata[$i].link+'" class="hx_title">'+jsondata[$i].name+'</a></dd>'; 470 } 471 }else{ 472 html +='<dd class="hide">ææ æµè§è®°å½</dd>'; 473 } 474 html += '</dl>'; 475 476 $('.mac_history').after(html); 477 var h = $('.mac_history').height(); 478 var position = $('.mac_history').position(); 479 $('.mac_history_box').css({'left':position.left,'top':(position.top+h)}); 480 481 482 if($(".mac_history_set").attr('data-name')){ 483 var $that = $(".mac_history_set"); 484 MAC.History.Set($that.attr('data-name'),$that.attr('data-link'),$that.attr('data-pic')); 485 } 486 }, 487 'Set':function(name,link,pic){ 488 if(!link){ link = document.URL; } 489 var jsondata = MAC.Cookie.Get('mac_history'); 490 491 if(jsondata != undefined){ 492 this.Json = eval(jsondata); 493 494 for($i=0;$i<this.Json.length;
494$i++){ 495 if(this.Json[$i].link == link){ 496 return false; 497 } 498 } 499 500 jsonstr = '{log:[{"name":"'+name+'","link":"'+link+'","pic":"'+pic+'"},'; 501 for($i=0; $i<this.Json.length; $i++){ 502 if($i<= this.Limit && this.Json[$i]){ 503 jsonstr += '{"name":"'+this.Json[$i].name+'","link":"'+this.Json[$i].link+'","pic":"'+this.Json[$i].pic+'"},'; 504 }else{ 505 break; 506 } 507 } 508 jsonstr = jsonstr.substring(0,jsonstr.lastIndexOf(',')); 509 jsonstr += "]}"; 510 }else{ 511 jsonstr = '{log:[{"name":"'+name+'","link":"'+link+'","pic":"'+pic+'"}]}'; 512 } 513 this.Json = eval(jsonstr); 514 MAC.Cookie.Set('mac_history',jsonstr,this.Days); 515 }, 516 'Clear': function(){ 517 MAC.Cookie.Del('mac_history'); 518 $('.mac_history_box').html('<li class="hx_clear">å·²æ¸ ç©ºè§çè®°å½ã</li>'); 519 }, 520 }, 521 'Ulog':{ 522 'Init':function(){ 523 MAC.Ulog.Set(); 524 MAC.Ulog.Click(); 525 526 }, 527 'Get':function(mid,id,type,page,limit,call){ 528 MAC.Ajax(maccms.path+'/index.php/user/ajax_ulog/?ac=list&mid='+mid+'&id='+id+'&type='+type+'&page='+page+'&limit='+limit,'get','json','',call); 529 }, 530 'Set':function(){ 531 if($(".mac_ulog_set").attr('data-mid')){ 532 var $that = $(".mac_ulog_set"); 533 $.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")); 534 } 535 }, 536 'Click':function(){ 537 $('body').on('click', 'a.mac_ulog', function(e){ 538 539 //æ¯å¦éè¦éªè¯ç»å½ 540 if(MAC.User.IsLogin == 0){ 541 MAC.User.Login(); 542 return; 543 } 544 545 var $that = $(this); 546 if($that.attr("data-id")){ 547 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){ 548 MAC.Pop.Msg(100,20,r.msg,1000); 549 if(r.code == 1){ 550 $that.addClass('disabled'); 551 }else{ 552 $that.attr('title', r.msg); 553 } 554 }); 555 } 556 }); 557 } 558 }, 559 'Website':{ 560 'Referer':function() { 561 if($('.mac_referer').length==0){ 562 return; 563 } 564 565 var url = document.referrer 566 ,domain='' 567 ,host = window.location.host 568 ,reg = /^http(s)?:\/\/(.*?)\//i 569 ,mc = url.match(reg); 570 571 if(url=='' || url.indexOf(host)!=-1 || mc ==null){ 572 return; 573 } 574 domain = mc[2]; 575 MAC.Ajax(maccms.path + '/index.php/ajax/referer?domain='+encodeURIComponent(domain)+'&url='+encodeURIComponent(url)+'&type=update','get','json','',function(r){ 576 if (r.code == 1) { 577 } 578 console.log(r); 579 }); 580 } 581 }, 582 'User':{ 583 'BoxShow':0, 584 'IsLogin':0, 585 'UserId':'', 586 'UserName':'', 587 'GroupId':'', 588 'GroupName':'', 589 'Portrait':'', 590 'Init':function(){ 591 if($('.mac_user').length >0){ 592 $('body').on('click', '.mac_user', function(e){ 593 MAC.User.Login(); 594 }); 595 596 $('.mac_user').hover(function(e){ 597 $('.mac_user_box').show(); 598 }, function(){ 599 $('.mac_user_box').hover(function(){ 600 MAC.User.BoxShow = 1; 601 }, function(){ 602 MAC.User.BoxShow = 0; 603 $('.mac_user_box').hide(); 604 }); 605 }); 606 } 607
608 if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){ 609 var url = maccms.path + '/index.php/user'; 610 MAC.User.UserId = MAC.Cookie.Get('user_id'); 611 MAC.User.UserName = MAC.Cookie.Get('user_name'); 612 MAC.User.GroupId = MAC.Cookie.Get('group_id'); 613 MAC.User.GroupName = MAC.Cookie.Get('group_name'); 614 MAC.User.Portrait = MAC.Cookie.Get('user_portrait'); 615 MAC.User.IsLogin = 1; 616 617 if($('.mac_user').length >0) { 618 if ($('.mac_user').prop("outerHTML").substr(0, 2) == '<a') { 619 $('.mac_user').attr('href', url); 620 $('.mac_user').text(MAC.User.UserName); 621 } 622 else { 623 //$('.mac_user').html('<a class="mac_text" href="'+ url +'">'+ name +'</a>'); 624 } 625 626 var html = '<div class="mac_drop_box mac_user_box" style="display: none;">'; 627 html += '<ul class="logged"><li><a target="_blank" href="' + url + '">ç¨æ·ä¸å¿</a></li><li class="logout"><a class="logoutbt" href="javascript:;" onclick="MAC.User.Logout();" target="_self"><i class="user-logout"></i>éåº</a></li></ul>' 628 629 $('.mac_user').after(html); 630 var h = $('.mac_user').height(); 631 var position = $('.mac_user').position(); 632 $('.mac_user_box').css({'left': position.left, 'top': (position.top + h)}); 633 } 634 635 } 636 else{ 637 638 } 639 640 }, 641 'CheckLogin':function(){ 642 if(MAC.User.IsLogin == 0){ 643 MAC.User.Login(); 644 } 645 }, 646 'Login':function(){ 647 var ac='ajax_login'; 648 if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){ 649 ac= 'ajax_info'; 650 } 651 MAC.Pop.Show(400,380,'ç¨æ·ç»å½',maccms.path+'/index.php/user/'+ac,function(r){ 652 $('body').off('click', '.login_form_submit'); 653 $('body').on('click', '.login_form_submit', function(e){ 654 $(this).unbind('click'); 655 656 MAC.Ajax(maccms.path + '/index.php/user/login','post','json',$('.mac_login_form').serialize(),function(r){ 657 alert(r.msg); 658 if(r.code == 1){ 659 location.reload(); 660 } 661 }); 662 }); 663 }); 664 }, 665 'Logout':function(){ 666 MAC.Ajax(maccms.path + '/index.php/user/logout','post','json','',function(r){ 667 MAC.Pop.Msg(100,20,r.msg,1000); 668 if(r.code == 1){ 669 location.reload(); 670 } 671 }); 672 }, 673 'PopedomCallBack':function(trysee,h) { 674 window.setTimeout(function(){ 675 $(window.frames["player_if"].document).find(".MacPlayer").html(h); 676 },1000*10*trysee); 677 }, 678 'BuyPopedom':function(o){ 679 var $that = $(o); 680 if($that.attr("data-id")){ 681 if (confirm('æ¨ç¡®è®¤è´ä¹°æ¤æ¡æ°æ®è®¿é®æéåï¼')) { 682 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){ 683 $that.addClass('disabled'); 684 MAC.Pop.Msg(300, 50, r.msg, 2000); 685 if (r.code == 1) { 686 top.location.reload(); 687 } 688 $that.removeClass('disabled'); 689 }); 690 } 691 } 692 } 693 }, 694 'Pop':{ 695 'Remove':function(){ 696 $('.mac_pop_bg').remove(); 697 $('.mac_pop').remove(); 698 }, 699 'RemoveMsg':function(){ 700 $('.mac_pop_msg_bg').remove(); 701 $('.mac_pop_msg').remove(); 702 }, 703 'Msg':function($w,$h,$msg,$timeout){ 704 if($('.mac_pop_bg').length !=1) { 705 MAC.Pop.Remove(); 706 } 707 $('body').append('<div class="mac_pop_msg_bg"></div><div class="mac_pop_msg"><div class="pop-msg"></div></div>'); 708 $('.mac_pop_msg .pop_close').click(function(){ 709 $('.mac_pop_msg').remove(); 710 }); 711 712 $('.mac_pop_msg').width($w); 713 $('.mac_pop_msg').height($h);
714 $('.mac_pop_msg .pop-msg').html($msg); 715 $('.mac_pop_msg_bg,.mac_pop_msg').show(); 716 setTimeout(MAC.Pop.RemoveMsg,$timeout); 717 }, 718 'Show':function($w,$h,$title,$url,$callback) { 719 if($('.mac_pop_bg').length !=1) { 720 MAC.Pop.Remove(); 721 } 722 723 $('body').append('<div class="mac_pop_bg"></div><div class="mac_pop"><div class="pop_top"><h2></h2><span class="pop_close">X</span></div><div class="pop_content"></div></div>'); 724 $('.mac_pop .pop_close').click(function(){ 725 $('.mac_pop_bg,.mac_pop').remove(); 726 }); 727 728 $('.mac_pop').width($w); 729 $('.mac_pop').height($h); 730 $('.pop_content').html(''); 731 $('.pop_top').find('h2').html($title); 732 733 MAC.Ajax($url,'post','json','',function(r){ 734 $(".pop_content").html(r); 735 $callback(r); 736 },function(){ 737 $(".pop_content").html('å 载失败ï¼è¯·å·æ°...'); 738 }); 739 740 $('.mac_pop_bg,.mac_pop').show(); 741 } 742 }, 743 'Pwd':{ 744 'Check':function(o){ 745 var $that = $(o); 746 if($that.attr("data-id")){ 747 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){ 748 $that.addClass('disabled'); 749 MAC.Pop.Msg(300, 50, r.msg, 2000); 750 if (r.code == 1) { 751 location.reload(); 752 } 753 $that.removeClass('disabled'); 754 }); 755 756 } 757 } 758 }, 759 'AdsWrap':function(w,h,n){ 760 document.writeln('<img width="'+w+'" height="'+h+'" alt="'+n+'" style="background-color: #CCCCCC" />'); 761 }, 762 'Css':function($url){ 763 $("<link>").attr({ rel: "stylesheet",type: "text/css",href: $url}).appendTo("head"); 764 }, 765 'Js':function($url){ 766 $.getScript($url, function(response, status) { 767 768 }); 769 }, 770 'Desktop':function(s){ 771 location.href= maccms.path + '/index.php/ajax/desktop?name='+encodeURI(s)+'&url=' + encodeURI(location.href); 772 }, 773 'Timming':function(){ 774 if($('.mac_timming').length==0){ 775 return; 776 } 777 var infile = $('.mac_timming').attr("data-file"); 778 if(infile==undefined || infile == ''){ 779 infile = 'api.php'; 780 } 781 var t=(new Image());t.src=maccms.path + '/'+infile+'/timming/index?t='+Math.random(); 782 }, 783 'Error':function(tab,id,name){ 784 785 }, 786 'AddEm':function(obj,i){ 787 var oldtext = $(obj).val(); 788 $(obj).val( oldtext + '[em:' + i +']' ); 789 }, 790 'Remaining':function(obj,len,show){ 791 var count = len - $(obj).val().length; 792 if(count < 0){ 793 count = 0; 794 $(obj).val($(obj).val().substr(0,200)); 795 } 796 $(show).text(count); 797 }, 798 'Comment':{ 799 'Login':0, 800 'Verify':0, 801 'Init':function(){ 802 803 $('body').on('click', '.comment_face_box img', function(e){ 804 var obj = $(this).parent().parent().parent().find('.comment_content'); 805 MAC.AddEm(obj,$(this).attr('data-id')); 806 }); 807 $('body').on('click', '.comment_face_panel', function(e){ 808 // $('.comment_face_box').toggle(); 809 $(this).parent().find('.comment_face_box').toggle(); 810 }); 811 $('body').on('keyup', '.comment_content', function(e){ 812 var obj = $(this).parent().parent().parent().parent().find('.comment_remaining'); 813 MAC.Remaining($(this),200,obj) 814 }); 815 $('body').on('focus', '.comment_content', function(e){ 816 if(MAC.Comment.Login==1 && MAC.User.IsLogin!=1){ 817 MAC.User.Login(); 818 } 819 }); 820 821 $('body').on('click', '.comment_report', function(e){ 822 var $that = $(this); 823 if($(this).attr("data-id")){ 824 MAC.Ajax(maccms.path + '/index.php/comment/report.html?id='+$that.attr("data-id"),'get','json','',function(r){ 825 $that.addClass('disabled'); 826 MAC.Pop.Msg(100,20,r.msg,1000); 827 if(r.code == 1){ 828 } 829 }); 830 } 831 }); 832 833 $('body').on('click', '.comment_reply', function(e){ 834 var $that = $(this); 835 if($that.attr("data-id")){ 836 var str = $that.html(); 837 $('.comment_reply_form').remove(); 838 if (str == 'åæ¶åå¤') { 839 $that.html('åå¤'); 840 return false;
841 } 842 if (str == 'åå¤') { 843 $('.comment_reply').html('åå¤'); 844 } 845 var html = $('.comment_form').prop("outerHTML"); 846 847 var oo = $(html); 848 oo.addClass('comment_reply_form'); 849 oo.find('input[name="comment_pid"]').val( $that.attr("data-id") ); 850 851 $that.parent().after(oo); 852 $that.html('åæ¶åå¤'); 853 } 854 }); 855 856 $('body').on('click', '.comment_submit', function(e){ 857 var $that = $(this); 858 MAC.Comment.Submit($that); 859 }); 860 861 }, 862 'Show':function($page){ 863 if($(".mac_comment").length>0){ 864 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){ 865 $(".mac_comment").html(r); 866 },function(){ 867 $(".mac_comment").html('<a href="javascript:void(0)" onclick="MAC.Comment.Show('+$page+')">è¯è®ºå 载失败ï¼ç¹å»æå·æ°...</a>'); 868 }); 869 } 870 }, 871 'Reply':function($o){ 872 873 }, 874 'Submit':function($o){ 875 var form = $o.parents('form'); 876 if($(form).find(".comment_content").val() == ''){ 877 MAC.Pop.Msg(100,20,'请è¾å ¥æ¨çè¯è®ºï¼',1000); 878 return false; 879 } 880 if($('.mac_comment').attr('data-mid') == ''){ 881 MAC.Pop.Msg(100,20,'模åmidé误ï¼',1000); 882 return false; 883 } 884 if($('.mac_comment').attr('data-id') == ''){ 885 MAC.Pop.Msg(100,20,'å ³èidé误ï¼',1000); 886 return false; 887 } 888 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){ 889 MAC.Pop.Msg(100,20,r.msg,1000); 890 if(r.code == 1){ 891 MAC.Comment.Show(1); 892 } 893 else{ 894 if(MAC.Comment.Verify==1){ 895 MAC.Verify.Refresh(); 896 } 897 } 898 }); 899 } 900 } 901} 902 903$(function(){ 904 //弿¥å è½½å¾çåå§å 905 MAC.Image.Lazyload.Show(); 906 //èªå¨è·³è½¬ææºåpcç½é¡µå°å 907 MAC.Adaptive(); 908 //éªè¯ç åå§å 909 MAC.Verify.Init(); 910 //å页跳转åå§å 911 MAC.PageGo.Init(); 912 //ç¨æ·é¨ååå§å 913 MAC.User.Init(); 914 //äºç»´ç åå§å 915 MAC.Qrcode.Init(); 916 //é¡¶å踩åå§å 917 MAC.Digg.Init(); 918 //è¯ååå§å 919 MAC.Score.Init(); 920 //ææè¯ååå§å 921 MAC.Star.Init(); 922 //ç¹å»æ°é 923 MAC.Hits.Init(); 924 //çç½å 925 MAC.Shorten.Init(); 926 //åå²è®°å½åå§å 927 MAC.History.Init(); 928 //ç¨æ·è®¿é®è®°å½åå§å 929 MAC.Ulog.Init(); 930 //èæ³æç´¢åå§å 931 MAC.Suggest.Init('.mac_wd',1,''); 932 //ç½åå¯¼èªæ¥è·¯ç»è®¡ 933 MAC.Website.Referer(); 934 //宿¶ä»»å¡åå§å 935 MAC.Timming(); 936});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.