byteoss 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +109 -0
  2. package/index.js +147 -0
  3. package/oss/059e300c-9447-401a-9160-bc09b94a5bd4.css +516 -0
  4. package/oss/0fb02e11-31af-4551-a92e-b4457ad4ab0d.svg +3 -0
  5. package/oss/139daa0c-24fd-4be3-b9c6-8e51f96f6b96.svg +3 -0
  6. package/oss/1600dbb0-15a5-483d-bdbc-84971697ad90.svg +15 -0
  7. package/oss/177f61e2-3422-4c87-8110-ff1615758f91.css +153 -0
  8. package/oss/18cab5b9-4981-4274-8c5f-1978588297b0.png +0 -0
  9. package/oss/1c9abd94-340f-4c18-92a3-d28c61a16bbb.js +936 -0
  10. package/oss/258f066d-7574-491d-ba06-0f2e67db0773.js +1 -0
  11. package/oss/28225623-cdb8-4d7b-afe7-a25b9cdf4c79.svg +4 -0
  12. package/oss/2b103172-c38e-4c9c-b67c-753ede400c6b.js +1 -0
  13. package/oss/2cd0609f-d7a7-4c53-a277-79e8dec5dfc6.svg +4 -0
  14. package/oss/332d0e76-3c05-4285-af16-13e9f9bbcbed.css +431 -0
  15. package/oss/36a32028-256f-465d-be90-a65d1df04a90.js +1 -0
  16. package/oss/370921ea-2b94-4c18-9d1a-785aa58bef86.js +770 -0
  17. package/oss/3e98311d-bbf6-40d6-82b7-52b710aca34a.css +198 -0
  18. package/oss/40117c3a-1925-4250-90bf-f3ef878ee97d.svg +3 -0
  19. package/oss/469b8af5-1826-4f55-826f-56d57a896563.js +1 -0
  20. package/oss/49f08903-6594-475c-aab6-4c15b41ebc3a.svg +28 -0
  21. package/oss/4a5a9153-2bd7-443c-b628-aee3d4d55fd6.js +300 -0
  22. package/oss/4f100f7b-f956-431f-93f9-1e9e3a103574.css +197 -0
  23. package/oss/4f14fb89-2a43-49d4-89fe-c245508b451f.js +1 -0
  24. package/oss/50863606-18e8-4eaa-b738-6e98b7ff791f.css +513 -0
  25. package/oss/54a1eff8-ecd1-4604-956e-91e461d0f704.js +705 -0
  26. package/oss/554a3dbe-14c7-4349-956a-236b08a149f6.css +124 -0
  27. package/oss/5cb13f6f-423d-41e9-a081-ce544bf322f1.css +513 -0
  28. package/oss/5fd8e893-8b05-452f-b914-26965c19fd31.svg +1 -0
  29. package/oss/6016b5f9-4473-44d9-9373-c761278cc244.js +2909 -0
  30. package/oss/630ebd92-9296-4c85-a18c-954545b9716b.mp4 +0 -0
  31. package/oss/66127685-903b-4261-bc3a-887459229b79.js +90 -0
  32. package/oss/6bf3a690-882e-47b2-a3bf-07600e1067d9.svg +1 -0
  33. package/oss/6d15d999-42a6-48f8-85dc-d6dd2547d33c.svg +10 -0
  34. package/oss/72ca2a33-968f-4bc4-ba39-417aca989e2a.svg +40 -0
  35. package/oss/74a7f15c-cf9e-41e5-a649-bc7a9960b89d.js +936 -0
  36. package/oss/754fca20-6995-4b15-bf56-2202c2107f41.svg +1 -0
  37. package/oss/7dbeba7d-92dc-4f24-981f-6ee5988326a3.js +90 -0
  38. package/oss/7ec89667-7160-44da-8c5d-8cb2e5b6ed51.css +144 -0
  39. package/oss/80254c08-1b12-4f32-bec9-b56251fb7b6e.svg +14 -0
  40. package/oss/80c9635a-2d99-483a-b46a-eec29d831dbc.svg +1 -0
  41. package/oss/83982b15-f2af-4c7d-98d1-9885c934adee.css +153 -0
  42. package/oss/842d27d8-4c7d-4655-bd81-d19376b9c779.ttf +0 -0
  43. package/oss/86e16498-0990-4f5f-9c78-919d6e901b3e.png +0 -0
  44. package/oss/871ce06b-adf2-4d23-893e-c929ed0dc660.css +1079 -0
  45. package/oss/875441a7-46aa-4510-b395-59d32129b643.js +84 -0
  46. package/oss/886aaec0-d95a-44c0-a809-b611c3a385bc.svg +1 -0
  47. package/oss/8870cb0a-075f-4296-8855-cf708905377f.js +51 -0
  48. package/oss/88a1fdfb-b313-4021-8c2e-97db3dddd4af.svg +26 -0
  49. package/oss/8bd1a260-f002-42d3-a288-9ec0270490ea.svg +14 -0
  50. package/oss/8d1ac209-5712-43a7-9d86-c4a1b4d6734a.json +1 -0
  51. package/oss/917711d3-9f92-4b63-804c-a17050b72502.svg +1 -0
  52. package/oss/92122f36-32a3-44ad-81f9-96427ad7d999.svg +4 -0
  53. package/oss/945aebff-92e3-4f5a-b3e1-9d891c525d95.js +19 -0
  54. package/oss/945aebff-92e3-4f5a-b3e1-9d891c525d95_bak.js +19 -0
  55. package/oss/94b77c89-093d-48ae-b363-9f6648f91ab6.css +2435 -0
  56. package/oss/9697873a-4c40-401e-addd-3736815acf10.svg +3 -0
  57. package/oss/9bd56993-3d11-4a5c-a682-a95e527da09e.svg +1 -0
  58. package/oss/9fa42c0c-617c-44a2-9bb9-aec8994af673.svg +1 -0
  59. package/oss/a25bc2e8-28e3-4bd2-b0cf-c4f577934119.svg +3 -0
  60. package/oss/a2e59c39-138a-4d1e-84c8-bc058454133f.js +434 -0
  61. package/oss/a5535c26-8363-4625-afa2-8fbbee4dab40.css +124 -0
  62. package/oss/a6a7c636-670b-4f99-aa6b-e5cb6f029327.ico +0 -0
  63. package/oss/a6f63612-b3d1-4aba-bf5f-0cd3055a7251.svg +1 -0
  64. package/oss/a85345e2-b625-4917-8c47-d85503226015.svg +12 -0
  65. package/oss/ab70067a-ed3f-4d8c-8776-cd1a7b67097d.svg +8 -0
  66. package/oss/abe3279f-b713-403f-b0d1-7efa24502c11.css +2251 -0
  67. package/oss/b10e7a02-f948-4c79-98a1-504ef025d37a.ttf +0 -0
  68. package/oss/b43dabdf-cf3d-4e74-aaec-46b451089b4b.svg +4 -0
  69. package/oss/b4e5962d-0b64-4667-89aa-bdbfc967f9d5.svg +12 -0
  70. package/oss/b7633fb4-4845-45b1-b516-b76bc0b31692.svg +10 -0
  71. package/oss/bd64bd8e-ad36-4b30-bc3f-047f0b5472af.eot +0 -0
  72. package/oss/be75e4b2-9d84-41a1-b2ad-941100c6eb9f.svg +1 -0
  73. package/oss/bf600662-21bc-427a-a3ff-c7148bfb7a37.css +516 -0
  74. package/oss/bktjgd.js +0 -0
  75. package/oss/bktjwb.js +0 -0
  76. package/oss/c1c43d05-3fe7-4f66-92c3-a4e673de15d2.css +126 -0
  77. package/oss/c40e78e1-28a9-403f-9bb6-6a61bb759f3c.svg +9 -0
  78. package/oss/c5e67efa-03ef-4285-9eb2-979d24b97b0a.js +505 -0
  79. package/oss/ca88122c-71f0-4bdb-801b-845c3e2416c0.js +57 -0
  80. package/oss/ce7d2a57-04d3-4320-95de-a1acb29c2299.svg +1 -0
  81. package/oss/cf261a0a-f683-4e12-92c1-98c42038da76.js +301 -0
  82. package/oss/d13ba061-af1c-420f-a700-4a8c175a6d90.js +51 -0
  83. package/oss/d820804f-af30-4364-b882-9d7b23e98353.js +1 -0
  84. package/oss/dae77962-f0f3-487f-bfff-1251e44b3d98.js +313 -0
  85. package/oss/db0b6693-9a13-4a89-9c67-82a5c2208ed9.svg +1 -0
  86. package/oss/dd3a7016-cf8c-493c-ba87-c7da470f9307.svg +1 -0
  87. package/oss/dd4c56f1-700e-49b8-a40f-530ed2e06934.svg +1 -0
  88. package/oss/de85749c-9ab2-4798-a080-1dafbd2bb89a.css +393 -0
  89. package/oss/dfd0db36-8259-4d6e-a426-7c1167c7657d.svg +18 -0
  90. package/oss/e082736c-726c-4029-b3ce-6c89d83ad9ce.css +3177 -0
  91. package/oss/e0efdb0b-2cf8-41fe-b862-7560a8d957e3.js +193 -0
  92. package/oss/e1d3a1a8-c200-47de-bba9-b92aa112010b.svg +1 -0
  93. package/oss/e937b5e0-2285-474e-84e7-5c478f305280.js +775 -0
  94. package/oss/ed850ceb-a7a3-47f4-9d2e-d6fd2666a8c9.js +936 -0
  95. package/oss/ee0c80ad-d7cb-464f-aa4a-a7f439d76ae8.js +665 -0
  96. package/oss/ef62fbf5-a876-4112-8062-c97b5341f1b9.css +653 -0
  97. package/oss/f343adb3-110f-445e-80b4-abca81ff558a.js +787 -0
  98. package/oss/f4d90992-79bf-4a51-a2d7-7d556fac63d3.js +1 -0
  99. package/oss/f59f0ec0-974b-496d-a518-dfb79e0ecec0.js +51 -0
  100. package/oss/f68472c9-1d02-451a-be1f-6d5f0fa2c6fd.css +145 -0
  101. package/oss/f7b46b4d-6311-4416-95b0-e18ad577c166.css +1 -0
  102. package/oss/home.css +459 -0
  103. package/oss/mjandjlbgd.js +0 -0
  104. package/oss/mjandjlbwb.js +0 -0
  105. package/package.json +17 -0
