-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
1815 lines (1588 loc) · 92.3 KB
/
content.js
File metadata and controls
1815 lines (1588 loc) · 92.3 KB
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// [사이트 분리 로직] 사이트별로 허용할 다운로드 모듈을 제한합니다.
const PRE_DEFINED_SITES = [
{
url: "tcafe21.com",
selector: ".board-hot-posts, #fboardlist",
thumbSelector: "img",
excludeThumbSelector: ".board-thumbnail",
allowedDLs: ["giga", "gofile", "transfer"],
autoConfirmKeywords: ["포인트", "열람"],
boardFilter: /[?&]bo_table=D2002(?:&|#|$)/i,
getHighResUrlAsync: async (thumb) => {
const link = thumb.closest('a');
if (!link || !link.href) return "";
if (thumb.dataset.cachedHighRes) return thumb.dataset.cachedHighRes;
try {
const res = await fetch(link.href);
const html = await res.text();
// 최적화: 무거운 DOMParser 대신 정규표현식을 사용하여 추출 속도 대폭 향상
const match = html.match(/class=["'][^"']*view-content[^"']*["'][\s\S]*?<img[^>]+src=["']([^"']+)["']/i);
if (match && match[1]) {
const absoluteUrl = new URL(match[1], link.href).href;
thumb.dataset.cachedHighRes = absoluteUrl;
return absoluteUrl;
}
} catch (error) {
console.log("고화질 썸네일 추출 실패:", error);
}
return "";
},
customCss: `
.well {
border-radius: 10px !important;
padding: 20px !important;
width: 100% !important;
max-width: 1200px !important;
background: rgba(255, 255, 255, 0.95) !important;
box-shadow: 0 -2px 5px rgba(0,0,0,0.15) !important;
backdrop-filter: blur(5px) !important;
}
body { padding-bottom: 120px !important; }
.bm-badge-br.list-br { display: block !important; height: 0 !important; margin-top: 8px !important; }
.bm-quick-actions.list-actions { display: flex !important; flex-wrap: wrap !important; gap: 4px !important; margin-top: 5px !important; width: auto !important; }
.bm-quick-actions.list-actions button { margin: 0 !important; flex-shrink: 0 !important; font-weight: 400 !important; opacity: 0.7; }
#fboardlist table th:nth-child(1),#fboardlist table td:nth-child(1),
#fboardlist table th:nth-child(4), #fboardlist table td:nth-child(4),
#fboardlist table th:nth-child(6), #fboardlist table td:nth-child(6),
#fboardlist table th:nth-child(7), #fboardlist table td:nth-child(7) {
display: none !important;
}
`,
themeCss: `
@import url('https://fonts.googleapis.com/css2?family=Jua&display=swap');
.div-table.table > tbody > tr > td,
#fboardlist table td{padding:12px 8px !important;border-bottom: 1px solid #ddd;}
table.list-pc .list-subject a,
#fboardlist .list-subject a{font-family: "Jua", sans-serif;}
#fboardlist .list-subject a button{font-weight:400 !important;}
`
},
{
url: "127.0.0.1",
selector: "#data_list",
thumbSelector: "img",
excludeThumbSelector: ".thumbnail",
allowedDLs: ["giga", "gofile", "transfer"],
autoConfirmKeywords: ["포인트", "열람"],
getHighResUrlAsync: async (thumb) => {
const link = thumb.closest('a');
if (!link || !link.href) return "";
if (thumb.dataset.cachedHighRes) return thumb.dataset.cachedHighRes;
try {
const res = await fetch(link.href);
const html = await res.text();
// 최적화: 무거운 DOMParser 대신 정규표현식을 사용하여 추출 속도 대폭 향상
const match = html.match(/class=["'][^"']*view-content[^"']*["'][\s\S]*?<img[^>]+src=["']([^"']+)["']/i);
if (match && match[1]) {
const absoluteUrl = new URL(match[1], link.href).href;
thumb.dataset.cachedHighRes = absoluteUrl;
return absoluteUrl;
}
} catch (error) {
console.log("고화질 썸네일 추출 실패:", error);
}
return "";
},
},
{
url: "ridibooks.com", selector: ".infinite-scroll-component", allowedDLs: []
},
{
url: "enterjoy.day",
selector: "#fboardlist .list-board",
allowedDLs: ["giga", "gofile", "transfer"],
autoConfirmKeywords: ["열람하시겠습니까"],
boardFilter: /[?&]bo_table=(sub_manga|manga_jic|joy_new|joy_mh|joy_lv|joy_rofan|books|joy_fan|joy_ai|19novel|joy_bell|joy_fan_request)(?:&|#|$)/i,
themeCss: `
#fboardlist > ul, #fboardlist .board-list, #fboardlist > div,
#fboardlist table, #fboardlist table tbody {
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
gap: 16px !important;
padding: 0 !important;
border: none !important;
background: transparent !important;
}
#fboardlist table thead { display: none !important; }
#fboardlist .list-board li{margin-bottom:5px}
#fboardlist .list-item,
#fboardlist .list-board li,
#fboardlist table tbody tr {
display: flex !important;
flex-direction: column !important;
background: #ffffff !important;
border: 1px solid #e9ecef !important;
border-radius: 12px !important;
padding: 16px !important;
box-shadow: 0 4px 12px rgba(0,0,0,0.04) !important;
transition: all 0.2s ease-in-out !important;
border-bottom: 1px solid #e9ecef !important;
width: auto !important;
align-items: flex-start !important;
}
#fboardlist .list-item:hover,
#fboardlist .list-board li:hover,
#fboardlist table tbody tr:hover {
transform: translateY(-4px) !important;
box-shadow: 0 12px 24px rgba(0,0,0,0.1) !important;
border-color: #80bdff !important;
z-index: 10;
}
#fboardlist table td {
display: block !important;
border: none !important;
padding: 0 !important;
width: 100% !important;
text-align: left !important;
}
#fboardlist .wr-subject,
#fboardlist table td.td_subject,
#fboardlist table td.list-subject {
flex-grow: 1 !important;
margin-bottom: 12px !important;
padding: 0 !important;
width: 100% !important;
}
#fboardlist .wr-subject a,
#fboardlist table td.td_subject a,
#fboardlist table td.list-subject a {
display: block !important;
font-size: 15px !important;
font-weight: 700 !important;
line-height: 1.5 !important;
color: #212529 !important;
word-break: keep-all !important;
text-decoration: none !important;
}
#fboardlist .wr-subject a:hover,
#fboardlist table td.td_subject a:hover {
color: #0d6efd !important;
}
/* 작성자, 날짜 영역 하단 배치 */
#fboardlist .wr-name,
#fboardlist .wr-date,
#fboardlist table td.td_name,
#fboardlist table td.td_datetime {
display: inline-block !important;
font-size: 12px !important;
color: #868e96 !important;
margin-top: 8px !important;
}
#fboardlist .wr-name,
#fboardlist table td.td_name { margin-right: 10px !important; }
/* 기존 리스트 헤더 및 불필요 항목 숨김 */
#fboardlist .list-header,
.list-item .wr-good,
.list-item .wr-hit,
.list-item .wr-num,
#fboardlist table td.td_num,
#fboardlist table td.td_m_id,
#fboardlist table td.td_hit,
#fboardlist table td.td_good {
display: none !important;
}
/* 뱃지 및 퀵 버튼 여백 조정 */
.bm-badge-br.list-br { display: block !important; height: 0 !important; margin-top: 8px !important; }
.bm-quick-actions.list-actions { display: flex !important; flex-wrap: wrap !important; gap: 4px !important; margin-top: 8px !important; width: auto !important; }
.bm-quick-actions.list-actions button { margin: 0 !important; flex-shrink: 0 !important; font-weight: 400 !important; opacity: 0.7; }
`,
},
{
url: "hellkaiv.net",
selector: "#gall_ul .bo_tit",
autoConfirmKeywords: ["링크", "발급"],
allowedDLs: ["giga", "gofile", "hk"],
customCss: `
.bm-quick-actions.list-actions {
display: flex !important;
flex-wrap: wrap !important;
gap: 4px !important;
margin-top: 6px !important;
width: 100% !important;
}
.bm-quick-actions.list-actions button {
margin: 0 !important;
flex-shrink: 0 !important;
}
`,
},
{
url: "amazon.co.jp",
selector: ".a-carousel-card, div[data-asin], .s-result-item, #gridItemRoot, .a-cardui",
allowedDLs: []
},
{ url: "example.com", selector: "#board_list", allowedDLs: [] }
];
let globalAllowedDLs = [];
let globalTargetSelector = 'a';
let globalDetailSelector = '';
let globalCustomCss = '';
let globalThemeCss = '';
let isTargetSite = false;
let exactMatchCache = {};
let cachedBookList = [];
let isDataLoaded = false;
let similarityCache = {};
let lastRightClickedLink = null;
let lastRightClickedElement = null;
let isDownloadUIEnabled = true;
let titleProcessingCache = new Map();
let isEverythingEnabled = false;
let isShowListQuickBtn = false;
let isShowListQuickBtnHover = false;
let isCustomThemeEnabled = false;
let isAllowedBoard = true;
let isSupportSingleCharEnabled = false;
function initDataCache(data) {
isDownloadUIEnabled = data.showDownloadUI !== false;
isEverythingEnabled = !!data.connectEverything;
isShowListQuickBtn = !!data.showListQuickBtn;
isShowListQuickBtnHover = !!data.showListQuickBtnHover;
isCustomThemeEnabled = !!data.useCustomTheme;
isSupportSingleCharEnabled = !!data.supportSingleChar;
const hostname = window.location.hostname;
let config = PRE_DEFINED_SITES.find(s => hostname.includes(s.url));
const userSites = Array.isArray(data.allowedSites) ? data.allowedSites : [];
const matchedUserSite = userSites.find(s => {
const sUrl = typeof s === 'string' ? s : s.url;
return hostname.includes(sUrl);
});
if (config) {
isTargetSite = true;
globalAllowedDLs = config.allowedDLs || [];
globalTargetSelector = config.selector || 'a';
globalCustomCss = config.customCss || '';
globalThemeCss = config.themeCss || '';
isAllowedBoard = config.boardFilter ? config.boardFilter.test(window.location.href) : true;
} else if (matchedUserSite) {
isTargetSite = true;
globalAllowedDLs = ["giga", "gofile"];
globalTargetSelector = 'a';
globalCustomCss = matchedUserSite.customCss || '';
globalThemeCss = matchedUserSite.themeCss || '';
isAllowedBoard = true;
} else {
isTargetSite = false;
globalAllowedDLs = [];
isAllowedBoard = true;
}
globalDetailSelector = (matchedUserSite && typeof matchedUserSite === 'object' && matchedUserSite.detailSelector)
? matchedUserSite.detailSelector : (config && config.detailSelector ? config.detailSelector : '');
exactMatchCache = {};
similarityCache = {};
cachedBookList = (Array.isArray(data.bookList) ? data.bookList : []).map(b => {
let processedOriginal, processedNoSpace;
if (titleProcessingCache.has(b.title)) {
const cached = titleProcessingCache.get(b.title);
processedOriginal = cached.original;
processedNoSpace = cached.nospace;
} else {
processedOriginal = b.title.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim();
processedNoSpace = processedOriginal.replace(/\s+/g, '');
titleProcessingCache.set(b.title, { original: processedOriginal, nospace: processedNoSpace });
}
const enhanced = { ...b, _regBodyOriginal: processedOriginal, _regBodyNoSpace: processedNoSpace };
if(!exactMatchCache[processedNoSpace]) exactMatchCache[processedNoSpace] = enhanced;
return enhanced;
});
isDataLoaded = true;
}
function getOrCreateHoverContainer() {
let container = document.getElementById('book-manager-hover-preview');
if (!container) {
const style = document.createElement('style');
style.textContent = "@keyframes bmMgrSpin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }";
document.head.appendChild(style);
container = document.createElement('div');
container.id = 'book-manager-hover-preview';
container.style.cssText = "position: fixed; z-index: 9999999; display: none; max-width: 350px; max-height: 500px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); background: #111; overflow: hidden; pointer-events: none;";
const previewImg = document.createElement('img');
previewImg.id = 'book-manager-hover-img';
previewImg.style.cssText = "display: block; max-width: 350px; max-height: 500px; width: auto; height: auto; object-fit: contain; transition: filter 0.3s ease-in-out;";
const spinner = document.createElement('div');
spinner.id = 'book-manager-hover-spinner';
spinner.style.cssText = "position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border: 4px solid rgba(255, 255, 255, 0.3); border-top: 4px solid #fff; border-radius: 50%; animation: bmMgrSpin 1s linear infinite; z-index: 10; display: none;";
container.appendChild(previewImg);
container.appendChild(spinner);
document.body.appendChild(container);
}
return container;
}
function getPureLinkText(link) {
let safeHTML = link.innerHTML.replace(/<img[^>]*>/gi, '');
const temp = document.createElement('div');
temp.innerHTML = safeHTML;
const unwantedElements = temp.querySelectorAll('.count, .book-badge, .comment-badge, .bm-quick-actions');
unwantedElements.forEach(el => el.remove());
const walker = document.createTreeWalker(temp, NodeFilter.SHOW_COMMENT, null, false);
let commentNode;
const commentsToRemove = [];
while (commentNode = walker.nextNode()) { commentsToRemove.push(commentNode); }
commentsToRemove.forEach(node => node.remove());
return temp.textContent.trim();
}
const levRow0 = new Int32Array(256);
const levRow1 = new Int32Array(256);
function calculateLevenshtein(s, t) {
if (s === t) return 100;
const n = s.length, m = t.length;
if (n === 0 || m === 0) return 0;
if (n > 250 || m > 250) return 0;
if (Math.max(n, m) > Math.min(n, m) * 2.5) return 0;
for (let i = 0; i <= m; i++) levRow0[i] = i;
for (let i = 0; i < n; i++) {
levRow1[0] = i + 1;
for (let j = 0; j < m; j++) {
const cost = (s[i] === t[j]) ? 0 : 1;
levRow1[j + 1] = Math.min(levRow1[j] + 1, levRow0[j + 1] + 1, levRow0[j] + cost);
}
for (let j = 0; j <= m; j++) levRow0[j] = levRow1[j];
}
return (1 - levRow0[m] / Math.max(n, m)) * 100;
}
function getSimilarity(regBodyOriginal, siteBodyOriginal) {
const regBody = regBodyOriginal.replace(/\s+/g, '');
const siteBody = siteBodyOriginal.replace(/\s+/g, '');
if (regBody === siteBody) return 100;
if (siteBody.length <= 2) return 0;
if (regBody.length <= 2) {
const sim = calculateLevenshtein(regBody, siteBody);
return sim >= 90 ? sim : 0;
}
const spinOffRegex = /(외전|이어\s*원|이어원|스핀오프|앤솔로지)/;
const isRegSpinOff = spinOffRegex.test(regBodyOriginal);
const isSiteSpinOff = spinOffRegex.test(siteBodyOriginal);
if (isRegSpinOff !== isSiteSpinOff) return 0;
const regNumbers = regBodyOriginal.match(/\d+/g) || [];
const siteNumbers = siteBodyOriginal.match(/\d+/g) || [];
if (regNumbers.length > 0) {
const hasRequiredNumbers = regNumbers.every(num => siteNumbers.includes(num));
if (!hasRequiredNumbers) return 0;
}
const isSiteIncludesReg = siteBody.includes(regBody);
const isRegIncludesSite = regBody.includes(siteBody);
if (isSiteIncludesReg || isRegIncludesSite) {
const lengthDiff = Math.abs(regBody.length - siteBody.length);
if (lengthDiff <= 2) return 95;
if (lengthDiff <= 4) return 85;
const isPrefixOrSuffix = siteBody.startsWith(regBody) || siteBody.endsWith(regBody) || regBody.startsWith(siteBody) || regBody.endsWith(siteBody);
if (regBody.length >= 3 && isPrefixOrSuffix && lengthDiff <= 10) return 85;
return 75;
}
return calculateLevenshtein(regBody, siteBody);
}
function showInfoToast(msg, isError = false) {
let container = document.getElementById('book-manager-info-toast-container');
if (!container) {
container = document.createElement('div');
container.id = 'book-manager-info-toast-container';
container.style.cssText = "position:fixed; bottom:20px; right:20px; z-index:999999; display:flex; flex-direction:column; gap:10px; pointer-events:none;";
document.body.appendChild(container);
}
const toast = document.createElement('div');
const bgColor = isError ? '#dc3545' : '#17a2b8';
toast.style.cssText = "background: " + bgColor + "; color: white; padding: 12px 35px 12px 20px; border-radius: 8px; font-size: 14px; font-weight: bold; box-shadow: 0 4px 12px rgba(0,0,0,0.3); opacity: 0; transform: translateX(20px); transition: all 0.3s ease; white-space: nowrap; pointer-events: auto; position: relative;";
toast.innerHTML = msg;
const closeBtn = document.createElement('span');
closeBtn.innerHTML = "×";
closeBtn.style.cssText = "position: absolute; top: 8px; right: 12px; font-size: 20px; font-weight: normal; cursor: pointer; opacity: 0.6; line-height: 1;";
closeBtn.onmouseover = () => closeBtn.style.opacity = '1';
closeBtn.onmouseout = () => closeBtn.style.opacity = '0.6';
closeBtn.onclick = () => {
toast.style.opacity = '0';
toast.style.transform = 'translateX(20px)';
setTimeout(() => { if (toast.parentNode) toast.remove(); }, 300);
};
toast.appendChild(closeBtn);
container.appendChild(toast);
void toast.offsetWidth;
toast.style.opacity = '1';
toast.style.transform = 'translateX(0)';
setTimeout(() => {
toast.style.opacity = '0';
toast.style.transform = 'translateX(20px)';
setTimeout(() => { if (toast.parentNode) toast.remove(); }, 350);
}, 7000);
}
function showToast(book, isDelete = false) {
let container = document.getElementById('book-manager-toast-container');
if (!container) {
container = document.createElement('div');
container.id = 'book-manager-toast-container';
container.style.cssText = "position: fixed; bottom: 120px; left: 50%; transform: translateX(-50%); z-index: 999999; display: flex; flex-direction: column; gap: 10px; pointer-events: none;";
document.body.appendChild(container);
}
const toast = document.createElement('div');
let typeStr = '';
let typeColor = '';
if (isDelete) {
typeStr = '삭제됨';
typeColor = '#adb5bd';
} else if (book.type === 'exclude') {
typeStr = '제외';
typeColor = '#ff6b6b';
} else if (book.type === 'incomplete') {
typeStr = '미완';
typeColor = '#ff922b';
} else if (book.type === 'complete') {
typeStr = '완결';
typeColor = '#4dabf7';
}
let details = [];
if (book.resolution && !isDelete) details.push(book.resolution);
if (book.lastVol && !isDelete) details.push(book.lastVol + '권');
// 누락 정보 추가 로직
if (book.missingVols && book.missingVols.length > 0 && !isDelete) {
details.push('누락:' + book.missingVols.join(','));
}
const detailStr = details.length > 0 ? ' <span style="color:#adb5bd; font-size:12px; font-weight:normal;">(' + details.join(' | ') + ')</span>' : '';
toast.innerHTML = '<span style="color:' + typeColor + '; margin-right:5px;">[' + typeStr + ']</span>' + book.title + detailStr;
toast.style.cssText = "background: rgba(33, 37, 41, 0.95); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: bold; box-shadow: 0 4px 12px rgba(0,0,0,0.2); opacity: 0; transform: translateY(20px); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); white-space: nowrap; text-align: center;";
container.appendChild(toast);
void toast.offsetWidth;
toast.style.opacity = '1';
toast.style.transform = 'translateY(0)';
setTimeout(() => {
toast.style.opacity = '0';
toast.style.transform = 'translateY(-10px)';
setTimeout(() => { if(toast.parentNode) toast.remove(); }, 350);
}, 5000);
}
function getBookTypeForTitle(titleStr) {
if (!isDataLoaded || !titleStr) return null;
let siteBodyOriginal = titleStr.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim();
let siteBodyNoSpace = siteBodyOriginal.replace(/\s+/g, '');
if (exactMatchCache[siteBodyNoSpace]) return exactMatchCache[siteBodyNoSpace].type;
if (similarityCache[siteBodyNoSpace] !== undefined) return similarityCache[siteBodyNoSpace].book ? similarityCache[siteBodyNoSpace].book.type : null;
let book = null;
let maxScore = 0;
for (let i = cachedBookList.length - 1; i >= 0; i--) {
const b = cachedBookList[i];
if (Math.abs(b._regBodyNoSpace.length - siteBodyNoSpace.length) > Math.min(b._regBodyNoSpace.length, siteBodyNoSpace.length) * 2.5) continue;
const score = getSimilarity(b._regBodyOriginal, siteBodyOriginal);
if (score >= 85 && score > maxScore) {
maxScore = score; book = b;
if (score === 100) break;
}
}
similarityCache[siteBodyNoSpace] = { book, maxScore };
return book ? book.type : null;
}
function injectDirectDownloadButtons(allowedDLs) {
if (!allowedDLs || allowedDLs.length === 0) return;
let regexParts = [];
if (allowedDLs.includes('giga')) regexParts.push('gigafile\\.nu|xgf\\.nu');
if (allowedDLs.includes('gofile')) regexParts.push('gofile\\.io');
if (allowedDLs.includes('hk')) regexParts.push('hellkdis\\.net\\/s\\/|hellkaiv\\.net\\/s\\/');
if (allowedDLs.includes('transfer')) regexParts.push('transfer\\.it\\/s\\/|transfer\\.it\\/t\\/');
if (regexParts.length === 0) return;
let regexStr = "(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?(?:";
regexStr += regexParts.join('|');
regexStr += ")[^\\s\"'<>]+)";
const targetRegex = new RegExp(regexStr, "i");
function extractTargetBookTitle(element) {
let hasTranslation = false;
if (typeof globalDetailSelector !== 'undefined' && globalDetailSelector) {
const detailEl = document.querySelector(globalDetailSelector);
if (detailEl) {
const temp = document.createElement('div');
temp.innerHTML = detailEl.innerHTML.replace(/<img[^>]*>/gi, '');
temp.querySelectorAll('.bm-quick-actions, .book-badge, button, .auto-dl-btn').forEach(e => e.remove());
let rawText = temp.textContent;
if (rawText.includes('번역')) hasTranslation = true;
let title = cleanSiteTitle(rawText);
let skip = false;
if (!title || title.length < 1) skip = true;
else if (!isSupportSingleCharEnabled && title.length < 2) skip = true;
else if (isSupportSingleCharEnabled && title.length === 1 && /^[a-zA-Z0-9]$/.test(title)) skip = true;
if (!skip) return { title: title, hasTranslation: hasTranslation };
}
}
let container = element.closest('.bsx-body, tr, li, td, .list-item, div.item, .bo_v_atc') || element.parentElement;
if (container) {
const temp = document.createElement('div');
temp.innerHTML = container.innerHTML.replace(/<img[^>]*>/gi, '');
temp.querySelectorAll('.bm-quick-actions, .book-badge, .auto-dl-btn, button, .count').forEach(e => e.remove());
let rawText = temp.textContent.replace(/탭열기|다운로드\s*링크\s*발급|복사|제외|미완|완결|삭제|검색/gi, ' ').replace(/\s+/g, ' ').trim();
if (rawText.includes('번역')) hasTranslation = true;
let title = cleanSiteTitle(rawText);
let skip = false;
if (!title || title.length < 1) skip = true;
else if (!isSupportSingleCharEnabled && title.length < 2) skip = true;
else if (isSupportSingleCharEnabled && title.length === 1 && /^[a-zA-Z0-9]$/.test(title)) skip = true;
if (!skip) return { title: title, hasTranslation: hasTranslation };
}
let pageTitle = document.title.split(/[-|]/)[0];
if (pageTitle.includes('번역')) hasTranslation = true;
return { title: cleanSiteTitle(pageTitle) || "알수없는제목", hasTranslation: hasTranslation };
}
function extractPassword(element) {
let targets = [
element,
element.parentElement,
element.parentElement ? element.parentElement.parentElement : null,
element.closest('.bsx-body, .list-board, .bo_v_atc, td, tr, div, section')
];
for (let t of targets) {
if (!t) continue;
let text = t.textContent || "";
let match = text.match(/(?:비밀번호|비번|pw|pass|password|암호)[\s:;\|"'\>]*([a-zA-Z0-9]{4,})/i);
if (match) return match[1].trim();
let inputs = Array.from(t.querySelectorAll('input[type="text"], input[type="password"]'));
let urlInputIdx = inputs.findIndex(i => targetRegex.test(i.value));
if (urlInputIdx > -1 && urlInputIdx + 1 < inputs.length) return inputs[urlInputIdx + 1].value.trim();
}
return "";
}
function createButton(insertAfterElement, url, pw, targetType, bookTitle, hasTranslation) {
if (insertAfterElement.nextElementSibling && insertAfterElement.nextElementSibling.classList.contains('auto-dl-btn')) return;
const autoBtn = document.createElement('a');
autoBtn.href = "#";
autoBtn.className = "auto-dl-btn";
let btnText = "⚡ 바로다운로드";
let bgColor = "#17a2b8";
if (targetType === 'HELLKDIS') bgColor = "#6f42c1";
else if (targetType === 'TRANSFERIT') bgColor = "#dc3545";
autoBtn.innerHTML = btnText;
autoBtn.style.cssText = `display:inline-block; padding:3px 10px; margin-left:5px; background-color:${bgColor}; color:white; border-radius:3px; text-decoration:none; font-size:12px; font-weight:bold; cursor:pointer; vertical-align:middle; transition: background 0.2s;`;
autoBtn.onclick = (e) => {
e.preventDefault();
if (targetType === 'HELLKDIS' && !pw) {
showInfoToast("⚠️ 비밀번호 자동 추출 실패. 페이지가 열리면 수동으로 입력해주세요.", true);
try { chrome.runtime.sendMessage({ action: "OPEN_HELLKDIS_WITH_PW", url: url, password: "" }).catch(()=>{}); }
catch(err) { showInfoToast("⚠️ 확장프로그램이 업데이트 되었습니다. 새로고침(F5) 해주세요.", true); }
return;
}
autoBtn.innerHTML = "⏳ 요청 중...";
autoBtn.style.backgroundColor = "#6c757d";
autoBtn.style.pointerEvents = "none";
const platformName = targetType === 'GOFILE' ? 'Gofile' : (targetType === 'HELLKDIS' ? 'Hellkdis' : (targetType === 'TRANSFERIT' ? 'Transfer.it' : 'Gigafile'));
showInfoToast(`🚀 ${platformName} 서버로 직접 다운로드를 요청합니다...`);
try {
let finalTitle = bookTitle;
if (hasTranslation) finalTitle += "(번역)";
let bType = getBookTypeForTitle(bookTitle);
if (bType === 'incomplete') finalTitle = "(미완)" + finalTitle;
chrome.runtime.sendMessage({ action: "DOWNLOAD_" + targetType, url: url, password: pw, title: finalTitle }).catch(()=>{});
} catch (err) {
showInfoToast("⚠️ 확장프로그램이 새로고침 되었습니다. 현재 페이지를 새로고침(F5) 해주세요!", true);
}
setTimeout(() => {
autoBtn.innerHTML = btnText;
autoBtn.style.backgroundColor = bgColor;
autoBtn.style.pointerEvents = "auto";
}, 50000);
};
insertAfterElement.insertAdjacentElement('afterend', autoBtn);
}
document.querySelectorAll('a').forEach(link => {
if (link.nextElementSibling && link.nextElementSibling.classList.contains('auto-dl-btn')) return;
if (link.classList.contains('auto-dl-btn')) return;
if (link.children.length > 2 || link.querySelector('img')) return;
let url = "";
if (link.href && targetRegex.test(link.href)) url = link.href;
else {
let textMatch = (link.textContent || "").match(targetRegex);
if (textMatch) url = textMatch[1];
}
if (url) {
let targetType = "";
let isHk = url.includes('hellkdis.net/s/') || url.includes('hellkaiv.net/s/');
if (allowedDLs.includes('hk') && isHk) targetType = "HELLKDIS";
else if (allowedDLs.includes('gofile') && url.includes('gofile.io')) targetType = "GOFILE";
else if (allowedDLs.includes('giga') && (url.includes('gigafile') || url.includes('xgf'))) targetType = "GIGAFILE";
else if (allowedDLs.includes('transfer') && url.includes('transfer.it')) targetType = "TRANSFERIT";
if(targetType){
let pw = extractPassword(link);
let extracted = extractTargetBookTitle(link);
createButton(link, url, pw, targetType, extracted.title, extracted.hasTranslation);
}
}
});
const specialBtns = Array.from(document.querySelectorAll('a, button, span, div')).filter(el => {
let t = el.textContent.trim();
if (t !== '탭열기' && t !== '다운로드 링크 발급') return false;
let hasInnerMatch = Array.from(el.children).some(child => {
let ct = child.textContent.trim();
return ct === '탭열기' || ct === '다운로드 링크 발급';
});
return !hasInnerMatch;
});
specialBtns.forEach(btn => {
if (btn.nextElementSibling && btn.nextElementSibling.classList.contains('auto-dl-btn')) return;
let container = btn.closest('.bsx-body, tr, li, td, p, div') || btn.parentElement;
if (!container) return;
let url = "";
let allInputs = Array.from(container.querySelectorAll('input'));
let foundInput = allInputs.find(i => targetRegex.test(i.value) || (i.getAttribute('value') && targetRegex.test(i.getAttribute('value'))));
if (foundInput) url = foundInput.value || foundInput.getAttribute('value');
else {
let textMatch = container.textContent.match(targetRegex);
if (textMatch) url = textMatch[1];
}
if (url) {
let targetType = "";
let isHk = url.includes('hellkdis.net/s/') || url.includes('hellkaiv.net/s/');
if (allowedDLs.includes('hk') && isHk) targetType = "HELLKDIS";
else if (allowedDLs.includes('gofile') && url.includes('gofile.io')) targetType = "GOFILE";
else if (allowedDLs.includes('giga') && (url.includes('gigafile') || url.includes('xgf'))) targetType = "GIGAFILE";
else if (allowedDLs.includes('transfer') && url.includes('transfer.it')) targetType = "TRANSFERIT";
if(targetType){
let pw = extractPassword(btn);
let extracted = extractTargetBookTitle(btn);
createButton(btn, url, pw, targetType, extracted.title, extracted.hasTranslation);
}
}
});
}
function removeBadge(link) {
if (link.style.textDecoration || link.querySelector(':scope > .book-badge')) {
link.style.removeProperty("text-decoration");
link.style.removeProperty("color");
link.style.removeProperty("opacity");
link.style.removeProperty("font-weight");
link.style.removeProperty("background-color");
link.style.removeProperty("padding");
link.style.removeProperty("border-radius");
link.removeAttribute("title");
const badge = link.querySelector(':scope > .book-badge');
if (badge) badge.remove();
}
}
// [전면 수정] 상세페이지 누락관리 팝오버 말풍선 디자인 및 애니메이션 적용 로직
let contentVolPopover = null;
function openMissingPopoverContent(targetNoSpace, badgeElement) {
if (!contentVolPopover) {
contentVolPopover = document.createElement('div');
contentVolPopover.id = 'bm-missing-popover';
document.body.appendChild(contentVolPopover);
// 말풍선 삼각형 및 애니메이션 효과를 위한 스타일 동적 주입 (최초 1회)
if (!document.getElementById('bm-popover-style')) {
const style = document.createElement('style');
style.id = 'bm-popover-style';
style.innerHTML = `
@keyframes bmPopIn {
0% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
60% { opacity: 1; transform: translate(-50%, 5px) scale(1.03); }
100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
#bm-missing-popover {
animation: bmPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
transform-origin: top center; /* 푱! 효과 시 기준점을 상단 중앙으로 설정 */
}
/* 말풍선 삼각형 꼬리 - 테두리 부분 */
#bm-missing-popover::after {
content: ''; position: absolute; bottom: 100%; left: 50%;
transform: translateX(-50%); border: 10px solid transparent;
border-bottom-color: #dee2e6; /* 테두리 색상 */
}
/* 말풍선 삼각형 꼬리 - 내부 배경 부분 */
#bm-missing-popover::before {
content: ''; position: absolute; bottom: 100%; left: 50%;
transform: translateX(-50%); border: 9px solid transparent;
border-bottom-color: #fff; /* 내부 배경 색상 */
z-index: 1; /* 테두리보다 위에 배치 */
}
`;
document.head.appendChild(style);
}
document.addEventListener('click', (e) => {
if (contentVolPopover && !contentVolPopover.contains(e.target) && !e.target.closest('button')) {
contentVolPopover.style.display = 'none';
}
});
}
chrome.storage.local.get({ bookList: [] }, (data) => {
const list = data.bookList;
const dbBook = list.find(b => {
const noSpace = b.title.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim().replace(/\s+/g, '');
return noSpace === targetNoSpace;
});
if (!dbBook) {
showInfoToast('도서 데이터가 아직 저장되지 않았습니다. 잠시 후 다시 시도해주세요.', true);
return;
}
const lastVol = parseInt(dbBook.lastVol, 10);
if (isNaN(lastVol) || lastVol <= 0) {
showInfoToast('권수를 먼저 옵션창에서 숫자로 저장한 뒤에 이용해주세요.', true);
return;
}
let missingVols = dbBook.missingVols || [];
contentVolPopover.innerHTML = `
<div style="display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:bold; border-bottom:1px solid #dee2e6; padding-bottom:8px; margin-bottom:8px; color:#333;">
<span style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:180px;">${dbBook.title} (총 ${lastVol}권)</span>
<button id="bmClosePopoverBtn" style="background:transparent; color:#333; padding:0; margin-left:5px; font-size:16px; border:none; cursor:pointer;">✕</button>
</div>
<div style="font-size:11px; color:#6c757d; margin-bottom:8px;">빈틈이 발생한 누락 번호를 클릭하세요.</div>
<div style="display:grid; grid-template-columns:repeat(5, 1fr); gap:5px; max-height:200px; overflow-y:auto; padding-right:4px; box-sizing:border-box;">
${Array.from({length: lastVol}, (_, i) => i + 1).map(v => `
<div class="bm-vol-item ${missingVols.includes(v) ? 'missing' : ''}" data-vol="${v}" style="text-align:center; padding:6px 0; font-size:12px; background:${missingVols.includes(v) ? '#ffe3e3' : '#f8f9fa'}; border:1px solid ${missingVols.includes(v) ? '#ffa8a8' : '#dee2e6'}; border-radius:4px; cursor:pointer; user-select:none; color:${missingVols.includes(v) ? '#e03131' : '#333'}; font-weight:500; transition:all 0.1s; ${missingVols.includes(v) ? 'text-decoration:line-through; opacity:0.8;' : ''}">${v}</div>
`).join('')}
</div>
`;
// 애니메이션이 적용되도록 하기 위해 display:none 상태에서 즉시 스타일 적용 후 block 처리
contentVolPopover.style.cssText = "position:absolute; display:none; background:#fff; border:1px solid #dee2e6; border-radius:10px; padding:15px; box-shadow:0 6px 18px rgba(0,0,0,0.2); z-index:9999999; width:250px; box-sizing:border-box;";
const rect = badgeElement.getBoundingClientRect();
// 버튼의 중앙 하단에 말풍선이 오도록 좌표 계산
const topPos = rect.bottom + window.scrollY + 12; // 삼각형 높이를 고려해 여백 부여
const leftPos = rect.left + (rect.width / 2) + window.scrollX;
contentVolPopover.style.top = `${topPos}px`;
contentVolPopover.style.left = `${leftPos}px`;
contentVolPopover.style.transform = `translateX(-50%)`; // 수평 중앙 정렬 고정
contentVolPopover.style.display = 'block';
document.getElementById('bmClosePopoverBtn').onclick = () => contentVolPopover.style.display = 'none';
contentVolPopover.querySelectorAll('.bm-vol-item').forEach(item => {
item.onclick = (e) => {
const vol = parseInt(e.target.dataset.vol, 10);
if (e.target.classList.contains('missing')) {
e.target.classList.remove('missing');
e.target.style.cssText = "text-align:center; padding:6px 0; font-size:12px; background:#f8f9fa; border:1px solid #dee2e6; border-radius:4px; cursor:pointer; user-select:none; color:#333; font-weight:500; transition:all 0.1s;";
missingVols = missingVols.filter(v => v !== vol);
} else {
e.target.classList.add('missing');
e.target.style.cssText = "text-align:center; padding:6px 0; font-size:12px; background:#ffe3e3; border:1px solid #ffa8a8; border-radius:4px; cursor:pointer; user-select:none; color:#e03131; font-weight:500; transition:all 0.1s; text-decoration:line-through; opacity:0.8;";
missingVols.push(vol);
}
const updatedList = list.map(b => b.id === dbBook.id ? { ...b, missingVols } : b);
chrome.storage.local.set({ bookList: updatedList });
};
});
});
}
function createQuickActions(linkData, hasBook) {
const container = document.createElement('span');
container.className = 'bm-quick-actions';
container.style.cssText = "display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle;";
const btnStyle = "padding: 2px 5px; font-size: 11px; font-weight: bold; border-radius: 4px; cursor: pointer; color: white; border: none; text-decoration: none; line-height: 1.2; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: all 0.2s; flex-shrink: 0;";
const buttons = [
{ label: '복사', color: '#845ef7', action: 'copy' },
{ label: '제외', color: '#ff6b6b', action: 'exclude' },
{ label: '미완', color: '#ff922b', action: 'incomplete' },
{ label: '완결', color: '#4dabf7', action: 'complete' },
{ label: '삭제', color: '#868e96', action: 'delete', display: hasBook },
{ label: '누락관리', color: '#f06595', action: 'missing_vol', display: hasBook },
{ label: '구글검색', color: '#20c997', action: 'search' },
{ label: '리디검색', color: '#1e90ff', action: 'ridi_preview' },
{ label: '에브리띵검색', color: '#495057', action: 'everything_search', display: true }
];
buttons.forEach(btnInfo => {
if (btnInfo.display === false) return;
const btn = document.createElement('button');
btn.textContent = btnInfo.label;
btn.style.cssText = btnStyle + `background-color: ${btnInfo.color};`;
btn.onmouseover = () => btn.style.transform = 'translateY(-1px)';
btn.onmouseout = () => btn.style.transform = 'translateY(0)';
btn.onclick = (e) => {
e.preventDefault();
e.stopPropagation();
try {
if (btnInfo.action === 'copy') {
const titleToCopy = linkData.pureTitle || (typeof cleanSiteTitle === 'function' ? cleanSiteTitle(linkData.originalText) : linkData.originalText);
navigator.clipboard.writeText(titleToCopy).then(() => {
const originalText = btn.textContent;
const originalColor = btn.style.backgroundColor;
btn.textContent = '복사됨!';
btn.style.backgroundColor = '#20c997';
setTimeout(() => {
btn.textContent = originalText;
btn.style.backgroundColor = originalColor;
}, 1500);
});
return;
}
if (btnInfo.action === 'everything_search') {
if (!isEverythingEnabled) {
showInfoToast("⚠️ [사이트 및 설정] 탭에서 '에브리띵 연결' 옵션을 먼저 체크해주세요.", true);
return;
}
const cleanTitle = typeof cleanSiteTitle === 'function' ? cleanSiteTitle(linkData.originalText) : linkData.originalText;
let iframe = document.getElementById('bm-everything-iframe');
if (!iframe) {
iframe = document.createElement('iframe');
iframe.id = 'bm-everything-iframe';
iframe.style.display = 'none';
document.body.appendChild(iframe);
}
iframe.src = "es:" + encodeURIComponent(cleanTitle);
return;
}
if (btnInfo.action === 'missing_vol') {
const pureCleanTitle = typeof cleanSiteTitle === 'function' ? cleanSiteTitle(linkData.originalText) : linkData.originalText;
const targetNoSpace = pureCleanTitle.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim().replace(/\s+/g, '');
openMissingPopoverContent(targetNoSpace, btn);
return;
}
if (btnInfo.action === 'search' || btnInfo.action === 'ridi_preview' || btnInfo.action === 'everything_search') {
if (btnInfo.action === 'ridi_preview') {
const originalText = btn.textContent;
btn.textContent = '⏳';
btn.style.pointerEvents = 'none';
setTimeout(() => {
btn.textContent = originalText;
btn.style.pointerEvents = 'auto';
}, 2500);
}
chrome.runtime.sendMessage({
action: "QUICK_ACTION",
type: btnInfo.action,
cleanTitle: typeof cleanSiteTitle === 'function' ? cleanSiteTitle(linkData.originalText) : linkData.originalText
}).catch(()=>{});
} else {
// [낙관적 UI] 삭제 포함 즉시 캐시 갱신
const pureCleanTitle = typeof cleanSiteTitle === 'function' ? cleanSiteTitle(linkData.originalText) : linkData.originalText;
const targetNoSpace = pureCleanTitle.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim().replace(/\s+/g, '');
if (btnInfo.action === 'delete') {
if (exactMatchCache[targetNoSpace]) delete exactMatchCache[targetNoSpace];
cachedBookList = cachedBookList.filter(b => b._regBodyNoSpace !== targetNoSpace);
} else {
if (exactMatchCache[targetNoSpace]) {
exactMatchCache[targetNoSpace].type = btnInfo.action;
} else {
let found = false;
for (let i = 0; i < cachedBookList.length; i++) {
if (cachedBookList[i]._regBodyNoSpace === targetNoSpace) {
cachedBookList[i].type = btnInfo.action;
found = true;
break;
}
}
if (!found) {
const newBook = {
title: pureCleanTitle, type: btnInfo.action,
resolution: linkData.siteRes ? linkData.siteRes + "px" : "",
lastVol: linkData.siteVol ? linkData.siteVol.toString() : "",
_regBodyOriginal: pureCleanTitle.replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\sぁ-んァ-ヶー一-龥]/g, '').toLowerCase().trim(),
_regBodyNoSpace: targetNoSpace
};
cachedBookList.push(newBook);
exactMatchCache[targetNoSpace] = newBook;
}
}
}
similarityCache[targetNoSpace] = undefined;
document.querySelectorAll(globalTargetSelector).forEach(el => {
if(el.tagName === 'A' && el._bmData) el._bmData.raw = null;
else if (el.querySelectorAll) {
el.querySelectorAll('a').forEach(a => { if(a._bmData) a._bmData.raw = null; });
}
});
if (globalDetailSelector) {
document.querySelectorAll(globalDetailSelector).forEach(el => {
if (el._bmDetailData) el._bmDetailData.raw = null;
});
}
debouncedApplyStyles();
chrome.runtime.sendMessage({
action: "QUICK_ACTION",
type: btnInfo.action,
cleanTitle: pureCleanTitle,
resolution: linkData.siteRes ? linkData.siteRes + "px" : "",
lastVol: linkData.siteVol ? linkData.siteVol.toString() : ""
}).catch(()=>{});