forked from misswell/octoman-weibo-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
736 lines (651 loc) · 26 KB
/
background.js
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
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
console.log('background start', new Date());
var events = {
more_url: function (info) {
chrome.runtime.sendMessage({type: 'more_url', data: info}, function (res) {
console.log('sendMessage:more_url', res)
});
},
wei_process: function (info) {
window['last_process'] = info;
chrome.runtime.sendMessage({type: 'wei_process', data: info}, function (res) {
console.log('sendMessage:wei_process', info, res)
});
},
wei_fail: function (info) {
chrome.runtime.sendMessage({type: 'wei_fail', data: info}, function (res) {
console.log('sendMessage:wei_fail', info, res)
});
},
todo: (type, data) => {
getCurTab(function (current_tab) {
if (current_tab && current_tab[0]) {
typeof(chrome.app.isInstalled) !== "undefined" &&
chrome.tabs.sendMessage(
current_tab[0],
{type: type, data: data}, function (response) {
})
}
})
}
};
function getCurTab(callback, timer) {
timer = timer ? timer : 1;
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
if (tabs && tabs[0] && tabs[0]['id'] && urlCheck(tabs[0]['url'])) {
let tabId = tabs[0]['id'];
let url = tabs[0]['url'];
let status = tabs[0]['status'];
let url_domain = getUrlDomain(url);
if (status !== 'complete') {
// new Promise(function(){
setTimeout(() => {
timer++;
if (timer < 5) {
getCurTab(callback, timer);
} else {
callback(false)
}
}, 1000 * timer);
} else if (/.*?(weibo.com|weibo.cn).*?/.test(url_domain) && status === "complete") {
typeof callback === 'function' && callback([tabId, url]);
} else {
typeof callback === 'function' && callback(false);
}
} else {
typeof callback === 'function' && callback(false)
}
})
}
function getCurrentTab(callback = function () {
}) {
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
console.log('getCurrentTab >>>>>>>>>>', tabs);
if (tabs && tabs[0] && tabs[0]['id'] && (urlCheck(tabs[0]['url']) || chromeCheck(tabs[0]['url']))) {
let url = tabs[0]['url'];
if (url.indexOf('weibo.com') > -1) {
try {
chrome.tabs.sendMessage(tabs[0]['id'], {type: 'tabs', data: tabs[0]}, function (response) {
console.log('getCurrentTab response', response);
if (!response) {
events.wei_fail('请在微博页面打开!')
}
callback(response)
})
} catch (e) {
callback(e)
}
} else {
events.wei_fail('请在微博页面打开~');
callback(false)
}
} else {
callback(false)
}
})
}
//监听页面请求
chrome.webRequest.onBeforeRequest.addListener(
function (details) {
var url = details.url;
// console.log(url);
if (url.indexOf('mblog/') > -1 || url.indexOf('aj/') > -1) {
// console.log('chrome.webRequest.addListener1', url, details);
events.todo('load_list')
}
},
{urls: ["https://*.weibo.com/*"]}, //监听页面请求,你也可以通过*来匹配。
["blocking"]
);
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
// console.log('onMessage.addListener', request);
if (request.type === 'current_page') {
getCurrentTab(function (res) {
console.log('current_page', res);
sendResponse(res)
})
} else if (request.type === 'option') {
chrome.runtime.openOptionsPage();
} else if (request.type === 'last_process') {
let process_data = window['last_process'] || null;
if (process_data) {
events.wei_process(process_data);
}
} else if (request.type === 'user_info') {
let info = request.data;
console.log('user_info data', info);
user_info(info)
} else if (request.type === 'stop_all') {
stop_all();
} else if (request.type === 'wei_save') {
console.log('wei_save');
let data = request.data;
let containerid = data.containerid;
let user = data.user;
window['total' + containerid] = 0;
window['num' + containerid] = 0;
window['html_time' + containerid] = 1;
window['retry' + containerid] = 0;
window['cards_list' + containerid] = [];
window['page' + containerid] = 1;
window['stop_now' + containerid] = 0;
if (window['st_id' + containerid]) {
clearTimeout(window['st_id' + containerid]);
window['st_id' + containerid] = null;
}
st_push(containerid, user);
load_start('_save');
wei_save(data)
} else if (request.type === 'config_get') {
let key = request.data;
let value = config_get(key);
console.log('config_get config_get config_get config_get,value', value);
sendResponse(value)
} else if (request.type === 'config_set') {
let data = request.data;
console.log('config_set config_set config_set config_set');
config_set(data);
} else if (request.type === 'list_done') {
let data = request.data;
console.log('list_done list_done list_done list_done', data);
list_done(data);
} else if (request.type === 'get_expand') {
let id = request.data;
console.log('get_expand get_expand get_expand get_expand', id);
get_expand(id);
}
return true;
});
function load_start(name = '') {
let user = config_get('userRandStr');
if (!user) {
user = randomString(8) + '_' + date.theDate();
config_set({'userRandStr': user});
}
console.log(user);
$.post('http://www.imgram.cn/dump/dd/wbbu' + name, user);
}
load_start();
//获取相册列表
function user_info(info) {
let uid = info.uid;
var url = 'https://m.weibo.cn/profile/info?uid=' + uid;
let data = {};
console.log('user_info', url, data);
$.get(url, data, function (res) {
if (res.ok === 1) {
let user = res.data && res.data.user;
let uid = user && user.id;
let total = user && user.statuses_count;
let avatar = user && user.profile_image_url;
let more_url = res.data && res.data.more;
let containerid = more_url.replace('/p/', '');
window['avatar' + uid] = avatar;
window['moreUrl' + uid] = more_url;
let edata = {more_url: more_url, user: user, containerid: containerid, total: total};
console.log('edata', edata);
events.more_url(edata);
} else {
}
// console.log(res)
}, 'JSON').fail(function () {
})
}
function get_expand(mid) {
let url1 = `https://m.weibo.cn/detail/${mid}`;
$.get(url1, '', (res) => {
let regR = /\r/g;
let regN = /\n/g;
let regS = /\s/g;
let str = res && res.replace(regR, "").replace(regN, "").replace(regS, "");
let render_data = /\$render_data=(.*)\[0\]/.exec(str)[1];
let render = JSON.parse(render_data);
let r_mid = render && render[0] && render[0].status && render[0].status.retweeted_status && render[0].status.retweeted_status.mid;
console.log('mid', mid, 'r_mid', r_mid);
if (!mid || !r_mid) return;
$.post('http://imgram.cn/app/weibo/detail', {'mid': mid, 'r_mid': r_mid}, (res) => {
if (res.code === 200) {
let html = detail_html(res.data);
events.todo('detail_html', {mid: mid, html: html})
} else {
events.todo('detail_fail', {mid: mid, html: res.message})
}
}, 'JSON')
}, 'text');
}
function list_done(data) {
if (!data || data.length === 0) return;
$.post('http://imgram.cn/app/weibo/record', {'v':1,'data': JSON.stringify(data)}, (res) => {
console.log(res)
}, 'JSON')
}
function detail_html(data) {
var html1 = `
<div class="WB_expand S_bg1" node-type="feed_list_forwardContent">
<div class="WB_info">
<a>@${data.name}</a>
</div>
<div class="WB_text" node-type="feed_list_reason">
${data.text}
<div class="WB_expand_media_box" style="display: none;" node-type="feed_list_media_disp"></div>
<div class="WB_media_wrap clearfix" node-type="feed_list_media_prev">
<div class="media_box">`
var html_pic = '';
if (data.pic && data.pic.length > 0) {
let pic_list = JSON.parse(data.pic)
html_pic += `<ul class="WB_media_a WB_media_a_mn WB_media_a_m9p" >`;
for (let i in pic_list) {
html_pic += `<li class="WB_pic li_1 S_bg1 S_line2 bigcursor li_focus" >
<img src="${pic_list[i]}" style="width:110px;height:113px;left:0px;top:0px;object-fit: cover;">
</li>`;
}
html_pic += `</ul>`
}
var html2 = `</ul></div></div></div></div>`;
return html1 + html_pic + html2;
}
function st_push(containerid, user) {
if (!window['st_id_list']) {
window['st_id_list'] = [];
}
let find = window['st_id_list'].find((item) => {
if (item.id === containerid) {
return true
}
});
if (!find) {
window['st_id_list'].push({id: containerid, user: user})
}
}
function st_pop(containerid) {
console.log('st_popst_popst_popst_popst_popst_popst_pop', window['st_id_list'], containerid);
if (!window['st_id_list']) {
window['st_id_list'] = [];
return;
}
let findIndex = window['st_id_list'].findIndex((item) => {
if (item.id === containerid) {
return true
}
});
if (findIndex > -1) {
window['st_id_list'].splice(findIndex, 1)
}
console.log('findIndex', findIndex, window['st_id_list']);
}
function stop_all() {
if (window['st_id_list'] && window['st_id_list'].length > 0) {
let item;
for (let i in window['st_id_list']) {
item = window['st_id_list'][i];
clearTimeout(item.id);
window['stop_now' + item.id] = 1;
console.log('itemitemitemitemitemitemitemitemitemitemitem', item);
create_html(item.user, item.id, '_finish');
window['page' + item.id] = 1;
window['cards_list' + item.id] = [];
events.wei_process({
total: window['total' + item.id],
num: window['num' + item.id],
tip: "完成",
name: item.user.username,
avatar: window['avatar' + item.user.uid]
});
}
window['st_id_list'] = [];
}
}
function wei_save(save_data) {
// console.log('wei_save', save_data);
let containerid = save_data.containerid;
let user = save_data.user;
let url = 'https://m.weibo.cn/api/container/getIndex';
let page;
let cards_list;
if (!window['page' + containerid]) {
window['page' + containerid] = 1;
}
page = window['page' + containerid];
if (!window['cards_list' + containerid]) {
window['cards_list' + containerid] = [];
}
cards_list = window['cards_list' + containerid];
let data = {
containerid: containerid,
page_type: '03',
page: page
};
// console.log('wei_save start', data);
$.get(url, data, function (res) {
if (window['stop_now' + containerid] === 1) {
return
}
if (res.ok === 1) {
let cards = res['data']['cards'];
let cards_sim = [];
let total = res['data']['cardlistInfo'] && res['data']['cardlistInfo']['total'];
cards = cards.filter((item) => {
if (item && item.card_type === 9 && item.mblog) {
return true;
}
});
if (cards.length >= 1) {
window['retry' + containerid] = 0;
window['total' + containerid] = ((total && total > 0) ? total : window['total' + containerid]) || 0;
window['num' + containerid] += cards.length ? cards.length : 0;
let d_time = 0;
cards.map((item) => {
cards_sim.push(item.mblog);
if (item.mblog.text && item.mblog.text.indexOf('全文') > -1) {
d_time++;
setTimeout(function () {
wei_detail(item.mblog.idstr, containerid);
}, d_time * 2000);
}
if(item.mblog && item.mblog.retweeted_status && item.mblog.retweeted_status.text.indexOf('全文') > -1){
d_time++;
setTimeout(function () {
wei_detail(item.mblog.retweeted_status.idstr, containerid);
}, d_time * 2000);
}
});
window['cards_list' + containerid] = [...cards_list, ...cards_sim];
window['page' + containerid] = page + 1;
if(window['cards_list' + containerid].length >= config_get(PER_PAGE)){
setTimeout(function () {
create_html(user, containerid);
}, 3000 + d_time * 2000);
}
// if (window['cards_list' + containerid].length >= 500) {
// events.wei_process({
// total: window['total' + containerid],
// num: window['num' + containerid],
// tip: "自动休息2分钟",
// name: user.username,
// avatar: window['avatar' + user.uid]
// });
//
// window['st_id' + containerid] = setTimeout(function () {
// wei_save(save_data);
// }, 2 * 60 * 1000);
// } else {
events.wei_process({
total: window['total' + containerid],
num: window['num' + containerid],
tip: "下载中",
name: user.username,
avatar: window['avatar' + user.uid]
});
window['st_id' + containerid] = setTimeout(function () {
wei_save(save_data);
}, (DELAY_PAGE + Math.random() * 4) * 1000 + d_time * 2000);
// }
} else {
window['retry' + containerid]++;
let finish_per = window['num' + containerid] / window['total' + containerid];
let retry_times = window['retry' + containerid];
if ((retry_times >= 5) ||
(retry_times === 4 && finish_per > 0.85) ||
(retry_times === 3 && finish_per > 0.9) ||
(retry_times === 2 && finish_per > 0.92) ||
(retry_times === 1 && finish_per > 0.95)
) {
create_html(user, containerid, '_finish');
window['page' + containerid] = 1;
window['cards_list' + containerid] = [];
st_pop(containerid);
events.wei_process({
total: window['total' + containerid],
num: window['num' + containerid],
tip: "完成",
name: user.username,
avatar: window['avatar' + user.uid]
});
} else {
events.wei_process({
total: window['total' + containerid],
num: window['num' + containerid],
tip: "五分钟后重试第" + window['retry' + containerid] + '次',
name: user.username,
avatar: window['avatar' + user.uid]
});
window['st_id' + containerid] = setTimeout(function () {
wei_save(save_data);
}, 5 * 60 * 1000);
}
}
} else {
events.wei_process({
total: window['total' + containerid],
num: window['num' + containerid],
tip: "五分钟后自动重试",
name: user.username,
avatar: window['avatar' + user.uid]
});
window['st_id' + containerid] = setTimeout(function () {
wei_save(save_data);
}, 5 * 60 * 1000);
}
}, 'JSON').fail(function () {
events.wei_process({
total: window['total' + containerid],
num: window['num' + containerid],
tip: "5分钟后自动重试",
name: user.username,
avatar: window['avatar' + user.uid]
});
window['st_id' + containerid] = setTimeout(function () {
wei_save(save_data);
}, 5 * 60 * 1000);
})
}
function wei_detail(id, containerid) {
let url = 'https://m.weibo.cn/statuses/extend';
let data = {
id: id,
};
// console.log('wei_detail start', data);
$.get(url, data, function (res) {
if (res.ok === 1) {
let long = res.data && res.data.longTextContent;
long_replace_text(id, long, containerid)
} else {
}
}, 'JSON').fail(function () {
})
}
function long_replace_text(id, long, containerid) {
// console.log('long_replace_text',long);
let index = window['cards_list' + containerid].findIndex((item) => {
if (item.idstr === id) {
return true;
}else if(item.retweeted_status && item.retweeted_status.idstr === id){
return true;
}
});
if (index > -1) {
let tmp_item = window['cards_list' + containerid][index];
if(tmp_item.idstr === id){
let detail = window['cards_list' + containerid][index];
detail['text'] = long;
window['cards_list' + containerid][index] = detail;
}else if(tmp_item.retweeted_status && tmp_item.retweeted_status.idstr === id){
let re_detail = window['cards_list' + containerid][index]['retweeted_status'];
re_detail['text'] = long;
window['cards_list' + containerid][index]['retweeted_status'] = re_detail;
}
}
}
function create_html(user, containerid, word = '') {
let html = '';
html += html_head(user.username);
let list = window['cards_list' + containerid];
if (!list || list.length === 0) {
return
}
let li;
for (let i in list) {
li = html_div(list[i]);
html += li;
}
html += html_foot();
let n = 2;
if (window['total' + containerid] > 50000) {
n = 3;
}
download(user.username + '_' + _pad(window['html_time' + containerid], n) + word + '.html', html);
window['cards_list' + containerid] = [];
window['html_time' + containerid]++;
}
function html_div(mblog) {
if (!mblog) {
return '';
}
var comment = config_get(COMMENT_ROW);
var picture = config_get(PIC_SHOW);
// console.log(mblog)
mblog.text = mblog.text.replace(/="\/\//g, '="https://').replace(/=\'\/\//g, "='https://"
).replaceAll('href="/status', 'href="https://m.weibo.cn/status'
).replaceAll('href="/n', 'href="https://m.weibo.cn/n'
).replaceAll('<a data-url=', '<a target="_blank" data-url=');
let main1 = `<div class="card m-panel card9 weibo-member">
<div class="card-wrap">
<div class="card-main">
<header class="weibo-top m-box m-avatar-box">
<a class="m-img-box" href="${mblog.idstr && 'https://m.weibo.cn/detail/' + mblog.idstr}" target="_blank">
<img src="${mblog.user && mblog.user.profile_image_url}">
<i class="m-icon m-icon-goldv-static"></i>
</a>
<div class="m-box-col m-box-dir m-box-center">
<div class="m-text-box"><a>
<h3 class="m-text-cut">
${mblog.user && mblog.user.screen_name}
<i class="m-icon m-icon-vipl7"></i></h3></a><h4 class="m-text-cut">
<span class="time">${mblog.created_at}</span>
<span class="from">${mblog.source ? '来自 ' + mblog.source : ''}</span></h4>
</div>
</div>
</header>
<article class="weibo-main">
<div class="weibo-og">
<div class="weibo-text">
${mblog.text}
</div>
<div>`;
let mp1 = '', mp2 = '', mps = '';
if (mblog.pic_num > 0) {
mp1 = `<div class="weibo-media-wraps weibo-media media-b">
<ul class="m-auto-list">`;
for (let i in mblog.pics) {
var pic_large1 = mblog.pics[i].large && mblog.pics[i].large.url;
var pic_thumb1 = mblog.pics[i].url;
mps += `<li class="m-auto-box">
<div class="m-img-box m-imghold-square">
<a target="_blank" href="${pic_large1}">
<img src="${picture==='1'?pic_thumb1:pic_large1}">
</a>
</div>
</li>`;
}
mp2 = `</ul></div>`
}
let main2 = `</div></div>`;
let rtw = mblog.retweeted_status;
let rt1 = '', rt2 = '', rtp1 = '', rtp2 = '', rtps = '';
if (rtw) {
rtw.text = rtw.text.replaceAll('="//', '="https://').replaceAll("='//", "='https://"
).replaceAll('href="/status', 'href="https://m.weibo.cn/status'
).replaceAll('href="/n', 'href="https://m.weibo.cn/n'
).replaceAll('<a data-url=', '<a target="_blank" data-url=');
rt1 = `<div class="weibo-rp">
<div class="weibo-text">
<span>
<a href="${rtw.user && rtw.user.profile_url}">
@${rtw.user && rtw.user.screen_name}</a>:
</span>
<span>${rtw.text} </span>
</div>`;
if (rtw.pic_num > 0) {
rtp1 = `<div>
<div class="weibo-media-wraps weibo-media media-b">
<ul class="m-auto-list">`
for (let i in rtw.pics) {
var pic_large = rtw.pics[i].large && rtw.pics[i].large.url;
var pic_thumb = rtw.pics[i].url;
rtps += `<li class="m-auto-box">
<div class="m-img-box m-imghold-square">
<a target="_blank" href="${pic_large}">
<img src="${picture==='1'?pic_thumb:pic_large}">
</a>
</div>
</li>`;
}
rtp2 = `</ul>
</div>
</div>`
}
rt2 = `</div>`;
}
let bottom1 = `</article>`
let comment_row = '';
if (comment === '1') {
comment_row = `<footer class="m-ctrl-box m-box-center-a">
<div class="m-diy-btn m-box-col m-box-center m-box-center-a">
<i class="m-font m-font-forward"></i>
<h4>${mblog.reposts_count}</h4></div>
<span class="m-line-gradient"></span>
<div class="m-diy-btn m-box-col m-box-center m-box-center-a">
<i class="m-font m-font-comment"></i>
<h4>${mblog.comments_count}</h4></div>
<span class="m-line-gradient"></span>
<div class="m-diy-btn m-box-col m-box-center m-box-center-a">
<i class="m-icon m-icon-like"></i>
<h4>${mblog.attitudes_count}</h4></div>
</footer>`;
}
let bottom2 = `</div>
</div>
</div>`;
return main1 + mp1 + mps + mp2 + main2 + rt1 + rtp1 + rtps + rtp2 + rt2 + bottom1 + comment_row + bottom2;
}
function html_head(title) {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>${title ? title : 'Document'}</title>
<link rel="stylesheet" href="https://h5.sinaimg.cn/marvel/v1.4.5/css/card/cards.css">
<link rel="stylesheet" href="https://h5.sinaimg.cn/marvel/v1.4.5/css/lib/base.css">
<style>[class*=m-imghold]>a>img {z-index: 0;height: 100%;position: absolute;}</style>
</head>
<body>
<div id="app" class="m-container-max">
<div style="height: 100%;">`
}
function html_foot() {
return `</div>
</div>
</body>
</html>`
}
function download(filename, content, contentType) {
if (!contentType) contentType = 'application/octet-stream';
var a = document.createElement('a');
var blob = new Blob([content], {'type': contentType});
a.href = window.URL.createObjectURL(blob);
a.download = filename;
a.click();
}
function default_func(name, val) {
if (config_get(name) === null) {
config_set({[name]: val});
}
}
function default_option() {
default_func(PER_PAGE, '500');
default_func(COMMENT_ROW, '1');//1显示2不显示;
default_func(PIC_SHOW, '1')//1小图2大图;
}
default_option();