-
Notifications
You must be signed in to change notification settings - Fork 5
/
SBSE.js
5609 lines (5050 loc) · 189 KB
/
SBSE.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
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
// ==UserScript==
// @name Steam Bundle Sites Extension
// @homepage https://github.com/clancy-chao/Steam-Bundle-Sites-Extension
// @namespace http://tampermonkey.net/
// @version 2.16.6
// @updateURL https://github.com/clancy-chao/Steam-Bundle-Sites-Extension/raw/master/SBSE.meta.js
// @downloadURL https://github.com/clancy-chao/Steam-Bundle-Sites-Extension/raw/master/SBSE.user.js
// @description A steam bundle sites' tool kits.
// @icon http://store.steampowered.com/favicon.ico
// @author Bisumaruko, Cloud
// @include http*://store.steampowered.com/*
// @include https://www.indiegala.com/gift*
// @include https://www.indiegala.com/profile*
// @include https://www.indiegala.com/library*
// @include https://www.indiegala.com/game*
// @include https://www.fanatical.com/*
// @include https://www.humblebundle.com/*
// @include http*://*dailyindiegame.com/*
// @include http*://www.ccyyshop.com/order/*
// @include https://groupees.com/purchases
// @include https://groupees.com/profile/purchases/*
// @include http*://*agiso.com/*
// @include https://steamdb.keylol.com/tooltip*
// @include https://yuplay.ru/orders/*/
// @include https://yuplay.ru/product/*/
// @include http*://gama-gama.ru/personal/settings/*
// @include http*://*plati.ru/seller/*
// @include http*://*plati.market/seller/*
// @include http*://*plati.ru/cat/*
// @include http*://*plati.market/cat/*
// @exclude http*://store.steampowered.com/widget/*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.18.0/sweetalert2.min.js
// @resource sweetalert2CSS https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.18.0/sweetalert2.min.css
// @resource currencyFlags https://cdnjs.cloudflare.com/ajax/libs/currency-flags/1.5.0/currency-flags.min.css
// @resource flagIcon https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css
// @connect store.steampowered.com
// @connect www.google.com
// @connect www.google.com.tw
// @connect www.google.com.au
// @connect www.google.co.jp
// @connect www.google.co.nz
// @connect www.google.co.uk
// @connect www.google.ca
// @connect www.google.de
// @connect www.google.it
// @connect www.google.fr
// @connect www.ecb.europa.eu
// @connect steamdb.keylol.com
// @connect steamdb.info
// @connect steamspy.com
// @connect github.com
// @connect localhost
// @connect 127.0.0.1
// @connect *
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==
/* global swal */
// inject external css styles
GM_addStyle(GM_getResourceText('sweetalert2CSS'));
GM_addStyle(GM_getResourceText('currencyFlags'));
GM_addStyle(GM_getResourceText('flagIcon').replace(/\.\.\//g, 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/'));
// inject script css styles
GM_addStyle(`
pre.SBSE-errorMsg { height: 200px; text-align: left; white-space: pre-wrap; }
a.SBSE-link-steam_store, a.SBSE-link-steam_db { text-decoration: none; font-size: smaller; }
a.SBSE-link-steam_store:hover, a.SBSE-link-steam_db:hover { text-decoration: none; }
/* switch */
.SBSE-switch { position: relative; display: inline-block; width: 60px; height: 30px; }
.SBSE-switch input { display: none; }
.SBSE-switch__slider {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
background-color: #CCC;
transition: 0.4s;
cursor: pointer;
}
.SBSE-switch__slider:before {
width: 26px; height: 26px;
position: absolute;
bottom: 2px; left: 2px;
background-color: white;
transition: 0.4s;
content: "";
}
.SBSE-switch input:checked + .SBSE-switch__slider { background-color: #2196F3; }
.SBSE-switch input:focus + .SBSE-switch__slider { box-shadow: 0 0 1px #2196F3; }
.SBSE-switch input:checked + .SBSE-switch__slider:before { transform: translateX(30px); }
.SBSE-switch--small { width: 40px; height: 20px; }
.SBSE-switch--small .SBSE-switch__slider:before { width: 16px; height: 16px; }
.SBSE-switch--small input:checked + .SBSE-switch__slider:before { transform: translateX(20px); }
/* dropdown */
.SBSE-dropdown { display: inline-block; position: relative; }
.SBSE-dropdown__list {
width: calc(100% - 10px);
max-height: 0;
display: inline-block;
position: absolute;
top: 35px; left: 0;
padding: 0;
transition: all 0.15s;
overflow: hidden;
list-style-type: none;
background-color: #EEE;
box-shadow: 1px 2px 3px rgba(0,0,0,0.45);
z-index: 999;
}
.SBSE-dropdown__list > li { width: 100%; display: block; padding: 3px 0; text-align: center; }
.SBSE-dropdown:hover > .SBSE-dropdown__list { max-height: 500px; }
/* grid */
.SBSE-grid { display: flex; flex-wrap: wrap; }
.SBSE-grid > span {
display: inline-block;
margin: 2px 10px;
padding: 0 5px;
border-radius: 5px;
cursor: pointer;
}
.SBSE-grid > .separator {
display: block;
width: 100%;
margin-top: 12px;
text-align: left;
font-weight: bold;
cursor: default;
}
.SBSE-grid > span.selected { background-color: antiquewhite; }
/* settings */
.SBSE-container__content__model[data-feature="setting"] .name { text-align: right; vertical-align: top; }
.SBSE-container__content__model[data-feature="setting"] .value { text-align: left; }
.SBSE-container__content__model[data-feature="setting"] .value > * { height: 30px; margin: 0 20px 10px; }
.SBSE-container__content__model[data-feature="setting"] > span { display: inline-block; color: white; cursor: pointer; }
/* container */
.SBSE-container { width: 100%; }
.SBSE-container__nav > ul { display: flex; margin: 0; padding: 0; list-style: none; }
.SBSE-container__nav__item { flex: 1 1 auto; text-align: center; cursor: pointer; }
.SBSE-container__nav__item--show { border-bottom: 1px solid #29B6F6; color: #29B6F6; }
.SBSE-container__nav__item > span { display: block; padding: 10px; }
.SBSE-container__content__model {
width: 100%; height: 200px;
display: flex;
margin-top: 10px;
flex-direction: column;
box-sizing: border-box;
}
.SBSE-container__content__model { display: none; }
.SBSE-container__content__model[data-feature="setting"] { height: 100%; display: block; }
.SBSE-container__content__model--show { display: block; }
.SBSE-container__content__model > textarea {
width: 100%; height: 150px;
padding: 5px;
border: none;
box-sizing: border-box;
resize: none;
outline: none;
}
.SBSE-container__content__model > div { width: 100%; padding-top: 5px; box-sizing: border-box; }
.SBSE-button {
width: 120px;
position: relative;
margin-right: 10px;
line-height: 28px;
transition: all 0.5s;
box-sizing: border-box;
outline: none;
cursor: pointer;
}
.SBSE-select { max-width:120px; height: 30px; }
.SBSE-container label { margin-right: 10px; }
.SBSE-dropdown__list-export a { text-decoration: none; color: #333; transition: color 0.3s ease; }
.SBSE-dropdown__list-export a:hover { text-decoration: none; color: #787878; }
.SBSE-button-setting {
width: 20px; height: 20px;
float: right;
margin-top: 3px; margin-right: 0; margin-left: 10px;
background-color: transparent;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGhlaWdodD0iMzJweCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzIgMzI7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMycHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxnIGlkPSJMYXllcl8xIi8+PGcgaWQ9ImNvZyI+PHBhdGggZD0iTTMyLDE3Ljk2OXYtNGwtNC43ODEtMS45OTJjLTAuMTMzLTAuMzc1LTAuMjczLTAuNzM4LTAuNDQ1LTEuMDk0bDEuOTMtNC44MDVMMjUuODc1LDMuMjUgICBsLTQuNzYyLDEuOTYxYy0wLjM2My0wLjE3Ni0wLjczNC0wLjMyNC0xLjExNy0wLjQ2MUwxNy45NjksMGgtNGwtMS45NzcsNC43MzRjLTAuMzk4LDAuMTQxLTAuNzgxLDAuMjg5LTEuMTYsMC40NjlsLTQuNzU0LTEuOTEgICBMMy4yNSw2LjEyMWwxLjkzOCw0LjcxMUM1LDExLjIxOSw0Ljg0OCwxMS42MTMsNC43MDMsMTIuMDJMMCwxNC4wMzF2NGw0LjcwNywxLjk2MWMwLjE0NSwwLjQwNiwwLjMwMSwwLjgwMSwwLjQ4OCwxLjE4OCAgIGwtMS45MDIsNC43NDJsMi44MjgsMi44MjhsNC43MjMtMS45NDVjMC4zNzksMC4xOCwwLjc2NiwwLjMyNCwxLjE2NCwwLjQ2MUwxNC4wMzEsMzJoNGwxLjk4LTQuNzU4ICAgYzAuMzc5LTAuMTQxLDAuNzU0LTAuMjg5LDEuMTEzLTAuNDYxbDQuNzk3LDEuOTIybDIuODI4LTIuODI4bC0xLjk2OS00Ljc3M2MwLjE2OC0wLjM1OSwwLjMwNS0wLjcyMywwLjQzOC0xLjA5NEwzMiwxNy45Njl6ICAgIE0xNS45NjksMjJjLTMuMzEyLDAtNi0yLjY4OC02LTZzMi42ODgtNiw2LTZzNiwyLjY4OCw2LDZTMTkuMjgxLDIyLDE1Ljk2OSwyMnoiIHN0eWxlPSJmaWxsOiM0RTRFNTA7Ii8+PC9nPjwvc3ZnPg==);
background-size: contain;
background-repeat: no-repeat;
background-origin: border-box;
border: none;
vertical-align: top;
cursor: pointer;
}
/* terminal */
.SBSE-terminal {
height: 150px;
display: none;
margin: 0;
padding: 0;
background-color: #000;
}
.SBSE-terminal--show { display: block; }
.SBSE-terminal > div {
max-height: 100%;
display: flex;
flex-direction: column;
overflow: auto;
background-color: transparent;
}
.SBSE-terminal > div > span {
display: inline-block;
padding-left: 20px;
color: #FFF;
text-indent: -20px;
}
.SBSE-terminal > div > span:before {
content: '>';
width: 20px;
display: inline-block;
text-align: center;
text-indent: 0;
}
.SBSE-terminal__message {}
.SBSE-terminal__input {
width: 100%;
position: relative;
order: 9999;
box-sizing: border-box;
}
.SBSE-terminal__input > input {
width: inherit;
max-width: calc(100% - 30px);
position: absolute;
top: 0; right: 0; bottom: 0; left: 20px;
padding: 0;
border: none;
outline: none;
background-color: transparent;
color: #FFF;
}
.SBSE-terminal__input > input:first-child { z-index: 9; }
.SBSE-terminal__input > input:last-child { z-index: 3; color: gray; }
/* spinner button affect */
.SBSE-button:before {
width: 20px; height: 20px;
content: '';
position: absolute;
margin-top: 5px;
right: 10px;
border: 3px solid;
border-left-color: transparent;
border-radius: 50%;
box-sizing: border-box;
opacity: 0;
transition: opacity 0.5s;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-name: rotate;
animation-timing-function: linear;
}
.SBSE-button.SBSE-button--narrow.SBSE-button--working {
width: 100px;
padding-right: 40px;
transition: all 0.5s;
}
.SBSE-button.SBSE-button--working:before {
transition-delay: 0.5s;
transition-duration: 1s;
opacity: 1;
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* types */
.SBSE-type {
height: 20px;
display: none;
margin-right: 5px;
justify-content: center;
}
.SBSE-type:before, .SBSE-type:after {
content: '';
box-sizing: border-box;
pointer-events: none;
}
.SBSE-type:after { padding: 0 2px; }
.SBSE-item--game .SBSE-type { background-color: rgba(97,100,101,0.3); }
.SBSE-item--game .SBSE-type:after { content: 'Game'; }
.SBSE-item--DLC .SBSE-type { background-color: rgba(165,84,177,0.8); }
.SBSE-item--DLC .SBSE-type:before {
content: 'ꜜ';
width: 14px; height: 14px;
margin: 3px 0 0 2px;
border-radius: 50%;
background-color: #000;
color: rgba(165,84,177,0.8);
text-align: center;
font-size: 28px;
line-height: 28px;
}
.SBSE-item--DLC .SBSE-type:after { content: 'DLC'; }
.SBSE-item--package .SBSE-type { background-color: rgba(47,137,188,0.8); }
.SBSE-item--package .SBSE-type:after { content: 'Package'; }
.SBSE-item--steam .SBSE-type { display: flex; }
/* icons */
.SBSE-icon {
width: 20px; height: 20px;
display: none;
margin-left: 5px;
border-radius: 50%;
background-color: #E87A90;
transform: rotate(45deg);
}
.SBSE-icon:before, .SBSE-icon:after {
content: '';
width: 3px; height: 14px;
position: absolute;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
background-color: white;
border-radius: 5px;
pointer-events: none;
}
.SBSE-icon:after { transform: translate(-50%, -50%) rotate(-90deg); }
.SBSE-item--owned .SBSE-icon { background-color: #9CCC65; }
.SBSE-item--owned .SBSE-icon:before, .SBSE-item--owned .SBSE-icon:after { transform: none; }
.SBSE-item--owned .SBSE-icon:before {
width: 3px; height: 11px;
top: 4px; left: 10px;
border-radius: 5px 5px 5px 0;
}
.SBSE-item--owned .SBSE-icon:after {
width: 5px; height: 3px;
top: 12px; left: 6px;
border-radius: 5px 0 0 5px;
}
.SBSE-item--wished .SBSE-icon { transform: rotate(0); background-color: #29B6F6; }
.SBSE-item--wished .SBSE-icon:before, .SBSE-item--wished .SBSE-icon:after {
width: 6px; height: 10px;
top: 5px; left: 10px;
border-radius: 6px 6px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.SBSE-item--wished .SBSE-icon:after {
left: 4px;
transform: rotate(45deg);
transform-origin :100% 100%;
}
.SBSE-item--ignored .SBSE-icon { background-color: rgb(135, 173, 189); }
.SBSE-item--notApplicable .SBSE-icon { transform: rotate(0); background-color: rgb(248, 187, 134); }
.SBSE-item--notApplicable .SBSE-icon:before {
content: '?';
width: 0; height: 10px;
top: 5px; left: 7px;
color: white;
font-size: 16px; font-weight: 900;
}
.SBSE-item--notApplicable .SBSE-icon:after { display: none; }
.SBSE-item--fetching .SBSE-icon { transform: rotate(0); background-color: transparent; }
.SBSE-item--fetching .SBSE-icon:before {
width: 20px; height: 20px;
top: 0; left: 0;
border: 3px solid grey;
border-left-color: transparent;
border-radius: 50%;
box-sizing: border-box;
transition: opacity 0.5s;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-name: rotate;
animation-timing-function: linear;
}
.SBSE-item--fetching .SBSE-icon:after { display: none; }
.SBSE-item--notFetched .SBSE-icon { background-color: transparent; }
.SBSE-item--notFetched .SBSE-icon:before, .SBSE-item--notFetched .SBSE-icon:after { display: none; }
.SBSE-item--failed .SBSE-icon { transform: rotate(0); }
.SBSE-item--failed .SBSE-icon:before {
content: '!';
width: 0; height: 10px;
top: 5px; left: 8.5px;
color: white;
font-size: 16px; font-weight: 900;
}
.SBSE-item--failed .SBSE-icon:after { display: none; }
.SBSE-item--steam .SBSE-icon { display: inline-block; }
/* Steam Tooltip */
.SBSE-tooltip {
width: 308px;
display: none;
position: fixed;
overflow: hidden;
background: url(https://steamstore-a.akamaihd.net/public/images/v6/blue_body_darker_repeat.jpg) -700px center repeat-y scroll rgb(0, 0, 0);
border: 0;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
transition: all 0.5s;
z-index: 999;
}
.SBSE-tooltip--show{ display: block; }
/* Tooltip */
[tooltip]::before, [tooltip]::after {
position: absolute;
opacity: 0;
transition: all 0.15s ease;
}
[tooltip]::before {
width: max-content;
content: attr(tooltip);
top: calc(100% + 10px); left: 0;
padding: 10px;
color: #4a4c45;
background-color: white;
border-radius: 3px;
box-shadow: 1px 2px 3px rgba(0,0,0,0.45);
}
[tooltip]::after {
content: "";
top: calc(100% + 5px); left: 10px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid white;
}
[tooltip]:hover::before, [tooltip]:hover::after { opacity: 1; }
[tooltip]:not([tooltip-persistent])::before, [tooltip]:not([tooltip-persistent])::after { pointer-events: none; }
`);
// load up
const regURL = /(https?:\/\/)?([.\w]*steam[-.\w]*){1}\/.*?(apps?|subs?){1}\/(\d+){1}(\/.*\/?)?/m;
const regKey = /(?:(?:([A-Z0-9])(?!\1{4})){5}-){2,5}[A-Z0-9]{5}/g;
const eol = "\n";
const tab = "\t";
const has = Object.prototype.hasOwnProperty;
const forEachAsync = (array, callback, lastIterationCallback) => {
if (!Array.isArray(array)) throw Error('Not an array');
if (typeof callback !== 'function') throw Error('Not an function');
const iterators = [...array.keys()];
const processor = (taskStartTime) => {
let taskFinishTime;
do {
const iterator = iterators.shift();
if (iterator in array) callback(array[iterator], iterator, array);
taskFinishTime = window.performance.now();
} while (taskFinishTime - taskStartTime < 1000 / 60);
if (iterators.length > 0) requestAnimationFrame(processor);
// finished iterating array
else if (typeof lastIterationCallback === 'function') lastIterationCallback();
};
requestAnimationFrame(processor);
};
const unique = a => [...new Set(a)];
const isArray = value => Array.isArray(value);
const isObject = value => Object(value) === value;
const request = options => new Promise((resolve, reject) => {
options.onerror = reject;
options.ontimeout = reject;
options.onload = resolve;
GM_xmlhttpRequest(options);
});
// setup jQuery
const $ = jQuery.noConflict(true);
$.fn.pop = [].pop;
$.fn.shift = [].shift;
$.fn.eachAsync = function eachAsync(callback, lastIterationCallback) {
forEachAsync(this.get(), callback, lastIterationCallback);
};
const config = {
data: JSON.parse(GM_getValue('SBSE_config', '{}')),
set(key, value, callback) {
this.data[key] = value;
GM_setValue('SBSE_config', JSON.stringify(this.data));
if (typeof callback === 'function') callback();
},
get(key) {
return has.call(this.data, key) ? this.data[key] : null;
},
init() {
if (!has.call(this.data, 'autoUpdateSessionID')) this.data.autoUpdateSessionID = true;
if (!has.call(this.data, 'autoSyncLibrary')) this.data.autoSyncLibrary = true;
if (!has.call(this.data, 'ASFFormat')) this.data.ASFFormat = false;
if (!has.call(this.data, 'titleComesLast')) this.data.titleComesLast = false;
if (!has.call(this.data, 'activateAllKeys')) this.data.activateAllKeys = false;
if (!has.call(this.data, 'enableTooltips')) this.data.enableTooltips = this.get('language') !== 'english';
if (!has.call(this.data, 'highlightedRegions')) this.data.highlightedRegions = ['CN', 'HK', 'TW'];
if (!has.call(this.data, 'enableASFIPC')) this.data.enableASFIPC = false;
if (!has.call(this.data, 'ASFWSProtocol')) this.data.ASFWSProtocol = 'ws';
if (!has.call(this.data, 'ASFIPCProtocol')) this.data.ASFIPCProtocol = 'http';
if (!has.call(this.data, 'ASFIPCServer')) this.data.ASFIPCServer = '127.0.0.1';
if (!has.call(this.data, 'ASFIPCPort')) this.data.ASFIPCPort = 1242;
if (!has.call(this.data, 'ASFIPCPassword')) this.data.ASFIPCPassword = '';
},
};
const i18n = {
data: {
tchinese: {
name: '正體中文',
updateSuccessTitle: '更新成功!',
updateSuccess: '成功更新Steam sessionID',
successStatus: '成功',
successTitle: '好極了!',
successDetail: '無資料',
skippedStatus: '跳過',
activatedDetail: '已啟動',
loadingSuccess: '加載完成!',
failStatus: '失敗',
failTitle: '糟糕!',
failDetailUnexpected: '發生未知錯誤,請稍後再試',
failDetailInvalidKey: '序號錯誤',
failDetailUsedKey: '序號已被使用',
failDetailRateLimited: '啟動受限',
failDetailCountryRestricted: '地區限制',
failDetailAlreadyOwned: '產品已擁有',
failDetailMissingBaseGame: '未擁有主程式',
failDetailPS3Required: '需要PS3 啟動',
failDetailGiftWallet: '偵測到禮物卡/錢包序號',
failDetailParsingFailed: '處理資料發生錯誤,請稍後再試',
failDetailRequestFailedNeedUpdate: '請求發生錯誤,請稍後再試<br/>或者嘗試更新SessionID',
noItemDetails: '無產品詳細資料',
notLoggedInTitle: '未登入',
notLoggedInMsg: '請登入Steam 以讓腳本紀錄SessionID',
missingTitle: '未發現SessionID',
missingMsg: '請問要更新SessionID 嗎?',
emptyInput: '未發現Steam 序號',
settingsTitle: '設定',
settingsAutoUpdateSessionID: '自動更新SessionID',
settingsSessionID: '我的SessionID',
settingsAutoSyncLibrary: '自動同步Steam 遊戲庫',
settingsSyncLibrary: '同步遊戲庫',
settingsSyncLibraryButton: '同步',
settingsLanguage: '語言',
settingsASFFormat: '啟用ASF 格式',
settingsTitleComesLast: '遊戲名置後',
settingsActivateAllKeys: '不跳過、啟動所有序號',
settingsEnableTooltips: 'Keylol 論壇提示框',
settingshighlightedRegions: '標示出地區',
settingshighlightedRegionsButton: '選擇地區',
settingsEnableASFIPC: '啟用ASF IPC',
settingsASFWSProtocol: 'ASF WS 傳輸協定',
settingsASFIPCProtocol: 'ASF IPC 傳輸協定',
settingsASFIPCServer: 'ASF IPC IP位址',
settingsASFIPCPort: 'ASF IPC 連接埠',
settingsASFIPCPassword: 'ASF IPC 密碼',
settingsReportIssues: '回報問題/新功能請求',
HBAlreadyOwned: '遊戲已擁有',
HBRedeemAlreadyOwned: '確定刮開 %title% Steam 序號?',
steamStore: 'Steam 商店',
HBActivationRestrictions: '啟動限制',
HBDisallowedCountries: '限制以下地區啟動',
HBExclusiveCountries: '僅限以下地區啟動',
HBCurrentLocation: '當前位於:',
DIGMenuPurchase: '購買',
DIGMenuSelectAll: '全選',
DIGMenuSelectCancel: '取消',
DIGButtonPurchasing: '購買中',
DIGInsufficientFund: '餘額不足',
DIGFinishedPurchasing: '購買完成',
DIGMarketSearchResult: '目前市集上架中',
DIGRateAllPositive: '全部好評',
DIGClickToHideThisRow: '隱藏此上架遊戲',
DIGCurrentBalance: '當前餘額:',
DIGEditBalance: '更新DIG 錢包餘額',
DIGPoint: 'DIG 點數',
DIGTotalAmount: '購買總額:',
buttonReveal: '刮開',
buttonRetrieve: '提取',
buttonActivate: '啟動',
buttonCopy: '複製',
buttonReset: '清空',
buttonExport: '匯出',
buttonCommands: '指令',
buttonLog: '日誌',
checkboxIncludeGameTitle: '遊戲名',
checkboxJoinKeys: '合併',
checkboxSkipUsed: '跳過已使用',
checkboxMarketListings: '上架於市集',
selectFilterAll: '選取全部',
selectFilterOwned: '選取已擁有',
selectFilterNotOwned: '選取未擁有',
selectConnector: '至',
markAllAsUsed: '標記全部已使用',
syncSuccessTitle: '同步成功',
syncSuccess: '成功同步Steam 遊戲庫資料',
syncFailTitle: '同步失敗',
syncFail: '失敗同步Steam 遊戲庫資料',
visitSteam: '前往Steam',
lastSyncTime: '已於%seconds% 秒前同步收藏庫',
game: '遊戲',
dlc: 'DLC',
package: '合集',
bundle: '組合包',
owned: '已擁有',
wished: '於願望清單',
ignored: '已忽略',
notOwned: '未擁有',
notApplicable: '無資料',
notFetched: '未檢查',
enablePlatiFeature: '啟用腳本',
platiFetchOnStart: '自動檢查',
platiInfiniteScroll: '自動換頁',
platiFetchButton: '檢查',
platiFilterType: '顯示類型',
platiFilterStatus: '顯示狀態',
},
schinese: {
name: '简体中文',
updateSuccessTitle: '更新成功',
updateSuccess: '成功更新Steam sessionID',
successStatus: '成功',
successTitle: '好极了!',
successDetail: '无信息',
activatedDetail: '已激活',
loadingSuccess: '加载完成!',
skippedStatus: '跳过',
failStatus: '失败',
failTitle: '糟糕!',
failDetailUnexpected: '发生未知错误,请稍后再试',
failDetailInvalidKey: '激活码错误',
failDetailUsedKey: '激活码已被使用',
failDetailRateLimited: '激活受限',
failDetailCountryRestricted: '地区限制',
failDetailAlreadyOwned: '产品已拥有',
failDetailMissingBaseGame: '未拥有基础游戏',
failDetailPS3Required: '需要PS3 激活',
failDetailGiftWallet: '侦测到礼物卡/钱包激活码',
failDetailParsingFailed: '处理资料发生错误,请稍后再试',
failDetailRequestFailedNeedUpdate: '请求发生错误,请稍后再试<br/>或者尝试更新SessionID',
noItemDetails: '无产品详细信息',
notLoggedInTitle: '未登入',
notLoggedInMsg: '请登入Steam 以让脚本记录SessionID',
missingTitle: '未发现SessionID',
missingMsg: '请问要更新SessionID 吗?',
emptyInput: '未批配到Steam 激活码',
settingsTitle: '设置',
settingsAutoUpdateSessionID: '自动更新SessionID',
settingsSessionID: '我的SessionID',
settingsAutoSyncLibrary: '自动同步Steam 游戏库',
settingsSyncLibrary: '同步游戏库',
settingsSyncLibraryButton: '同步',
settingsLanguage: '语言',
settingsASFFormat: '启用ASF 格式',
settingsTitleComesLast: '游戏名置后',
settingsActivateAllKeys: '不跳过、激活所有激活码',
settingsEnableTooltips: 'Keylol 论坛提示窗',
settingshighlightedRegions: '标示出地区',
settingshighlightedRegionsButton: '选择地区',
settingsEnableASFIPC: '启用ASF IPC',
settingsASFWSProtocol: 'ASF WS 传输协议',
settingsASFIPCProtocol: 'ASF IPC 传输协议',
settingsASFIPCServer: 'ASF IPC IP地址',
settingsASFIPCPort: 'ASF IPC 端口',
settingsASFIPCPassword: 'ASF IPC 密码',
settingsReportIssues: '回报问题/新功能请求',
HBAlreadyOwned: '游戏已拥有',
HBRedeemAlreadyOwned: '确定刮开 %title% Steam 激活码?',
steamStore: 'Steam 商店',
HBActivationRestrictions: '激活限制',
HBDisallowedCountries: '限制以下地区激活',
HBExclusiveCountries: '仅限以下地区激活',
HBCurrentLocation: '当前位于:',
DIGMenuPurchase: '购买',
DIGMenuSelectAll: '全选',
DIGMenuSelectCancel: '取消',
DIGButtonPurchasing: '购买中',
DIGInsufficientFund: '余额不足',
DIGFinishedPurchasing: '购买完成',
DIGMarketSearchResult: '目前市集上架中',
DIGRateAllPositive: '全部好评',
DIGClickToHideThisRow: '隐藏此上架游戏',
DIGCurrentBalance: '当前余额:',
DIGEditBalance: '更新DIG 錢包餘額',
DIGPoint: 'DIG 点数',
DIGTotalAmount: '购买总额:',
buttonReveal: '刮开',
buttonRetrieve: '提取',
buttonActivate: '激活',
buttonCopy: '复制',
buttonReset: '清空',
buttonExport: '导出',
buttonCommands: '指令',
buttonLog: '日志',
checkboxIncludeGameTitle: '游戏名',
checkboxJoinKeys: '合并',
checkboxSkipUsed: '跳过已使用',
checkboxMarketListings: '上架于市集',
selectFilterAll: '选取全部',
selectFilterOwned: '选取已拥有',
selectFilterNotOwned: '选取未拥有',
selectConnector: '至',
markAllAsUsed: '标记全部已使用',
syncSuccessTitle: '同步成功',
syncSuccess: '成功同步Steam 游戏库资料',
syncFailTitle: '同步失败',
syncFail: '失败同步Steam 游戏库资料',
visitSteam: '前往Steam',
lastSyncTime: '已于%seconds% 秒前同步游戏库',
game: '游戏',
dlc: 'DLC',
package: '礼包',
bundle: '捆绑包',
owned: '已拥有',
wished: '于愿望清单',
ignored: '已忽略',
notOwned: '未拥有',
notApplicable: '无资料',
notFetched: '未检查',
enablePlatiFeature: '启用脚本',
platiFetchOnStart: '自动检查',
platiInfiniteScroll: '自动换页',
platiFetchButton: '检查',
platiFilterType: '显示类型',
platiFilterStatus: '显示状态',
},
english: {
name: 'English',
updateSuccessTitle: 'Update Successful!',
updateSuccess: 'Steam sessionID is successfully updated',
successStatus: 'Success',
successTitle: 'Hurray!',
successDetail: 'No Detail',
activatedDetail: 'Activated',
loadingSuccess: 'Loaded',
skippedStatus: 'Skipped',
failStatus: 'Fail',
failTitle: 'Opps!',
failDetailUnexpected: 'Unexpected Error',
failDetailInvalidKey: 'Invalid Key',
failDetailUsedKey: 'Used Key',
failDetailRateLimited: 'Rate Limited',
failDetailCountryRestricted: 'Country Restricted',
failDetailAlreadyOwned: 'Product Already Owned',
failDetailMissingBaseGame: 'Missing Base Game',
failDetailPS3Required: 'PS3 Activation Required',
failDetailGiftWallet: 'Gift Card/Wallet Code Detected',
failDetailParsingFailed: 'Result parse failed',
failDetailRequestFailedNeedUpdate: 'Request failed, please try again<br/>or update sessionID',
noItemDetails: 'No Item Details',
notLoggedInTitle: 'Not Logged-In',
notLoggedInMsg: 'Please login to Steam so sessionID can be saved',
missingTitle: 'Missing SessionID',
missingMsg: 'Do you want to update your Steam sessionID?',
emptyInput: 'Could not find Steam code',
settingsTitle: 'Settings',
settingsAutoUpdateSessionID: 'Auto Update SessionID',
settingsSessionID: 'Your sessionID',
settingsAutoSyncLibrary: 'Auto Sync Library',
settingsSyncLibrary: 'Sync Library',
settingsSyncLibraryButton: 'Sync',
settingsLanguage: 'Language',
settingsASFFormat: 'Enable ASF Format',
settingsTitleComesLast: 'Title Comes Last',
settingsActivateAllKeys: 'No skip & activate all keys',
settingsEnableTooltips: 'Tooltips from Keylol',
settingshighlightedRegions: 'Highlighted Regions',
settingshighlightedRegionsButton: 'Select Regions',
settingsEnableASFIPC: 'Enable ASF IPC',
settingsASFWSProtocol: 'ASF WS Protocol',
settingsASFIPCProtocol: 'ASF IPC Protocol',
settingsASFIPCServer: 'ASF IPC IP Address',
settingsASFIPCPort: 'ASF IPC Port',
settingsASFIPCPassword: 'ASF IPC Password',
settingsReportIssues: 'Report Issues or Request Features',
HBAlreadyOwned: 'Game Already Owned',
HBRedeemAlreadyOwned: 'Are you sure to redeem %title% Steam Key?',
steamStore: 'Steam Store',
HBActivationRestrictions: 'Activation Restrictions',
HBDisallowedCountries: 'Cannot be activated in the following regions',
HBExclusiveCountries: 'Can only be activated in the following regions',
HBCurrentLocation: 'Current Location: ',
DIGMenuPurchase: 'Purchase',
DIGMenuSelectAll: 'Select All',
DIGMenuSelectCancel: 'Cancel',
DIGButtonPurchasing: 'Purchassing',
DIGInsufficientFund: 'Insufficient fund',
DIGFinishedPurchasing: 'Finished Purchasing',
DIGMarketSearchResult: 'Currently listing in marketplace',
DIGRateAllPositive: 'Mark All Positive',
DIGClickToHideThisRow: 'Hide this game from listings',
DIGCurrentBalance: 'Current Balance: ',
DIGEditBalance: 'Edit DIG balance',
DIGPoint: 'DIG Point',
DIGTotalAmount: 'Total Amount: ',
buttonReveal: 'Reveal',
buttonRetrieve: 'Retrieve',
buttonActivate: 'Activate',
buttonCopy: 'Copy',
buttonReset: 'Reset',
buttonExport: 'Export',
buttonCommands: 'Commands',
buttonLog: 'Log',
checkboxIncludeGameTitle: 'Game Title',
checkboxJoinKeys: 'Join',
checkboxSkipUsed: 'Skip Used',
checkboxMarketListings: 'Market Listings',
selectFilterAll: 'Select All',
selectFilterOwned: 'Select Owned',
selectFilterNotOwned: 'Select Not Owned',
selectConnector: 'to',
markAllAsUsed: 'Mark All as Used',
syncSuccessTitle: 'Sync Successful',
syncSuccess: 'Successfully sync Steam library data',
syncFailTitle: 'Sync failed',
syncFail: 'Failed to sync Steam library data',
visitSteam: 'Visit Steam',
lastSyncTime: 'Library data synced %seconds% seconds ago',
game: 'Game',
dlc: 'DLC',
package: 'Package',
bundle: 'Bundle',
owned: 'Owned',
wished: 'Wishlisted',
ignored: 'Ignored',
notOwned: 'Not Owned',
notApplicable: 'Not Applicable',
notFetched: 'Not Checked',
enablePlatiFeature: 'Enable Script',
platiFetchOnStart: 'Auto Check',
platiInfiniteScroll: 'Infinite Scroll',
platiFetchButton: 'Check',
platiFilterType: 'Show Type',
platiFilterStatus: 'Show Status',
},
},
language: null,
set() {
const selectedLanguage = has.call(this.data, config.get('language')) ? config.get('language') : 'english';
this.language = this.data[selectedLanguage];
},
get(key) {
return has.call(this.language, key) ? this.language[key] : this.data.english[key];
},
init() {
this.set();
},
};
const ISO2 = {
name: {
tchinese: {
AD: '安道爾',
AE: '阿拉伯聯合大公國',
AF: '阿富汗',
AG: '安地卡及巴布達',
AI: '安圭拉',
AL: '阿爾巴尼亞',
AM: '亞美尼亞',
AO: '安哥拉',
AQ: '南極洲',
AR: '阿根廷',
AS: '美屬薩摩亞',
AT: '奧地利',
AU: '澳大利亞',
AW: '阿魯巴',
AX: '奧蘭',
AZ: '亞塞拜然',
BA: '波士尼亞與赫塞哥維納',
BB: '巴貝多',
BD: '孟加拉',
BE: '比利時',
BF: '布吉納法索',
BG: '保加利亞',
BH: '巴林',
BI: '蒲隆地',
BJ: '貝南',
BL: '聖巴泰勒米',
BM: '百慕達',
BN: '汶萊',
BO: '玻利維亞',
BQ: '波奈',
BR: '巴西',
BS: '巴哈馬',
BT: '不丹',
BV: '布威島',
BW: '波札那',
BY: '白俄羅斯',
BZ: '貝里斯',
CA: '加拿大',
CC: '科科斯(基林)群島',
CD: '剛果民主共和國',
CF: '中非共和國',
CG: '剛果共和國',
CH: '瑞士',
CI: '象牙海岸',
CK: '庫克群島',
CL: '智利',
CM: '喀麥隆',
CN: '中國',
CO: '哥倫比亞',
CR: '哥斯大黎加',
CS: '塞爾維亞與蒙特內哥羅',
CU: '古巴',
CV: '維德角',
CW: '古拉索',
CX: '聖誕島',
CY: '賽普勒斯',
CZ: '捷克',
DE: '德國',
DJ: '吉布地',
DK: '丹麥',
DM: '多米尼克',
DO: '多明尼加',
DZ: '阿爾及利亞',
EC: '厄瓜多',
EE: '愛沙尼亞',
EG: '埃及',
EH: '西撒哈拉',
ER: '厄利垂亞',
ES: '西班牙',
ET: '衣索比亞',
FI: '芬蘭',
FJ: '斐濟',
FK: '福克蘭群島',
FM: '密克羅尼西亞聯邦',
FO: '法羅群島',
FR: '法國',
GA: '加彭',
GB: '英國',
GD: '格瑞那達',
GE: '喬治亞',
GF: '法屬圭亞那',
GG: '根西',
GH: '迦納',
GI: '直布羅陀',
GL: '格陵蘭',
GM: '甘比亞',
GN: '幾內亞',
GP: '瓜德羅普',
GQ: '赤道幾內亞',
GR: '希臘',
GS: '南喬治亞與南桑威奇',
GT: '瓜地馬拉',
GU: '關島',
GW: '幾內亞比索',
GY: '蓋亞那',
HK: '香港',
HM: '赫德島和麥克唐納群島',
HN: '宏都拉斯',
HR: '克羅埃西亞',
HT: '海地',
HU: '匈牙利',
ID: '印尼',
IE: '愛爾蘭',
IL: '以色列',
IM: '曼島',
IN: '印度',
IO: '英屬印度洋領地',
IQ: '伊拉克',
IR: '伊朗',
IS: '冰島',
IT: '義大利',
JE: '澤西',
JM: '牙買加',
JO: '約旦',
JP: '日本',
KE: '肯亞',
KG: '吉爾吉斯',
KH: '柬埔寨',
KI: '吉里巴斯',
KM: '葛摩',
KN: '聖克里斯多福及尼維斯',
KP: '北韓',
KR: '南韓',
KW: '科威特',
KY: '開曼群島',
KZ: '哈薩克',
LA: '寮國',
LB: '黎巴嫩',
LC: '聖露西亞',
LI: '列支敦斯登',
LK: '斯里蘭卡',
LR: '賴比瑞亞',
LS: '賴索托',
LT: '立陶宛',
LU: '盧森堡',
LV: '拉脫維亞',
LY: '利比亞',
MA: '摩洛哥',
MC: '摩納哥',