-
Notifications
You must be signed in to change notification settings - Fork 10
/
SpookyX.user.js
3813 lines (3692 loc) · 159 KB
/
SpookyX.user.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 SpookyX
// @description Enhances functionality of FoolFuuka boards. Developed further for more comfortable ghost-posting on the moe archives.
// @author Fiddlekins
// @version 32.50
// @namespace https://github.com/Fiddlekins/SpookyX
// @include http://archive.4plebs.org/*
// @include https://archive.4plebs.org/*
// @include http://archive.loveisover.me/*
// @include https://archive.loveisover.me/*
// @include http://archive.nyafuu.org/*
// @include https://archive.nyafuu.org/*
// @include http://desuarchive.org/*
// @include https://desuarchive.org/*
// @include http://cuckchan.org/*
// @include https://cuckchan.org/*
// @include http://4ch.be/*
// @include https://4ch.be/*
// @include http://arch.b4k.co/*
// @include https://arch.b4k.co/*
// @include http://*ch.archive.horse*
// @include https://*ch.archive.horse*
// @include http://boards.fireden.net/*
// @include https://boards.fireden.net/*
// @include http://archived.moe/*
// @include https://archived.moe/*
// @include http://archiveofsins.com/*
// @include https://archiveofsins.com/*
// @include http://thebarchive.com/*
// @include https://thebarchive.com/*
// @include http://archive.whatisthisimnotgoodwithcomputers.com/*
// @include https://archive.whatisthisimnotgoodwithcomputers.com/*
// @include http://magyarchan.net/*
// @include https://magyarchan.net/*
// @include http://www.tokyochronos.net/*
// @include https://www.tokyochronos.net/*
// @require https://cdn.rawgit.com/madapaja/jquery.selection/master/src/jquery.selection.js
// @require https://raw.githubusercontent.com/jquery/jquery-mousewheel/master/jquery.mousewheel.min.js
// @require https://raw.githubusercontent.com/carloscabo/colz/master/public/js/colz.class.min.js
// @grant none
// @updateURL https://github.com/Fiddlekins/SpookyX/raw/master/SpookyX.meta.js
// @downloadURL https://github.com/Fiddlekins/SpookyX/raw/master/SpookyX.user.js
// @icon https://i.imgur.com/LaYyYRl.png
// ==/UserScript==
if (GM_info === undefined) {
var GM_info = {script: {version: '32.50'}};
}
var settings = {
"UserSettings": {
"inlineImages": {
"name": "Inline Images",
"description": "Load full-size images in the thread, enable click to expand",
"type": "checkbox",
"value": true,
"suboptions": {
"inlineVideos": {
"name": "Inline Videos",
"description": "Replace thumbnails of natively posted videos with the videos themselves",
"type": "checkbox",
"value": true,
"suboptions": {
"firefoxCompatibility": {
"name": "Firefox Compatibility Mode",
"description": "Turn this on to allow you to use the controls on an expanded video without collapsing it",
"type": "checkbox",
"value": false
}
}
},
"delayedLoad": {
"name": "Delayed Load",
"description": "Fullsize images are not automatically retrieved and used to replace the thumbnails. Instead this occurs on an individual basis when the thumbnails are clicked on",
"type": "checkbox",
"value": false
},
"imageHover": {
"name": "Image Hover",
"description": "Hovering over images with the mouse brings a full or window scaled version in view",
"type": "checkbox",
"value": true
},
"videoHover": {
"name": "Video Hover",
"description": "Hovering over videos with the mouse brings a full or window scaled version in view",
"type": "checkbox",
"value": true
},
"autoplayGifs": {
"name": "Autoplay embedded gifs",
"description": "Make embedded gifs play automatically",
"type": "checkbox",
"value": true
},
"autoplayVids": {
"name": "Autoplay embedded videos",
"description": "Make embedded videos play automatically (they start muted, expanding unmutes)",
"type": "checkbox",
"value": false
},
"customSize": {
"name": "Custom thumbnail size",
"description": "Specify the thumbnail dimensions",
"type": "checkbox",
"value": false,
"suboptions": {
"widthOP": {
"name": "OP image width",
"description": "The maximum width of OP images in pixels",
"type": "number",
"value": 250
},
"heightOP": {
"name": "OP image height",
"description": "The maximum height of OP images in pixels",
"type": "number",
"value": 250
},
"width": {
"name": "Post image width",
"description": "The maximum width of post images in pixels",
"type": "number",
"value": 125
},
"height": {
"name": "Post image height",
"description": "The maximum height of post images in pixels",
"type": "number",
"value": 125
}
}
},
"processSpoiler": {
"name": "Process spoilered images",
"description": "Make native spoilered images inline",
"type": "checkbox",
"value": true
}
}
},
"embedImages": {
"name": "Embed Media",
"description": "Embed image (and other media) links in thread",
"type": "checkbox",
"value": true,
"suboptions": {
"embedVideos": {
"name": "Embed Videos",
"description": "Embed video links in thread",
"type": "checkbox",
"value": true
},
"imgNumMaster": {
"name": "Embed Count",
"description": "The maximum number of images (or other media) to embed in each post",
"type": "number",
"value": 1
},
"titleYoutubeLinks": {
"name": "Title YouTube links",
"description": "Fetches the video name and alters the link text accordingly",
"type": "checkbox",
"value": true
}
}
},
"autoHost": {
"name": "Automatically Host Images",
"description": "When post is submitted image links will be automatically reuploaded to Imgur in an effort to avoid having dead 4chan image links",
"type": "select",
"value": {
"value": "Reupload 4chan links",
"options": ["Don't reupload links", "Reupload 4chan links", "Reupload all links"]
}
},
"embedGalleries": {
"name": "Embed Galleries",
"description": "Embed Imgur galleries into a single post for ease of image dumps",
"type": "checkbox",
"value": true,
"suboptions": {
"showDetails": {
"name": "Show Details",
"description": "Show the title, image description and view count for embedded Imgur albums",
"type": "checkbox",
"value": true
}
}
},
"gallery": {
"name": "Gallery",
"description": "Pressing G will bring up a view that displays all the images in a thread",
"type": "checkbox",
"value": true
},
"hidePosts": {
"name": "Hide Posts",
"description": "Allow user to hide posts manually",
"type": "checkbox",
"value": true,
"suboptions": {
"recursiveHiding": {
"name": "Recursive Hiding",
"description": "Hide replies to hidden posts",
"type": "checkbox",
"value": true,
"suboptions": {
"hideNewPosts": {
"name": "Hide New Posts",
"description": "Also hide replies to hidden posts that are fetched after page load",
"type": "checkbox",
"value": true
}
}
}
}
},
"newPosts": {
"name": "New Posts",
"description": "Reflect the number of new posts in the tab name",
"type": "checkbox",
"value": true
},
"favicon": {
"name": "Favicon",
"description": "Switch to a dynamic favicon that indicates unread posts and unread replies",
"type": "checkbox",
"value": true,
"suboptions": {
"customFavicons": {
"name": "Custom Favicons",
"description": "If disabled SpookyX will try its hand at automatically generating suitable favicons for the site. Enabling this allows you to manually specify which favicons it should use instead",
"type": "checkbox",
"value": false,
"suboptions": {
"unlit": {
"name": "Unlit",
"description": "Choose which favicon is used normally. Default is \"https://i.imgur.com/xuadeJ2.png\"",
"type": "text",
"value": "https://i.imgur.com/xuadeJ2.png"
},
"lit": {
"name": "Lit",
"description": "Choose which favicon is used to indicate there are unread posts. Preset numbers are 0-4, replace with link to custom image if you desire such as: \"https://i.imgur.com/XGsrewo.png\"",
"type": "text",
"value": "2"
},
"alert": {
"name": "Alert",
"description": "The favicon that indicates unread replies to your posts. Value is ignored if using a preset Lit favicon",
"type": "text",
"value": ""
},
"alertOverlay": {
"name": "Alert Overlay",
"description": "The favicon overlay that indicates unread replies. Default is \"https://i.imgur.com/DCXVHHl.png\"",
"type": "text",
"value": "https://i.imgur.com/DCXVHHl.png"
},
"notification": {
"name": "Notification image",
"description": "The image that is displayed in SpookyX generated notifications. 64px square is ideal. Default is \"https://i.imgur.com/HTcKk4Y.png\"",
"type": "text",
"value": "https://i.imgur.com/HTcKk4Y.png"
}
}
}
}
},
"labelYourPosts": {
"name": "Label Your Posts",
"description": "Add '(You)' to your posts and links that point to them",
"type": "checkbox",
"value": true
},
"inlineReplies": {
"name": "Inline Replies",
"description": "Click replies to expand them inline",
"type": "checkbox",
"value": true
},
"notifications": {
"name": "Enable notifications",
"description": "Browser notifications will be enabled, for example to alert you when your post has been replied to or if you encountered a posting error",
"type": "checkbox",
"value": true,
"suboptions": {
"spoiler": {
"name": "Hide spoilers",
"description": "When creating a notification to alert you of a reply the spoilered text will be replaced with black boxes since nofications cannot hide them like normal",
"type": "checkbox",
"value": true
},
"restrict": {
"name": "Restrict size",
"description": "Firefox option only. By default there is no size limit on Firefox notifications, use this option to keep notifications at a sensible size",
"type": "checkbox",
"value": false,
"suboptions": {
"lines": {
"name": "Line count",
"description": "Number of lines the notification is restricted to",
"type": "number",
"value": 5
},
"characters": {
"name": "Character count",
"description": "Number of characters per line the notification is restricted to",
"type": "number",
"value": 50
}
}
}
}
},
"relativeTimestamps": {
"name": "Relative Timestamps",
"description": "Timestamps will be replaced by elapsed time since post",
"type": "checkbox",
"value": true
},
"postQuote": {
"name": "Post Quote",
"description": "Clicking the post number will insert highlighted text into the reply box",
"type": "checkbox",
"value": true
},
"revealSpoilers": {
"name": "Reveal Spoilers",
"description": "Spoilered text will be displayed without needing to hover over it",
"type": "checkbox",
"value": false
},
"filter": {
"name": "Filter",
"description": "Hide undesirable posts from view",
"type": "checkbox",
"value": false,
"suboptions": {
"filterNotifications": {
"name": "Filter Notifications",
"description": "Enabling this will stop creating reply notifications if the reply is filtered with hide or remove mode. Purge mode filtered replies will never create notifications",
"type": "checkbox",
"value": true
},
"recursiveFiltering": {
"name": "Recursive Filtering",
"description": "Posts that reply to filtered posts will also be filtered",
"type": "checkbox",
"value": false
}
}
},
"adjustReplybox": {
"name": "Adjust Replybox",
"description": "Change the layout of the reply box",
"type": "checkbox",
"value": true,
"suboptions": {
"width": {
"name": "Width",
"description": "Specify the default width of the reply field in pixels",
"type": "number",
"value": 600
},
"hideQROptions": {
"name": "Hide QR Options",
"description": "Make the reply options hidden by default in the quick reply",
"type": "checkbox",
"value": true
},
"removeReset": {
"name": "Remove Reset",
"description": "Remove the reset button from the reply box to prevent unwanted usage",
"type": "checkbox",
"value": false
}
}
},
"postCounter": {
"name": "Post Counter",
"description": "Add a post counter to the reply box",
"type": "checkbox",
"value": true,
"suboptions": {
"location": {
"name": "Location",
"description": "Specify where the post counter is placed",
"type": "select",
"value": {"value": "Header bar", "options": ["Header bar", "Reply box"]}
},
"limits": {
"name": "Show count limits",
"description": "Adds count denominators, purely aesthetic",
"type": "checkbox",
"value": false,
"suboptions": {
"posts": {
"name": "Posts",
"description": "Specify the posts counter denominator",
"type": "number",
"value": 400
},
"images": {
"name": "Images",
"description": "Specify the images counter denominator",
"type": "number",
"value": 250
}
}
},
"countUnloaded": {
"name": "Count unloaded posts",
"description": "If only viewing the last x posts in a thread use this setting for the post counter to count the total number of posts rather than just the number of posts that have been loaded",
"type": "checkbox",
"value": true
},
"countHidden": {
"name": "Count hidden posts",
"description": "Adds a counter that displays how many posts of the total count are hidden",
"type": "checkbox",
"value": true,
"suboptions": {
"hideNullHiddenCounter": {
"name": "Auto-hide null hidden counter",
"description": "If there are no hidden posts the post counter will not display the hidden counter",
"type": "checkbox",
"value": true
}
}
}
}
},
"mascot": {
"name": "Mascot",
"description": "Place your favourite mascot on the background to keep you company!",
"type": "checkbox",
"value": false,
"suboptions": {
"mascotImage": {
"name": "Mascot image",
"description": "Specify a link to your custom mascot or leave blank for SpookyX defaults",
"type": "text",
"value": ""
},
"corner": {
"name": "Corner",
"description": "Specify which corner to align the mascot to",
"type": "select",
"value": {
"value": "Bottom Right",
"options": ["Top Right", "Bottom Right", "Bottom Left", "Top Left"]
}
},
"zindex": {
"name": "Z-index",
"description": "Determine what page elements the mascot is in front and behind of. Default value is -1",
"type": "number",
"value": -1
},
"opacity": {
"name": "Opacity",
"description": "Specify the opacity of the mascot, ranges from 0 to 1",
"type": "number",
"value": 1
},
"clickthrough": {
"name": "Click-through",
"description": "Allow you to click through the mascot if it is on top of buttons, etc",
"type": "checkbox",
"value": true
},
"width": {
"name": "Width",
"description": "Specify the width of the mascot in pixels. Use a negative number to leave it as the image's default width",
"type": "number",
"value": -1
},
"x": {
"name": "Horizontal Displacement",
"description": "Specify horizontal displacement of the mascot in pixels",
"type": "number",
"value": 0
},
"y": {
"name": "Vertical Displacement",
"description": "Specify vertical displacement of the mascot in pixels",
"type": "number",
"value": 0
},
"mute": {
"name": "Mute videos",
"description": "If using a video for a mascot the sound will be muted",
"type": "checkbox",
"value": true
}
}
},
"postFlow": {
"name": "Adjust post flow",
"description": "Change the way posts are laid out in the page",
"type": "checkbox",
"value": true,
"suboptions": {
"leftMargin": {
"name": "Left margin",
"description": "Specify the width in pixels of the gap between the start of the posts and the left side of the screen. Negative values set it to equal the mascot width",
"type": "number",
"value": 0
},
"rightMargin": {
"name": "Right margin",
"description": "Specify the width in pixels of the gap between the end of the posts and the right side of the screen. Negative values set it to equal the mascot width",
"type": "number",
"value": 0
},
"align": {
"name": "Align",
"description": "Specify how posts are aligned",
"type": "select",
"value": {"value": "Left", "options": ["Left", "Center", "Right"]}
},
"wordBreak": {
"name": "Word-break",
"description": "Firefox runs into difficulties with breaking really long words, test the options available until you find something that works. On auto this attempts to detect browser and select the most appropriate setting",
"type": "select",
"value": {"value": "Auto", "options": ["Auto", "Break-all", "Normal", "Overflow-Wrap"]}
}
}
},
"headerBar": {
"name": "Adjust Headerbar behaviour",
"description": "Determine whether the headerbar hides and how it does so",
"type": "checkbox",
"value": true,
"suboptions": {
"behaviour": {
"name": "Behaviour",
"description": "Firefox runs into difficulties with breaking really long words, test the options available until you find something that works. On auto this attempts to detect browser and select the most appropriate setting",
"type": "select",
"value": {
"value": "Collapse to button",
"options": ["Always show", "Full hide", "Collapse to button"]
},
"suboptions": {
"scroll": {
"name": "Hide on scroll",
"description": "Scrolling up will show the headerbar, scrolling down will hide it again",
"if": ["Full hide", "Collapse to button"],
"type": "checkbox",
"value": false
},
"defaultHidden": {
"name": "Default state hidden",
"description": "Check to make the headerbar hidden or collapsed by default on pageload",
"if": ["Full hide", "Collapse to button"],
"type": "checkbox",
"value": true
},
"contractedForm": {
"name": "Customise contracted form",
"description": "Specify what the contracted headerbar form contains",
"if": ["Collapse to button"],
"type": "checkbox",
"value": true,
"suboptions": {
"settings": {
"name": "Settings button",
"description": "Display the settings button in contracted headerbar",
"type": "checkbox",
"value": false
},
"postCounter": {
"name": "Post counter",
"description": "Display the post counter stats in contracted headerbar",
"type": "checkbox",
"value": true
}
}
}
}
},
"shortcut": {
"name": "Hide shortcut",
"description": "Pressing H will toggle the visiblity of the headerbar",
"type": "checkbox",
"value": true
}
}
},
"removeJfont": {
"name": "Remove Japanese Font",
"description": "Enabling this will make the addition of japanese characters to a post cease to change the post font and size. Presumably will cause issues for people whose default font doesn't support japanese characters",
"type": "checkbox",
"value": false
},
"labelDeletions": {
"name": "Label Deletions",
"description": "Enabling this will add 'Deleted' to all trashcan icons that designate deleted posts to allow for easier searching",
"type": "checkbox",
"value": false
}
},
"FilterSettings": {
"name": {
"name": "Name",
"value": [
{"comment": "#/久保島のミズゴロウ/;"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.post_author').html();
},
"responseObjFunction": function(response){
return response['name_processed'];
}
},
"tripcode": {
"name": "Tripcode",
"value": [
{"comment": "#/!!/90sanF9F3Z/;"},
{"comment": "#/!!T2TCnNZDvZu/;"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.post_tripcode').html();
},
"responseObjFunction": function(response){
return response['trip_processed'];
}
},
"uniqueID": {
"name": "Unique ID",
"value": [
{"comment": "# Remember to escape any special characters"},
{"comment": "# For example these are valid:"},
{"comment": "#/bUAl\\+t9X/;"},
{"comment": "#/ID:bUAl\\+t9X/;"},
{"comment": "# But this fails:"},
{"comment": "#/bUAl+t9X/; "},
{"comment": "# It's also worth noting that prefixing it with 'ID:' can cause the filter to fail to accurately detect when using recursive filtering. To assure it works fully stick to just using the hash like 'bUAl+t9X'"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.poster_hash').html();
},
"responseObjFunction": function(response){
return response['poster_hash_processed'];
}
},
"capcode": {
"name": "Capcode",
"value": [
{"comment": "# Set a custom class for mods:"},
{"comment": "#/Mod$/;highlight:mod;"},
{"comment": "# Set a custom class for moot:"},
{"comment": "#/Admin$/;highlight:moot;"},
{"comment": "# (highlighting isn't implemented yet)"},
{"comment": "# For recursive filter to always work you will need to add regex lines for M, A & D for Moderators, Admins and Developers respectively"},
{"comment": "# e.g. /A/; will filter Admins accurately always whilst /Admin/; won't always work for recursively filtered posts"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.post_level').html();
},
"responseObjFunction": function(response){
return response['capcode'];
}
},
"subject": {
"name": "Subject",
"value": [
{"comment": "#/(^|[^A-z])quest([^A-z]|$)/i;boards:tg;"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.post_title').html();
},
"responseObjFunction": function(response){
return response['title_processed'];
}
},
"comment": {
"name": "Comment",
"value": [
{"comment": "#/daki[\\\\S]*/i; boards:tg;"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.text').html();
},
"responseObjFunction": function(response){
return response['comment'];
}
},
"flag": {
"name": "Flag",
"value": [
{"comment": "#Remove kebob"},
{"comment": "#/turkey/i;mode:remove;"}
],
"threadPostFunction": function(currentPost){
return $(currentPost).find('.flag').attr('title');
},
"responseObjFunction": function(response){
return response['poster_country_name_processed'];
}
},
"filename": {
"name": "Filename",
"value": [],
"threadPostFunction": function(currentPost){
var combined = '';
if ($(currentPost).hasClass('thread')) {
combined = $(currentPost).find('.post_file_filename').html();
} else {
$.each($(currentPost).find('.post_file_filename'), function(){
combined += this.innerHTML;
});
}
return combined;
},
"responseObjFunction": function(response){
if (response['media'] === null || response['media'] === undefined) {
return '';
}
return response['media']['media_filename_processed'];
}
},
"fileurl": {
"name": "File URL",
"value": [
{"comment": "# Filter by site for example:"},
{"comment": "#/tumblr/;"}
],
"threadPostFunction": function(currentPost){
var combined = '';
var $currentPost = $(currentPost);
if ($currentPost.hasClass('thread')) {
var $currentPostFilename = $currentPost.find('.post_file_filename');
if ($currentPostFilename.length) {
combined = $currentPostFilename[0].href;
}
} else {
$.each($currentPost.find('.post_file_filename'), function(){
combined += this.href;
});
}
return combined;
},
"responseObjFunction": function(response){
if (response['media'] === null || response['media'] === undefined) {
return '';
}
return response['media']['remote_media_link'];
}
}
}
};
var defaultSettings = jQuery.extend(true, {}, settings);
var defaultMascots = [
"https://i.imgur.com/l2rGSUs.png",
"https://i.imgur.com/QudFqBK.png",
"https://i.imgur.com/YtdTqBW.png",
"https://i.imgur.com/cinWJsP.png",
"https://i.imgur.com/CrjD09g.png",
"https://i.imgur.com/r6RuI3Q.png",
"https://i.imgur.com/U9NQ0aQ.png",
"https://i.imgur.com/avlBCUC.png",
"https://i.imgur.com/RSealGL.png",
"https://i.imgur.com/ZTf8d85.png",
"https://i.imgur.com/47Nf9WQ.png",
"https://i.imgur.com/zw1NtJZ.png",
"https://i.imgur.com/jIx9a5q.png",
"https://i.imgur.com/IGT97Rg.png",
"https://i.imgur.com/Q8OSBd4.png",
"https://i.imgur.com/T5LyxZ3.png",
"https://i.imgur.com/xdcWW4m.png"
];
if (localStorage.SpookyXsettings !== undefined) {
$.extend(true, settings, JSON.parse(localStorage.SpookyXsettings));
}
var newPostCount = 0;
var notLoadedPostCount = 0;
var DocumentTitle = document.title;
var rulesBox = $(".rules_box").html();
var autoplayVid = '';
if (settings.UserSettings.inlineImages.suboptions.autoplayVids.value) {
autoplayVid = 'autoplay';
}
var filetypes = {
IMAGES: ['jpg', 'jpeg', 'png', 'gif'],
VIDEOS: ['webm', 'mp4', 'gifv']
};
var pattImageFiletypes = new RegExp('\\.(' + filetypes.IMAGES.join('|') + ')($|(\\?|:)[\\S]+$)', 'i');
var pattVideoFiletypes = new RegExp('\\.(' + filetypes.VIDEOS.join('|') + ')($|(\\?|:)[\\S]+$)', 'i');
var pattYoutubeLink = new RegExp('(youtube\\.com|youtu\\.be)', 'i');
var pattImgGal = new RegExp('http[s]?://imgur.com/[^\"]*');
var splitURL = (document.URL).toLowerCase().split("/");
var board = splitURL[3];
var threadID = splitURL[4];
if (threadID === "thread") {
threadID = splitURL[5];
} else if (threadID === "last") {
threadID = splitURL[6];
} else if (threadID !== "search" && threadID !== "reports") {
if (board === "_" || threadID === "page" || threadID === "ghost" || threadID === "" || threadID === undefined) {
if (board !== "" && board !== undefined && board !== "_") {
threadID = "board";
} else {
threadID = "other";
}
}
}
var boardPatt = new RegExp("(^|,)\\s*" + board + "\\s*(,|$)");
var Page = {
is: function(type){
if (Page.cache[type] !== undefined) {
return Page.cache[type];
} else {
if (Page.hasOwnProperty(type)) {
Page.cache[type] = Page[type]();
return Page.cache[type];
}
var typeArray = type.split(',');
for (var i = 0; i < typeArray.length; i++) {
if (Page.is(typeArray[i])) {
Page.cache[type] = true;
return true;
}
}
Page.cache[type] = false;
return false;
}
},
cache: {},
'thread': function(){
return /[0-9]+/.test(threadID);
},
'board': function(){
return /board/.test(threadID);
},
'gallery': function(){
return /gallery/.test(threadID);
},
'other': function(){
return /other/.test(threadID);
},
'quests': function(){
return /quests/.test(threadID);
},
'search': function(){
return /search/.test(threadID);
},
'statistics': function(){
return /statistics/.test(threadID);
}
};
//console.log(splitURL);
//console.log("Board:" + board);
//console.log("ThreadID:" + threadID);
// As taken from http://stackoverflow.com/questions/15761939/firing-css-hover-using-jquery
function allowMockHover(){
// iterate over all styleSheets
for (var i = 0, l = document.styleSheets.length; i < l; i++) {
var s = document.styleSheets[i];
if (s.cssRules == null) continue;
// iterate over all rules in styleSheet
for (var x = 0, rl = s.cssRules.length; x < rl; x++) {
var r = s.cssRules[x];
if (r.selectorText && r.selectorText.indexOf(':hover') >= 0) {
fixRule(r);
}
}
}
}
function fixRule(rule){
// if the current rule has several selectors, treat them separately:
var parts = rule.selectorText.split(',');
for (var i = 0, l = parts.length; i < l; i++) {
if (parts[i].indexOf(':hover') >= 0) {
// update selector to be same + selector with class
parts[i] = [parts[i], parts[i].replace(/:hover/gi, '.mock-hover')].join(',');
}
}
// update rule
rule.selectorText = parts.join(',');
}
var imageWidthOP = 250;
var imageHeightOP = 250;
var imageWidth = 125;
var imageHeight = 125;
if (settings.UserSettings.inlineImages.suboptions.customSize.value) {
imageWidthOP = settings.UserSettings.inlineImages.suboptions.customSize.suboptions.widthOP.value;
imageHeightOP = settings.UserSettings.inlineImages.suboptions.customSize.suboptions.heightOP.value;
imageWidth = settings.UserSettings.inlineImages.suboptions.customSize.suboptions.width.value;
imageHeight = settings.UserSettings.inlineImages.suboptions.customSize.suboptions.height.value;
}
var yourPostsLookup = {};
if (Page.is('board,thread')) {
var crosslinkTracker = {};
if (localStorage.crosslinkTracker !== undefined) {
crosslinkTracker = JSON.parse(localStorage.crosslinkTracker);
}
if (crosslinkTracker[board] === undefined) {
crosslinkTracker[board] = {};
}
crosslinkTracker[board][threadID] = {};
localStorage.crosslinkTracker = JSON.stringify(crosslinkTracker);
}
var faviconUnlit;
var faviconLit;
var faviconAlert;
var faviconNotification;
var faviconState = "unlit";
function generateFavicons(){ // Generate dynamic favicons
if (settings.UserSettings.favicon.suboptions.customFavicons.value) {
switch (settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value) {
case "0":
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value = "https://i.imgur.com/7iTgtjy.png";
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value = "https://i.imgur.com/QrkQSo0.png";
break;
case "1":
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value = "https://i.imgur.com/AWVjxfw.png";
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value = "https://i.imgur.com/KXIPcD9.png";
break;
case "2":
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value = "https://i.imgur.com/S7uBSPZ.png";
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value = "https://i.imgur.com/7IxJvBN.png";
break;
case "3":
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value = "https://i.imgur.com/Rt8dEaq.png";
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value = "https://i.imgur.com/tvJjpqF.png";
break;
case "4":
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value = "https://i.imgur.com/3bRaVUl.png";
settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value = "https://i.imgur.com/5Bv27Co.png";
break;
default:
break;
}
faviconUnlit = settings.UserSettings.favicon.suboptions.customFavicons.suboptions.unlit.value; // Store unlit favicon
faviconLit = settings.UserSettings.favicon.suboptions.customFavicons.suboptions.lit.value; // Store lit favicon
faviconAlert = settings.UserSettings.favicon.suboptions.customFavicons.suboptions.alert.value; // Store alert favicon
faviconNotification = settings.UserSettings.favicon.suboptions.customFavicons.suboptions.notification.value; // Store notification favicon
setFavicon();
} else {
var faviconCanvas = document.createElement('canvas');
var nativeFavicon = $('<img src="/favicon.ico">');
var overlayFavicon = $('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a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hYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAJZJREFUeNrs2zEOgCAQBEDO+P8vr7XGSEODN1tTkMkdQYRKMjrnGM0DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoEvO3SZcVZ8/M5OUCgAA4D9rwLPnZ/cZXsaXCgAAAAAAAAAAAAAAAAAAAADun8+7vRdwJqgFACyNM0EtAMA+wD5ACwCwBqgAAAB65gIAAP//AwAu8yh1NlUMJAAAAABJRU5ErkJggg==">');
var ctx = faviconCanvas.getContext('2d');
nativeFavicon.on('load', function(e){
faviconCanvas.height = e.target.naturalHeight;
faviconCanvas.width = e.target.naturalWidth;
ctx.drawImage(e.target, 0, 0); // Draw native favicon
faviconUnlit = faviconCanvas.toDataURL('image/png'); // Store unlit favicon
var faviconData = ctx.getImageData(0, 0, faviconCanvas.height, faviconCanvas.width);
var meanColour = [0, 0, 0, 0];
var scale = Math.floor(64 / faviconCanvas.width);
var faviconNotificationData = faviconData;
var i, len;
if (scale - 1) { // Only upscale if scale is 2 or more
faviconNotificationData = new ImageData(scale * faviconCanvas.width, scale * faviconCanvas.height);
for (i = 0; i < scale; i++) {
for (var j = 0; j < scale; j++) {
for (var x = 0, width = faviconCanvas.width, widths = width * 4; x < widths; x += 4) {
for (var y = 0, height = faviconCanvas.height, heights = height * 4; y < heights; y += 4) {
var start = x + (y * width);
var end = (((x) * scale) + ((y) * width * scale * scale)) + (4 * i) + (4 * j * height * scale);
faviconNotificationData.data[end] = faviconData.data[start];
faviconNotificationData.data[end + 1] = faviconData.data[start + 1];
faviconNotificationData.data[end + 2] = faviconData.data[start + 2];
faviconNotificationData.data[end + 3] = faviconData.data[start + 3];
}
}
}
}
}
for (i = 0, len = faviconData.data.length; i < len; i++) {
meanColour[i % 4] += faviconData.data[i];
}
for (i = 0; i < 4; i++) {
meanColour[i] /= len / 4;