-
Notifications
You must be signed in to change notification settings - Fork 21
/
options.js
728 lines (641 loc) · 32.9 KB
/
options.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
Vue.use(VueDND);
var app = new Vue({
el: '#app',
data: {
isInit: false, //是否完成初始化
//sliderWidth: 0,
searchInputValue: '',
searchData: {
keyword: null,
models: [], //搜索域配置
results: [], //搜索结果
resultsIndex: {}, //搜索结果实际排序对应
pageNums: [] //搜索结果
},
clientHeight: 500,
settingFormData: {
type: 'baidu',
symbol: '',
scope: '',
show: true,
canEdit: true,
canDelete: true
},
//右侧边栏样式
drawer: {
show: false,
styles: {
height: 'calc(100% - 55px)',
overflow: 'auto',
paddingBottom: '90px',
position: 'static'
},
itemDraggable: true
},
version: {
notice: '',
localVer: '',
latestVer: '',
},
settings: {
jBar: {
hotkeys: [],
onSelection: false,
inExist:true, //在已有 jSearch 标签页打开
history:true
},
BG:{
searchInAddress : true
},
pageScroll: [],
resultListWidth: 600,
showHeadBar:true,
autoHideHeadBar:true,
kwColor:'green',
orderByTime:true, //按结果加载时间排序,先加载出来的结果排在前面
},
searchHistory:[] //搜索历史
},
computed: {
// 仅读取 已废弃
sliderWidth1: function () {
let sliderWidth = 0;
for (let i in this.searchData.results)
//if (!(this.searchData.results[i].length == 1 && this.searchData.results[i][0] == '') && this.searchData.results[i].length > 0)
if (this.searchData.results[i].length > 0 && this.searchData.results[i][0] != '')
sliderWidth += this.settings.resultListWidth;
return sliderWidth;
},
},
methods: {
handleReachBottom: function (index) {
var _this = this;
return function () {
return new Promise(resolve => {
var search_scope = _this.searchData.models[index].symbol != '' ?
_this.searchData.models[index].symbol + _this.searchData.models[index].scope :
'';
switch (_this.searchData.models[index].type) {
case 'baidu':
{
if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
resolve();
return false;
}
let gpc = '';
if (_this.searchData.keyword == '') {
//当搜索词为空时 搜索最近一天的内容,主要针对 site 站点
let now = parseInt((new Date()).getTime() / 1000);
gpc = encodeURIComponent(`stf=${now-86400},${now}|stftype=1`);
}
axios.get(`https://www.baidu.com/s?wd=${search_scope} ${encodeURIComponent(_this.searchData.keyword)}&pn=${_this.searchData.pageNums[index]*10}&gpc=${gpc}`).then(function (response) {
//console.log(data);
let res_obj = $(response.data.replace(/src="\//g, 'src="https://www.baidu.com/')).find('#content_left');
res_obj.children().not('.c-container').remove();
let res = res_obj[0].outerHTML;
let text_for_check = $(res).text(); //将字符串再次转换为对象又转为字符串 会经过一次格式化 这样得到的字符串才是稳定的,才能用于比较
//console.log(res);
//console.log($(_this.searchData.results[index][_this.searchData.results[index].length-1]).text());
//检查现在获得的内容和目前列表中最后一条是否一样 一样则表示没有新内容了
if ($(_this.searchData.results[index][_this.searchData.results[index].length - 1]).text() == text_for_check) {
_this.searchData.results[index].push('');
} else if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
} else {
_this.searchData.results[index].push(res);
_this.searchData.pageNums[index]++;
}
//_this.resultsIndex(index);
resolve();
}).catch(function (error) {
console.log(error);
resolve();
});
break;
}return;
case 'google':
{
if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
resolve();
return false;
}
let tbs = '';
if (_this.searchData.keyword == '') {
//当搜索词为空时 搜索最近一天的内容,主要针对 site 站点
tbs = 'qdr:d';
var kw_reg = false;
}else{
//关键词提取正则
var kw_reg = _this.searchData.keyword.replace(/[-[\]{}()*+?.,\\^$|#]/g, '\\$&').replace(/\s+/g, '|');
}
axios.get(`https://www.google.com/search?q=${search_scope} ${encodeURIComponent(_this.searchData.keyword)}&start=${_this.searchData.pageNums[index]*10}&tbs=${tbs}`)
.then(function (response) {
let res_obj = $(response.data.replace(/src="\//g, 'src="https://www.google.com/').replace(/href="\//g, 'href="https://www.google.com/').replace(/href="https:\/\/www\.google\.com\/search\?q=/g, 'href="https://www.google.com/search?o0=o&q=').replace('onload="', 'ss="')).find('#rso');
//处理部分链接没有加载的问题
res_obj.find('a').each(function () {
let src= $(this).attr('data-url');
if(!src)return;
if(src.indexOf('/')===0)
src = 'https://www.google.com'+src;
$(this).attr('href', src);
});
//识别标题中的关键词
res_obj.find('.g .rc>.r>a>h3').each(function(){
$(this).html( $(this).html().replace(new RegExp('(' + kw_reg + ')', 'ig'), '<em>$&</em>') );
});
let res = res_obj[0].outerHTML;
let text_for_check = $(res).text();
if ($(_this.searchData.results[index][_this.searchData.results[index].length - 1]).text() == text_for_check) {
_this.searchData.results[index].push('');
} else if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
} else {
_this.searchData.results[index].push(res);
_this.searchData.pageNums[index]++;
}
//_this.resultsIndex(index);
resolve();
}).catch(function (error) {
console.log(error);
resolve();
});
break;
}
case 'bing':
{
if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
resolve();
return false;
}
let filters = '';
if (_this.searchData.keyword == '') {
//当搜索词为空时 搜索最近一天的内容,主要针对 site 站点
filters = 'ex1:"ez1"';
var kw_reg = false;
}else{
//关键词提取正则
var kw_reg = _this.searchData.keyword.replace(/[-[\]{}()*+?.,\\^$|#]/g, '\\$&').replace(/\s+/g, '|');
}
axios.get(`https://cn.bing.com/search?q=${search_scope} ${encodeURIComponent(_this.searchData.keyword)}&first=${_this.searchData.pageNums[index]*10+1}&filters=${filters}`)
.then(function (response) {
let res_obj = $(response.data.replace(/src="\//g, 'src="https://cn.bing.com/')).find('#b_results');
res_obj.children(`:gt(${res_obj.children().length-4})`).remove();
res_obj.find('img').each(function () {
let src= $(this).attr('data-src-hq');
if(!src)return;
if(src.indexOf('/')===0)
src = 'https://cn.bing.com'+src;
$(this).attr('src', src);
});
//识别标题中的关键词
res_obj.find('.b_algo>h2>a').each(function(){
$(this).html( $(this).html().replace(new RegExp('(' + kw_reg + ')', 'ig'), '<strong>$&</strong>') );
});
let res = res_obj[0].outerHTML;
let text_for_check = $(res).text();
if ($(_this.searchData.results[index][_this.searchData.results[index].length - 1]).text() == text_for_check) {
_this.searchData.results[index].push('');
} else if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
} else {
_this.searchData.results[index].push(res);
_this.searchData.pageNums[index]++;
}
//_this.resultsIndex(index);
resolve();
}).catch(function (error) {
console.log(error);
resolve();
});
break;
}
case 'bookmarks':
{
//_this.searchData.results[index] = [];
if (_this.searchData.results[index].length > 0) {
resolve();
return false;
}
//先将关键词中的特殊符号转义($& 代表匹配到的内容本身),再将空字符转为‘|’ 将关键词变成正则表达式 在后面用以匹配变色
var kw_reg = _this.searchData.keyword.replace(/[-[\]{}()*+?.,\\^$|#]/g, '\\$&').replace(/\s+/g, '|');
//for (let i in kw){
chrome.bookmarks.search(_this.searchData.keyword, function (res) {
//console.log(res)
//res.splice(0,1);
for (let i in res) {
res[i].dateAdded = getDate(res[i].dateAdded);
res[i].title = res[i].title.replace(new RegExp('(' + kw_reg + ')', 'ig'), '<em>$&</em>');
res[i].tag = 'bookmark'
} //console.log(res)
_this.searchData.results[index] = _this.searchData.results[index].concat(res);
});
chrome.history.search({
'text': _this.searchData.keyword,
'startTime': 0,
'maxResults': 120
}, function (res) {
for (let i = res.length - 1; i >= 0; i--) {
//屏蔽本扩展的历史记录
if (res[i].url.indexOf(chrome.extension.getURL('')) > -1) {
res.splice(i, 1)
continue;
}
res[i].dateAdded = getDate(res[i].lastVisitTime);
res[i].title = res[i].title.replace(new RegExp('(' + kw_reg + ')', 'ig'), function (match) {
return '<em>' + match + '</em>'
});
res[i].tag = 'history'
} //console.log(res)
_this.searchData.results[index] = _this.searchData.results[index].concat(res);
//_this.resultsIndex(index);
resolve();
});
//}
break;
}
case 'weixin':
{
if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
resolve();
return false;
}
axios.get(`https://weixin.sogou.com/weixin?query=${encodeURIComponent(_this.searchData.keyword)}&type=${_this.searchData.models[index].symbol}&page=${++_this.searchData.pageNums[index]}&_sug_type_=&s_from=input&_sug_=n&ie=utf8`, {
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Cache-Control': 'no-cache',
'Pragma': 'no-cache',
'Upgrade-Insecure-Requests': '1',
}
}).then(function (response) {
//console.log(response);
let data = response.data.replace(/onerror/g, 'ss').replace(/src="\/\//g, 'src="http://').replace(/src="\//g, 'src="https://weixin.sogou.com/').replace(/href="\//g, 'href="https://weixin.sogou.com/').replace(/onload="resizeImage\(.*\)"/g, 'height="105"').replace(/<script>document\.write\(timeConvert\('(.*)'\)\)<\/script>/g, function (match, item1) {
return getDate(parseInt(item1) * 1000);
});
let res_obj = $(data).find('.news-box>ul');
res_obj.find('.pop').css('display', '');
if (res_obj.length < 1) {
if ($(data).find('#seccodeForm').length > 0) {
_this.searchData.results[index].push(`您需要进行验证后才能继续使用:<a href="https://weixin.sogou.com/weixin" target="_blank">去验证</a>`);
resolve();
return;
}
_this.searchData.results[index].push('');
resolve();
return;
}
let res = res_obj[0].outerHTML;
let text_for_check = $(res).text();
//console.log(res);
//console.log($(_this.searchData.results[index][_this.searchData.results[index].length-1]).text());
if ($(_this.searchData.results[index][_this.searchData.results[index].length - 1]).text() == text_for_check) {
_this.searchData.results[index].push('');
} else if (_this.searchData.results[index][_this.searchData.results[index].length - 1] == '') {
} else {
_this.searchData.results[index].push(res);
//_this.searchData.pageNums[index]++;
}
//_this.resultsIndex(index);
resolve();
})
.catch(function (error) {
console.log(error);
resolve();
});
break;
}
default:
null;
}
});
}
},
/**
* 计算并获取 searchData.resultsIndex
* @param {*} index 搜索模型的 index
*/
resultsIndex:function(index){
if(typeof this.searchData.resultsIndex[index] == 'undefined'){
this.searchData.resultsIndex[index] = Object.keys(this.searchData.resultsIndex).length;
}
if(!this.settings.orderByTime)return index;
return this.searchData.resultsIndex[index];
},
settingAddSearchScope: function () {
this.settingFormData.scope = this.settingFormData.scope.trim().replace(/^(http[s]?:\/\/)|(\/)$/, function (match) {
return '';
});
if (this.settingFormData.scope.indexOf('/') > -1 && this.settingFormData.type == 'baidu')
this.settingFormData.symbol = 'inurl:';
else
this.settingFormData.symbol = 'site:';
this.searchData.models = this.searchData.models.concat(JSON.parse(JSON.stringify(this.settingFormData)));
this.settingFormData = {
type: 'baidu',
symbol: '',
scope: '',
show: true,
canEdit: true,
canDelete: true
};
},
changeFixed: function (clientHeight) { //动态修改样式
//console.log(clientHeight);
//this.$refs.homePage.style.height = clientHeight+'px';
},
searchInputSubmit: function () {
console.log(this.searchInputValue);
location.href = '#' + this.searchInputValue;
},
init: function () {
var _this = this;
//加载站点配置
chrome.storage.sync.get('searchModels', function (items) {
//console.log(items);
for(let i in items.searchModels)
if(!items.searchModels[i])
delete items.searchModels[i];
_this.searchData.models = items.searchModels;
});
//加载通用设置
chrome.storage.sync.get('settings', function (items) {
//console.log(items);
_this.settings = items.settings;
});
chrome.storage.sync.getBytesInUse('searchModels', function (size) {
console.log(size);
});
_this.checkUpdate();
_this.setKeyword();
//_this.isInit = true;
//_this.doSearch();
},
doSearch() {
console.log('doSearch:' + this.searchData.keyword);
this.sliderWidth = 0;
this.searchData.resultsIndex = {};
var _this = this;
for (let i in this.searchData.models) {
//this.searchData.results[i] = [];
Vue.set(this.searchData.results, i, []);
this.searchData.pageNums[i] = 0;
if (!this.searchData.models[i].show) {
continue;
}
if (this.searchData.models[i].type == 'weixin' && this.searchData.models[i].symbol == 1) {
setTimeout(function () { //延迟执行微信公众号搜索,试图解决因被服务器察觉而需要输入验证码的情况
_this.handleReachBottom(i)();
}, 2000);
} else {
this.handleReachBottom(i)();
}
}
this.history(this.searchData.keyword);
setTimeout(function(){
_this.command(_this.searchData.keyword);
},0);
if(document.getElementById('cz'))
document.getElementById('cz').src=`http://www.jsearch.site/home/?id=${chrome.runtime.id}`;
},
setKeyword() {
let hash = '';
if (typeof window.location.hash != 'undefined') {
hash = window.location.hash.substr(1);
}
this.searchData.keyword = decodeURIComponent(hash).trim();
this.searchInputValue = this.searchData.keyword;
jBar.setKeyword(this.searchInputValue);
},
/**
* 指令触发
* @param {*} key
*
*/
command:function(key){
switch(key){
case '设置':{this.drawer.show = true;break;}
case '红色':{this.settings.kwColor = 'red';break;}
case '蓝色':{this.settings.kwColor = 'blue';break;}
case '绿色':{this.settings.kwColor = 'green';break;}
case '黑色':{this.settings.kwColor = 'black';break;}
default :{}
}
},
history:function(keyword){
var _this = this;
if(!keyword){
return _this.searchHistory;
}
chrome.storage.sync.get('searchHistory', function (items) {
_this.searchHistory = items.searchHistory || [];
if(_this.searchHistory[0] != keyword){
_this.searchHistory.unshift(keyword);
if(_this.searchHistory.length > 50){ //只保留最近50个搜索历史
_this.searchHistory.pop();
}
}else{return;}
chrome.storage.sync.set({
'searchHistory': _this.searchHistory
});
});
},
checkUpdate() {
var _this = this;
_this.version.localVer = chrome.runtime.getManifest().version;
axios.get('http://www.jsearch.site/app.json?r=' + Math.random()).then(function (resp) {
//console.log(resp);
_this.version.latestVer = resp.data.version;
if (_this.version.localVer != _this.version.latestVer) {
console.log('new version:' + _this.version.latestVer)
_this.version.notice = 'new';
_this.showMsg(`新版本提醒|发现新版本:<a href="https://github.com/dubox/jSearch/releases">v${_this.version.latestVer}</a> ,赶紧更新吧!!!|0`);
}
_this.broadcast(resp.data.broadcast);
});
},
broadcast(msg){
var _this = this;
chrome.storage.local.get(['broadcast'], function(local) {
//console.log('broadcast: ' + local.broadcast);
if(local.broadcast != msg){
_this.showMsg(msg);
chrome.storage.local.set({broadcast: msg});
}
});
},
showMsg(msg){
let _msg = msg.split('|');
this.$Notice.open({
title: _msg[0],
desc: _msg[1],
duration:parseInt(_msg[2]?_msg[2]:0)
});
},
},
beforeMounted() {
},
mounted() {
var _this = this;
// 获取浏览器可视区域高度
this.clientHeight = document.documentElement.clientHeight; //document.body.clientWidth;
//console.log(self.clientHeight);
var _this = this;
window.onresize = function () {
_this.clientHeight = document.documentElement.clientHeight;
};
window.addEventListener('popstate', () => {
this.setKeyword();
})
//顶部感应区,触发显示 header-bar
document.querySelector('#top_area').addEventListener('mouseenter', function () {
if(!_this.settings.showHeadBar || !_this.settings.autoHideHeadBar)return;
let h_bar = document.querySelector('.header_bar');
h_bar.classList.add('down');
//h_bar.focus();
document.querySelector('.header_bar input').focus();
document.querySelector('.header_bar input').select();
});
document.querySelector('#header_bar').addEventListener('mouseleave', function () {
if(!_this.settings.showHeadBar || !_this.settings.autoHideHeadBar)return;
document.querySelector('.header_bar input').blur();
let h_bar = document.querySelector('.header_bar');
h_bar.classList.remove('down');
});
document.querySelector('.content').addEventListener('click', function () {
if(!_this.settings.showHeadBar || !_this.settings.autoHideHeadBar)return;
let h_bar = document.querySelector('.header_bar');
if(h_bar.classList.contains('down')){
document.querySelector('.header_bar input').blur();
h_bar.classList.remove('down');
}
});
//拖拽排序
this.$dragging.$on('dragged', ({
value
}) => {})
//鼠标滚轮横向滚屏
window.addEventListener('mousewheel', function (e) {
if (!(e.altKey && _this.settings.pageScroll.includes("alt+mw")) && !(e.buttons == 1 && _this.settings.pageScroll.includes("mLeftKey+mw"))) return;
let scrollY = $('.slider').scrollLeft();
if (e.deltaY < 0) {
scrollY -= 100;
$('.slider').scrollLeft(scrollY);
} else {
scrollY += 100;
$('.slider').scrollLeft(scrollY);
}
e.preventDefault();
});
//左右方向键 横向滚屏
hotkeys('left,right', function (event, handler) {
let tagName = (event.target || event.srcElement).tagName;
if (tagName.isContentEditable ||
tagName == 'INPUT' ||
tagName == 'SELECT' ||
tagName == 'TEXTAREA') {
return;
}
if (!_this.settings.pageScroll.includes("navKeys")) return;
let scrollX = $('.slider').scrollLeft();
if (handler.key == 'left') {
scrollX -= _this.settings.resultListWidth;;
$('.slider').scrollLeft(scrollX);
} else {
scrollX += _this.settings.resultListWidth;;
$('.slider').scrollLeft(scrollX);
}
event.preventDefault();
});
this.init();
},
watch: {
// 如果 `clientHeight` 发生改变,这个函数就会运行
clientHeight: function () {
this.changeFixed(this.clientHeight)
},
'searchData.keyword': function () {
this.doSearch();
},
'searchData.models': {
handler(newVal) {
for (let i in newVal) {
if (this.searchData.models[i].canEdit) {
this.searchData.models[i].scope = newVal[i].scope.trim().replace(/^(http[s]?:\/\/)|(\/)$/, function (match) {
return '';
});
if(this.searchData.models[i].scope == ''){
this.searchData.models.splice(i,1);
continue;
}
if (this.searchData.models[i].scope.indexOf('/') > -1)
this.searchData.models[i].symbol = 'inurl:';
else
this.searchData.models[i].symbol = 'site:';
}
}
//console.log(this.searchData.models);
this.doSearch();
//保存设置到 storage.sync
chrome.storage.sync.set({
searchModels: this.searchData.models
});
},
deep: true
},
'settings': {
handler(newVal) {
chrome.storage.sync.set({
settings: this.settings
});
//jBar.setSettings(this.settings.jBar);
//sendToBg({'setting':this.settings.BG},function(re){console.log(re);});
},
deep: true
},
},
directives: {
/*
change: {
// 指令的定义
inserted: function (el ,binding, vnode) {
el.onchange = function(){
console.log(el);
console.log(binding);
console.log(vnode);
}
}
}
*/
}
});
function getDate(timestamp) {
var now = new Date(timestamp),
y = now.getFullYear(),
m = now.getMonth() + 1,
d = now.getDate();
return y + "年" + m + "月" + d + '日';
}
function timeConvert(timestamp) {
return getDate(timestamp);
}
//声明_czc对象:
var _czc = _czc || [];
//绑定siteid,请用您的siteid替换下方"XXXXXXXX"部分
_czc.push(["_setAccount", "1276484996"]);
/**test */
var aaa = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Access-Control-Allow-Credentials': 'true',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Cookie': 'SUV=003F3495718C545A5C6E05323751E611; usid=0zHeHHXksgMKIknU; IPLOC=CN6101; wuid=AAECF53vJQAAAAqUKXFYggIAAAA=; CXID=C8CD45FEBC802B97BD4F343659D743E0; SUID=0AF472DC2320940A000000005C791654; ABTEST=2|1551439449|v1; weixinIndexVisited=1; JSESSIONID=aaa3fIT14sXiI9t1BgZKw; ld=5kllllllll2tWFxVlllllVeiG9UlllllT4a1jkllll9llllllylll5@@@@@@@@@@; LSTMV=245%2C70; LCLKINT=11393; PHPSESSID=16iid5e7b0841ch35n6qlslaf1; SNUID=8B76F35D818401882AA9A3ED82924378; sct=3',
'Host': 'weixin.sogou.com',
'Pragma': 'no-cache',
'Referer': 'https://weixin.sogou.com/',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36',
};
//todo
//搜索历史
//支持删除自定义站点
//支持当前网页地址生成二维码
//修复空格快捷键的兼容问题(在简书编辑器)