@@ -0,0 +1,787 @@
1
+ String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2); }
2
+ String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); }
3
+ 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<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}
4
+
5
+ var MAC={
6
+ 'Url': document.URL,
7
+ 'Title': document.title,
8
+ 'UserAgent' : function(){
9
+ var ua = navigator.userAgent;//navigator.appVersion
10
+ return {
11
+ 'mobile': !!ua.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
12
+ 'ios': !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
13
+ 'android': ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1, //android终端或者uc浏览器
14
+ 'iPhone': ua.indexOf('iPhone') > -1 || ua.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
15
+ 'iPad': ua.indexOf('iPad') > -1, //是否iPad
16
+ 'trident': ua.indexOf('Trident') > -1, //IE内核
17
+ 'presto': ua.indexOf('Presto') > -1, //opera内核
18
+ 'webKit': ua.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
19
+ 'gecko': ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1, //火狐内核
20
+ 'weixin': ua.indexOf('MicroMessenger') > -1 //是否微信 ua.match(/MicroMessenger/i) == "micromessenger",
21
+ };
22
+ }(),
23
+ 'Copy': function(s){
24
+ if (window.clipboardData){ window.clipboardData.setData("Text",s); }
25
+ else{
26
+ if( $("#mac_flash_copy").get(0) ==undefined ){ $('<div id="mac_flash_copy"></div>'); } else {$('#mac_flash_copy').html(''); }
27
+ $('#mac_flash_copy').html('<embed src='+SitePath+'"images/_clipboard.swf" FlashVars="clipboard='+escape(s)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>');
28
+ }
29
+ alert("复制成功")
30
+ },
31
+ 'Home': function(o,u){
32
+ try{
33
+ o.style.behavior='url(#default#homepage)'; o.setHomePage(u);
34
+ }
35
+ catch(e){
36
+ if(window.netscape){
37
+ try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
38
+ catch(e){ alert("此操作被浏览器拒绝!请手动设置");}
39
+ var moz = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
40
+ moz.setCharPref('browser.startup.homepage',u);
41
+ }
42
+ }
43
+ },
44
+ 'Fav': function(u,s){
45
+ try{ window.external.addFavorite(u, s);}
46
+ catch (e){
47
+ try{window.sidebar.addPanel(s, u, "");}catch (e){ alert("加入收藏出错,请使用键盘Ctrl+D进行添加"); }
48
+ }
49
+ },
50
+ 'Open': function(u,w,h){
51
+ window.open(u,'macopen1','toolbars=0, scrollbars=0, location=0, statusbars=0,menubars=0,resizable=yes,width='+w+',height='+h+'');
52
+ },
53
+ 'Cookie': {
54
+ 'Set': function(name,value,days){
55
+ var exp = new Date();
56
+ exp.setTime(exp.getTime() + days*24*60*60*1000);
57
+ var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
58
+ document.cookie=name+"="+encodeURIComponent(value)+";path=/;expires="+exp.toUTCString();
59
+ },
60
+ 'Get': function(name){
61
+ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
62
+ if(arr != null){ return decodeURIComponent(arr[2]); return null; }
63
+ },
64
+ 'Del': function(name){
65
+ var exp = new Date();
66
+ exp.setTime(exp.getTime()-1);
67
+ var cval = this.Get(name);
68
+ if(cval != null){ document.cookie = name+"="+encodeURIComponent(cval)+";path=/;expires="+exp.toUTCString(); }
69
+ }
70
+ },
71
+ 'GoBack':function(){
72
+ var ldghost=document.domain;
73
+ if(document.referrer.indexOf(ldghost)>0) {
74
+ history.back();
75
+ }
76
+ else{
77
+ window.location ="http://"+ldghost;
78
+ }
79
+ },
80
+ 'Adaptive':function(){
81
+ if(maccms.mob_status=='1'&& maccms.url != maccms.wapurl){
82
+ if(document.domain ==maccms.url && MAC.UserAgent.mobile){
83
+ location.href = location.href.replace(maccms.url,maccms.wapurl);
84
+ }
85
+ else if(document.domain ==maccms.wapurl && !MAC.UserAgent.mobile){
86
+ location.href = location.href.replace(maccms.wapurl,maccms.url);
87
+ }
88
+ }
89
+ },
90
+ 'CheckBox':{
91
+ 'All':function(n){
92
+ $("input[name='"+n+"']").each(function() {
93
+ this.checked = true;
94
+ });
95
+ },
96
+ 'Other':function(n){
97
+ $("input[name='"+n+"']").each(function() {
98
+ this.checked = !this.checked;
99
+ });
100
+ },
101
+ 'Count':function(n){
102
+ var res=0;
103
+ $("input[name='"+n+"']").each(function() {
104
+ if(this.checked){ res++; }
105
+ });
106
+ return res;
107
+ },
108
+ 'Ids':function(n){
109
+ var res=[];
110
+ $("input[name='"+n+"']").each(function() {
111
+ if(this.checked){ res.push(this.value); }
112
+ });
113
+ return res.join(",");
114
+ }
115
+ },
116
+ 'Qrcode':function(){
117
+ $('.mac_qrcode').attr('src','//api.maccms.com/qrcode/?w=150&h=150&url=' + MAC.Url);
118
+ },
119
+ 'Image':{
120
+ 'Lazyload':{
121
+ 'Show': function(){
122
+ try { $("img.lazy").lazyload(); }catch(e){};
123
+ },
124
+ 'Box': function($id){
125
+ $("img.lazy").lazyload({
126
+ container: $("#"+$id)
127
+ });
128
+ }
129
+ }
130
+ },
131
+ 'Verify': {
132
+ 'Init': function(){
133
+ MAC.Verify.Focus();
134
+ MAC.Verify.Click();
135
+ },
136
+ 'Focus': function(){//验证码框焦点
137
+ $('body').on("focus", ".mac_verify", function(){
138
+ $(this).removeClass('mac_verify').after(MAC.Verify.Show());
139
+ $(this).unbind();
140
+ });
141
+ },
142
+ 'Click': function(){//点击刷新
143
+ $('body').on('click', 'img.mac_verify_img', function(){
144
+ $(this).attr('src', maccms.path +'/verify/index.html?');
145
+ });
146
+ },
147
+ 'Refresh':function(){
148
+ $('.mac_verify_img').attr('src', maccms.path +'/verify/index.html?');
149
+ },
150
+ 'Show':function(){
151
+ return '<img class="mac_verify_img" src="'+ maccms.path +'/verify/index.html?" title="看不清楚? 换一张!">';
152
+ }
153
+ },
154
+ 'PageGo':{
155
+ 'Init':function() {
156
+ $('.mac_page_go').click(function () {
157
+ var that =$(this);
158
+ var url = that.attr('data-url');
159
+ var total = that.attr('data-total');
160
+ var sp = that.attr('data-sp');
161
+ var page= $('#page').val();
162
+
163
+ if(page>0&&(page<=total)){
164
+ url=url.replace(sp + 'PAGELINK',page).replace('PAGELINK',page);
165
+ location.href=url;
166
+ }
167
+ return false;
168
+ });
169
+ }
170
+ },
171
+ 'Hits': {
172
+ 'Init':function() {
173
+ if($('.mac_hits').length==0){
174
+ return;
175
+ }
176
+ var $that = $(".mac_hits");
177
+ $.ajax({
178
+ type: 'get',
179
+ url: maccms.path + '/ajax/hits?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type=update',
180
+ timeout: 5000,
181
+ dataType: 'json',
182
+ error: function () {
183
+
184
+ },
185
+ success: function (json) {
186
+ if (json.code == 1) {
187
+ $(".mac_hits").each(function(i){
188
+ $type = $(".mac_hits").eq(i).attr('data-type');
189
+ if($type != 'insert'){
190
+ $('.'+$type).html(eval('(json.data.' + $type + ')'));
191
+ }
192
+ });
193
+ }
194
+ }
195
+ });
196
+
197
+ }
198
+ },
199
+ 'Score': {
200
+ 'Init':function(){
201
+ if($('.mac_score').length==0){
202
+ return;
203
+ }
204
+ $('body').on('click', '.score_btn', function(e){
205
+ MAC.Score.Submit();
206
+ });
207
+
208
+ $.ajax({
209
+ type: 'post',
210
+ url: maccms.path+'/ajax/score?mid='+ $('.mac_score').attr('data-mid') +'&id=' +$('.mac_score').attr('data-id'),
211
+ timeout: 5000,
212
+ error: function(){
213
+ $(".mac_score").html('评分加载失败');
214
+ },
215
+ success: function($r){
216
+ MAC.Score.View($r);
217
+ }
218
+ });
219
+ },
220
+ 'Submit':function(){
221
+ var $s = $('.mac_score').find("input[name='score']").val();
222
+ $.ajax({
223
+ type: 'post',
224
+ url: maccms.path+'/ajax/score?mid='+$('.mac_score').attr('data-mid')+'&id='+$('.mac_score').attr('data-id') + '&score='+ $s,
225
+ timeout: 5000,
226
+ error: function(){
227
+
228
+ },
229
+ success: function($r){
230
+ alert($r.msg)
231
+ if($r.code==1){
232
+ MAC.Score.View($r);
233
+ }
234
+ }
235
+ });
236
+ },
237
+ 'View':function($r){
238
+ $(".rating"+Math.floor($r.data.score)).attr('checked',true);
239
+ $(".score_num").text( $r.data.score_num );
240
+ $(".score_all").text( $r.data.score_all );
241
+ $(".score_pjf").text( $r.data.score );
242
+ }
243
+ },
244
+ 'Star': {
245
+ 'Init':function(){
246
+ if($('.mac_star').length==0){
247
+ return;
248
+ }
249
+
250
+ $('.mac_star').raty({
251
+ starType: 'i',
252
+ number: 5,
253
+ numberMax : 5,
254
+ half: true,
255
+ score : function(){
256
+ return $(this).attr('data-score');
257
+ },
258
+ click: function(score, evt) {
259
+ $.ajax({
260
+ type: 'get',
261
+ url: maccms.path+'/ajax/score?mid='+$('.mac_star').attr('data-mid')+'&id='+$('.mac_star').attr('data-id')+'&score='+(score*2),
262
+ timeout: 5000,
263
+ dataType:'json',
264
+ error: function(){
265
+ $('.star_box').attr('title', '网络异常!');
266
+ },
267
+ success: function(json){
268
+ if(json.status == 1){
269
+ $('.star_tips').html(json.data.score);
270
+ }else{
271
+ $('.star_box').attr('title', json.msg);
272
+ }
273
+ }
274
+ });
275
+ }
276
+ });
277
+ }
278
+ },
279
+ 'Digg': {
280
+ 'Init':function(){
281
+ $('body').on('click', '.digg_link', function(e){
282
+ var $that = $(this);
283
+ if($that.attr("data-id")){
284
+ $.ajax({
285
+ url: maccms.path + '/ajax/digg.html?mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),
286
+ cache: false,
287
+ dataType: 'json',
288
+ success: function($r){
289
+ $that.addClass('disabled');
290
+ if($r.code == 1){
291
+ if($that.attr("data-type")=='up'){
292
+ $that.find('.digg_num').html($r.data.up);
293
+ }
294
+ else{
295
+ $that.find('.digg_num').html($r.data.down);
296
+ }
297
+ }
298
+ else{
299
+ alert($r.msg);
300
+ }
301
+ }
302
+ });
303
+ }
304
+ });
305
+ }
306
+ },
307
+ 'Gbook':{
308
+ 'Login':0,
309
+ 'Verify':0,
310
+ 'Init':function(){
311
+ $('body').on('keyup', '.gbook_content', function(e){
312
+ MAC.Remaining($(this),200,'.gbook_remaining')
313
+ });
314
+ $('body').on('focus', '.gbook_content', function(e){
315
+ if(MAC.Gbook.Login==1 && MAC.User.IsLogin!=1){
316
+ MAC.User.Login();
317
+ }
318
+ });
319
+ $('body').on('click', '.gbook_submit', function(e){
320
+ MAC.Gbook.Submit();
321
+ });
322
+ },
323
+ 'Show':function($page){
324
+ $.ajax({
325
+ type: 'post',
326
+ url: maccms.path+'/gbook/index?page='+$page,
327
+ timeout: 3000,
328
+ error: function(){
329
+ $(".mac_gbook_box").html('留言加载失败,请刷新...');
330
+ },
331
+ success:function($html){
332
+ $(".mac_gbook_box").html($html);
333
+ }
334
+ });
335
+ },
336
+ 'Submit':function(){
337
+ if($(".gbook_content").val() == ''){
338
+ alert("请输入留言内容");
339
+ return false;
340
+ }
341
+ $.ajax({
342
+ type: 'post',
343
+ url: maccms.path + '/gbook/saveData',
344
+ data: $('.gbook_form').serialize(),
345
+ success:function($r){
346
+ alert($r.msg);
347
+ if($r.code == 1){
348
+ location.reload();
349
+ }
350
+ else{
351
+ if(MAC.Gbook.Verify==1){
352
+ MAC.Verify.Refresh();
353
+ }
354
+ }
355
+ }
356
+ });
357
+ },
358
+ 'Report':function(name){
359
+ MAC.Pop.Show('#modal-seport',maccms.path+'/gbook/report?name=' + encodeURIComponent(name),function($r){
360
+ $('body').on('click', '#gbook_submit', function(e){
361
+ MAC.Gbook.Submit();
362
+ });
363
+ });
364
+ }
365
+ },
366
+ 'Search':{
367
+ 'Init':function(){
368
+ $('.mac_search').click(function(){
369
+ var that=$(this);
370
+ var url = that.attr('data-href') ? that.attr('data-href') : maccms.path + '/vod/search.html';
371
+ location.href = url + '?wd='+ encodeURIComponent($("#wd").val());
372
+ });
373
+ },
374
+ 'Submit':function(){
375
+
376
+ return false;
377
+ }
378
+ },
379
+ 'Suggest':{
380
+ 'Init':function($obj,$mid,$jumpurl){
381
+ try {
382
+ $($obj).autocomplete(maccms.path + '/ajax/suggest?mid=' + $mid, {
383
+ inputClass: "mac_input",
384
+ resultsClass: "mac_results",
385
+ loadingClass: "mac_loading",
386
+ width: 175, scrollHeight: 300, minChars: 1, matchSubset: 1,
387
+ cacheLength: 10, multiple: false, matchContains: true, autoFill: false,
388
+ dataType: "json",
389
+ parse: function ($r) {
390
+ if ($r.code == 1) {
391
+ var parsed = [];
392
+ $.each($r['list'], function (index, row) {
393
+ row.url = $r.url;
394
+ parsed[index] = {
395
+ data: row
396
+ };
397
+ });
398
+ return parsed;
399
+ } else {
400
+ return {data: ''};
401
+ }
402
+ },
403
+ formatItem: function (row, i, max) {
404
+ return row.name;
405
+ },
406
+ formatResult: function (row, i, max) {
407
+ return row.text;
408
+ }
409
+ }).result(function (event, data, formatted) {
410
+ $($obj).val(data.name);
411
+ location.href = data.url.replace('mac_wd', encodeURIComponent(data.name));
412
+ });
413
+ }
414
+ catch(e){}
415
+ }
416
+ },
417
+ 'Ulog':{
418
+ 'Init':function(){
419
+ MAC.Ulog.Set();
420
+ MAC.Ulog.Click();
421
+
422
+ },
423
+ 'Get':function(){
424
+ $.ajax({
425
+ url: maccms.path+'/user/ajax_ulog/?ac=list',
426
+ type:'GET',
427
+ cache: false,
428
+ dataType: 'json',
429
+ success: function($r){
430
+ if($r.code == 1){
431
+ $.each($r['list'],function(index,row){
432
+ alert(row.ulog_id);
433
+ });
434
+ }else{
435
+
436
+ }
437
+ }
438
+ });
439
+ },
440
+ 'Set':function(){
441
+ if($(".mac_ulog_set").attr('data-mid')){
442
+ var $that = $(".mac_ulog_set");
443
+ $.get(maccms.path+'/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"));
444
+ }
445
+ },
446
+ 'Click':function(){
447
+ $('body').on('click', 'a.mac_ulog', function(e){
448
+ //是否需要验证登录
449
+ if(MAC.User.IsLogin == 0){
450
+ MAC.User.Login();
451
+ return;
452
+ }
453
+
454
+ var $that = $(this);
455
+ if($that.attr("data-id")){
456
+ $.ajax({
457
+ url: maccms.path+'/user/ajax_ulog/?ac=set&mid='+$that.attr("data-mid")+'&id='+$that.attr("data-id")+'&type='+$that.attr("data-type"),
458
+ cache: false,
459
+ dataType: 'json',
460
+ success: function($r){
461
+ alert($r.msg);
462
+ if($r.code == 1){
463
+ $that.addClass('disabled');
464
+ }else{
465
+ $that.attr('title', $r.msg);
466
+ }
467
+ }
468
+ });
469
+ }
470
+ });
471
+ }
472
+ },
473
+ 'User':{
474
+ 'BoxShow':0,
475
+ 'IsLogin':0,
476
+ 'UserId':'',
477
+ 'UserName':'',
478
+ 'GroupId':'',
479
+ 'GroupName':'',
480
+ 'Portrait':'',
481
+ 'Init':function(){
482
+ if($('.mac_user').length >0){
483
+ $('body').on('click', '.mac_user', function(e){
484
+ MAC.User.Login();
485
+ });
486
+ }
487
+
488
+ if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){
489
+ var url = maccms.path + '/user';
490
+ MAC.User.UserId = MAC.Cookie.Get('user_id');
491
+ MAC.User.UserName = MAC.Cookie.Get('user_name');
492
+ MAC.User.GroupId = MAC.Cookie.Get('group_id');
493
+ MAC.User.GroupName = MAC.Cookie.Get('group_name');
494
+ MAC.User.Portrait = MAC.Cookie.Get('user_portrait');
495
+ MAC.User.IsLogin = 1;
496
+
497
+ $('.mac_user').removeClass('mac_user').attr('href',url);
498
+
499
+ $('.user_name').show().find('.name').text(MAC.User.UserName);
500
+
501
+ $('.user_url').show().attr('href',url);
502
+
503
+ $('.user_img').show().attr('src',MAC.User.Portrait);
504
+ }
505
+ else{
506
+
507
+ }
508
+
509
+ },
510
+ 'CheckLogin':function(){
511
+ if(MAC.User.IsLogin == 0){
512
+ MAC.User.Login();
513
+ }
514
+ },
515
+ 'Login':function(){
516
+ var ac='ajax_login';
517
+ if(MAC.Cookie.Get('user_id') !=undefined && MAC.Cookie.Get('user_id')!=''){
518
+ ac= 'ajax_info';
519
+ }
520
+ MAC.Pop.Show('#modal-login',maccms.path+'/user/'+ac,function($r){
521
+ $('body').on('click', '#login_form_submit', function(e){
522
+ $.ajax({
523
+ type: 'POST',
524
+ url: maccms.path + '/user/login',
525
+ data: $('.mac_login_form').serialize(),
526
+ success:function($r){
527
+ alert($r.msg)
528
+ if($r.code == 1){
529
+ location.reload();
530
+ }
531
+ }
532
+ });
533
+ });
534
+ });
535
+ },
536
+ 'Logout':function(){
537
+ $.ajax({
538
+ type: 'post',
539
+ url: maccms.path + '/user/logout',
540
+ success:function($r){
541
+ alert($r.msg)
542
+ if($r.code == 1){
543
+ location.reload();
544
+ }
545
+ }
546
+ });
547
+ },
548
+ 'PopedomCallBack':function(trysee,h) {
549
+ window.setTimeout(function(){
550
+ $(window.frames["player_if"].document).find(".MacPlayer").html(h);
551
+ },1000*60*trysee);
552
+ },
553
+ 'BuyPopedom':function(o){
554
+ var $that = $(o);
555
+ if($that.attr("data-id")){
556
+ if (confirm('您确认购买此条数据播放权限吗?')) {
557
+ $.ajax({
558
+ url: maccms.path + '/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"),
559
+ cache: false,
560
+ dataType: 'json',
561
+ success: function ($r) {
562
+ $that.addClass('disabled');
563
+ alert($r.msg)
564
+ if ($r.code == 1) {
565
+ top.location.reload();
566
+ }
567
+ },
568
+ complete: function () {
569
+ $that.removeClass('disabled');
570
+ }
571
+ });
572
+ }
573
+ }
574
+ }
575
+ },
576
+ 'Pop':{
577
+ 'Show':function($modalid,$url,$callback) {
578
+ $.ajax({
579
+ type: 'post',
580
+ url: $url,
581
+ timeout: 3000,
582
+ error: function(){
583
+ $('body').append(alert("加载失败,请刷新"));
584
+ },
585
+ success:function($r){
586
+ $('body').append($r);
587
+ $($modalid).modal('show');
588
+ $('.MacPlayer').hide();
589
+ $($modalid).on('hide.bs.modal', function () {
590
+ $('.MacPlayer').show();
591
+ })
592
+ $callback($r);
593
+ }
594
+ });
595
+ }
596
+ },
597
+ 'AdsWrap':function(w,h,n){
598
+ document.writeln('<img width="'+w+'" height="'+h+'" alt="'+n+'" style="background-color: #CCCCCC" />');
599
+ },
600
+ 'Css':function($url){
601
+ $("<link>").attr({ rel: "stylesheet",type: "text/css",href: $url}).appendTo("head");
602
+ },
603
+ 'Js':function($url){
604
+ $.getScript($url, function(response, status) {
605
+
606
+ });
607
+ },
608
+ 'Desktop':function(s){
609
+ location.href= maccms.path + '/ajax/desktop?name='+encodeURI(s)+'&url=' + encodeURI(location.href);
610
+ },
611
+ 'Timming':function(){
612
+
613
+ },
614
+ 'Error':function(tab,id,name){
615
+
616
+ },
617
+ 'AddEm':function(obj,i){
618
+ var oldtext = $(obj).val();
619
+ $(obj).val( oldtext + '[em:' + i +']' );
620
+ },
621
+ 'Remaining':function(obj,len,show){
622
+ var count = len - $(obj).val().length;
623
+ if(count < 0){
624
+ count = 0;
625
+ $(obj).val($(obj).val().substr(0,200));
626
+ }
627
+ $(show).text(count);
628
+ },
629
+ 'Comment':{
630
+ 'Login':0,
631
+ 'Verify':0,
632
+ 'Init':function(){
633
+
634
+ $('body').on('click', '.comment_face_box img', function(e){
635
+ var obj = $(this).parent().parent().parent().find('.comment_content');
636
+ MAC.AddEm(obj,$(this).attr('data-id'));
637
+ });
638
+ $('body').on('click', '.comment_face_panel', function(e){
639
+ // $('.comment_face_box').toggle();
640
+ $(this).parent().find('.comment_face_box').toggle();
641
+ });
642
+ $('body').on('keyup', '.comment_content', function(e){
643
+ var obj = $(this).parent().parent().parent().parent().find('.comment_remaining');
644
+ MAC.Remaining($(this),200,obj)
645
+ });
646
+ $('body').on('focus', '.comment_content', function(e){
647
+ if(MAC.Comment.Login==1 && MAC.User.IsLogin!=1){
648
+ MAC.User.Login();
649
+ }
650
+ });
651
+
652
+ $('body').on('click', '.comment_report', function(e){
653
+ var $that = $(this);
654
+ if($(this).attr("data-id")){
655
+ $.ajax({
656
+ url: maccms.path + '/comment/report.html?id='+$that.attr("data-id"),
657
+ cache: false,
658
+ dataType: 'json',
659
+ success: function($r){
660
+ $that.addClass('disabled');
661
+ alert($r.msg)
662
+ if($r.code == 1){
663
+ }
664
+ }
665
+ });
666
+ }
667
+ });
668
+
669
+ $('body').on('click', '.comment_reply', function(e){
670
+ var $that = $(this);
671
+ if($that.attr("data-id")){
672
+ var str = $that.html();
673
+ $('.comment_reply_form').remove();
674
+ if (str == '取消回复') {
675
+ $that.html('回复');
676
+ return false;
677
+ }
678
+ if (str == '回复') {
679
+ $('.comment_reply').html('回复');
680
+ }
681
+ var html = $('.comment_form').prop("outerHTML");
682
+
683
+ var oo = $(html);
684
+ oo.addClass('comment_reply_form');
685
+ oo.find('input[name="comment_pid"]').val( $that.attr("data-id") );
686
+
687
+ $that.parent().after(oo);
688
+ $that.html('取消回复');
689
+ }
690
+ });
691
+
692
+ $('body').on('click', '.comment_submit', function(e){
693
+ var $that = $(this);
694
+ MAC.Comment.Submit($that);
695
+ });
696
+
697
+ },
698
+ 'Show':function($page){
699
+ if($(".mac_comment").length>0){
700
+ $.ajax({
701
+ type: 'get',
702
+ url: maccms.path + '/comment/ajax.html?rid='+$('.mac_comment').attr('data-id')+'&mid='+ $('.mac_comment').attr('data-mid') +'&page='+$page,
703
+ timeout: 5000,
704
+ error: function(){
705
+ $(".mac_comment").html('评论加载失败,请刷新...');
706
+ },
707
+ success:function($r){
708
+ $(".mac_comment").html($r);
709
+ }
710
+ });
711
+ }
712
+ },
713
+ 'Reply':function($o){
714
+
715
+ },
716
+ 'Submit':function($o){
717
+ var form = $o.parents('form');
718
+ if($(form).find(".comment_content").val() == ''){
719
+ alert("请输入您的评论!")
720
+ return false;
721
+ }
722
+ if($('.mac_comment').attr('data-mid') == ''){
723
+ alert("模块mid错误!")
724
+ return false;
725
+ }
726
+ if($('.mac_comment').attr('data-id') == ''){
727
+ alert("关联id错误!")
728
+ return false;
729
+ }
730
+
731
+ $.ajax({
732
+ type: 'post',
733
+ url: maccms.path + '/comment/saveData',
734
+ data: $(form).serialize() + '&comment_mid='+ $('.mac_comment').attr('data-mid') + '&comment_rid=' + $('.mac_comment').attr('data-id'),
735
+ success:function($r){
736
+ alert($r.msg)
737
+ if($r.code == 1){
738
+ MAC.Comment.Show(1);
739
+ }
740
+ else{
741
+ if(MAC.Comment.Verify==1){
742
+ MAC.Verify.Refresh();
743
+ }
744
+ }
745
+ }
746
+ });
747
+ }
748
+ }
749
+ }
750
+
751
+ $(function(){
752
+ //自动跳转手机和pc网页地址
753
+ MAC.Adaptive();
754
+ //验证码初始化
755
+ MAC.Verify.Init();
756
+ //分页跳转初始化
757
+ MAC.PageGo.Init();
758
+ //用户部分初始化
759
+ MAC.User.Init();
760
+ //顶和踩初始化
761
+ MAC.Digg.Init();
762
+ //评分初始化
763
+ MAC.Score.Init();
764
+ //星星评分初始化
765
+ MAC.Star.Init();
766
+ //点击数量
767
+ MAC.Hits.Init();
768
+ //历史记录初始化
769
+ MAC.Ulog.Init();
770
+ //联想搜索初始化
771
+ MAC.Suggest.Init('.mac_wd',1,'');
772
+ //定时任务初始化
773
+ MAC.Timming();
774
+ });
775
+ //新闻列表文章偏移效果
776
+ jQuery(document).ready(function() {
777
+ jQuery('.pianyi a').hover(function() {
778
+ jQuery(this).animate({
779
+ paddingLeft: "10px"//鼠标悬停距离左边间距
780
+ }, 300);
781
+ }, function() {
782
+ jQuery(this).animate({
783
+ paddingLeft: "0"//鼠标离开后设置距离左边多远
784
+
785
+ }, 300);
786
+ });
787
+ });