-
Notifications
You must be signed in to change notification settings - Fork 0
/
OneeChan.js
4163 lines (3835 loc) · 250 KB
/
OneeChan.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
// Generated by Grunt
// ==UserScript==
// @name OneeChan
// @version 5.6.1
// @namespace OneeChan
// @description Customizable rice and themes for 4chan X.
// @minGMVer 1.15
// @minFFVer 26
// @license GPL-3.0; https://github.com/nebukazar/OneeChan/blob/master/LICENSE
// @match *://boards.4chan.org/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_openInTab
// @grant GM_listValues
// @run-at document-start
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQcCwEjOhJEZAAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAABEGSURBVGjepZppkF1lmcd/79nv3rf3NXtCliYGSFo2wxKIEVCJRodNUWdkQCxLxHUYHR0/zJROhimVMYql5TgKoyAiSMIqSUiABLORdCB70kkv6e3u2znnfefD7dx0p7tDAu+tU3Xue0+d8/yf5f8s5wrOWF/72tf54Q9/wPwLLp6DMLeWisXo6N+VUth2kGikluHhHnzp8W6WlD65YhZPeggEQgjaozNYXruE7lwvMStCqpQhaAQohdV9q9ev+a+J7iNGf9myZQsdHR3cdNMt0w3RtKtzz/qw0HQMw0DTdJQCXTdxbAfHiXKsaw9ClB8OAiHKt/R9F103xzzI9z103RizZ5o2BTdPOpPA0kwui7VT78QI6Ta60PGUhy50MMQBrcZs//e1Py6eCWDMHTs6Oli16tP10q3dCXp47twryOXTKOnj+R66bjFvapxtezqpiTdRFa3D932k8pGyfBQKGRKpfpT0yeZSgEIIDYUap71SKU9ddSuFYp64CGBpJifzCUKGTZ0Tw5M+CFCemuWEgw3AsbMCuO3Wz2ulfOxx6fuR3XuerwhlGBYAbS2zaW+Lc6xvFtt2PneGlhWaphMOx4mGq6mONxMMxkgm++gf6GIo0YMQAqVOAxFCYzjRQzRSTTSvAWDpFr35ASJmE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ugjD5UT2Q033ckzT/+aK5eu2jo0nF7s+z7DQxna29sB+N1P/5dtv3qVZCmJ7dhkdicYnNpPrKUe2wpUXkR0dx+lUCyQzbUQcILk8wXa39fCxZe877zqKM/zyGazfOX+77BlayehUPBU66m7rveDa669JfXoIw/9DED77OfuOyX899PZ/GLPc+lYMo/LL18MwBvrt7Dh4efpzfXRFG7AUx4SyZan1iKVJJ1OkMmkyGRSNDVPIRSMEgoL5l1Yx213Lj8v4VOpBOs3bGLhRSv4yMp7eOGlN9D08TyTTGfWfObOL08FMH71ywe587Nfbti95+A/+16R3Ttf4PvfvYdMJgNA77EeDF9nVtV0ujO9OIbN0dRxaq04h17fwcXXX0sulyWVHkboBf7ujmUEg/Z5/m9Ckk6nuX7FnWSzBWzbASFQ0p9kjqrYd/DYI8DlBsDevUc2Sgn79m7i1BubBx98EIC33trLUHEYX5METAcNjYZgHQeGDjHluEm+kKd94XRmzrkCxzHf1R8/Xn31Verrm3BLHo4TIJnopa/3AKViDqEJ2qYsJBypGVOlFoqlRZddsbLGuOqaT74/mcrOTAx1UyqVK9abb7759JR63gy2uJsJRgMM5ofRhKA73UdQOlxz+7Vcc+NFRCMR3u0aHh7mZH+Ke774PdLpIXpOvEWxkB1zzYF9rzH7gssJR6ordCylCoQjoTs0z/f/RQhNO9l38LSPJZOV84/f/gn0kEFPuo/B3DC9mX40oVE3q4GP3rKSrVu2vGvhU8k8D//8j9z/1e/R+eZfOXLwb+OEP7X2v72ZUqkwZi+Tyf3r/wPNYcrLkd3xFwAAAABJRU5ErkJggg==
// ==/UserScript==
(function() {
var defaultConfig = {
":: Main Rice": ["header", ""],
"Left Margin": [
5, "Change the size of the left margin.", [{
name: "Large",
value: 65
}, {
name: "Medium",
value: 25
}, {
name: "Small",
value: 5
}, {
name: "None",
value: 0
}, {
name: "Custom",
value: 999
}], true
],
"Custom Left Margin": [
0, "Left margin custom width (pixels).", "Left Margin", 999, true
],
"Right Margin": [
5, "Change the size of the right margin.", [{
name: "Large",
value: 65
}, {
name: "Medium",
value: 25
}, {
name: "Small",
value: 5
}, {
name: "None",
value: 0
}, {
name: "Custom",
value: 999
}], true
],
"Custom Right Margin": [
0, "Right margin custom width (pixels).", "Right Margin", 999, true
],
"Style Thread Stats": [false, "Makes thread stats stand out more. Disable 'Updater and Stats in Header' if using ccd0 4chan X."],
"Rounded Corners": [false, "Styles replies, menus and Quick Reply to have subtly rounded corners."],
"Underline All Links": [false, "Underlines all links in the page."],
"Show Banner": [false, "Toggle visibility of banner.", null, true],
"Reduce Banner Opacity": [false, "Reduce opacity of the banner for easier viewing.", "Show Banner", true, true],
"Show Board Banners": [false, "Toggle visibility of board banners."],
"Show Board Name": [true, "Toggle visibility of the board name."],
"Show Reply to Thread Button": [false, "Toggle visibility of the Start a Thread / Reply to Thread button."],
"Show Checkboxes": [false, "Hides checkboxes and deleteform to be replaced by 4chan X menus. Refresh to apply."],
"Show Blotter": [true, "Toggle visibility of the 4chan news blotter."],
"Show 4chan Ads": [false, "Opts into 4chan\'s banner ads.", null, true],
"Show Top Ad": [true, "Show the top 4chan banner ad.", "Show 4chan Ads", true, true],
"Show Middle Ad": [true, "Show the middle 4chan banner ad.", "Show 4chan Ads", true, true],
"Show Bottom Ad": [true, "Show the bottom 4chan banner ad.", "Show 4chan Ads", true, true],
"Reduce Ad Opacity": [false, "Reduce the opacity of ads until hover for easier viewing.", "Show 4chan Ads", true, true],
"Show Navigation Links": [true, "Toggle visibility of the navigation links at the top and bottom of the threads.", null, true],
"Show Top Links": [true, "Toggle visibility of the top navigation links.", "Show Navigation Links", true, true],
"Show Bottom Links": [true, "Toggle visibility of the bottom navigation links.", "Show Navigation Links", true, true],
"Show Previous/Next buttons": [false, "Shows previous / next buttons in paged navigation mode."],
":: Sidebar": ["header", ""],
"Sidebar Position": [
1, "Change the position of the sidebar or disable it altogether.", [{
name: "Right",
value: 1
}, {
name: "Left",
value: 2
}, {
name: "Disabled",
value: 3
}], true
],
"Disable In Catalog View": [false, "Disables the sidebar when viewing the catalog. Native catalog only!"],
"SS-like Sidebar": [false, "Darkens the sidebar and adds a border like 4chan Style Script."],
"Minimal Sidebar": [true, "Shrinks the sidebar and disables the banner."],
":: Quick Reply": ["header", ""],
"Autohide Style": [
1, "Changes how the quick reply is hidden. Enable Autohide QR in 4chan X.", [{
name: "Normal",
value: 1
}, {
name: "Vertical Tabbed",
value: 2
}, {
name: "Fade",
value: 3
}]
],
"Transparent QR": [false, "Reduces opacity of the QR box."],
"Remove Background": [false, "Removes the QR background."],
"Remove Controls": [false, "Removes the QR controls and checkbox."],
"Expanding Form Inputs": [true, "Makes certain form elements expand on focus."],
"Force QR to Sidebar Size": [false, "QR will no longer extend past the sidebar size."],
":: Mascots": ["header", ""],
"Hide Mascots in Catalog": [true, "Hides the mascot when viewing the catalog."],
"Mascots Overlap Posts": [false, "Mascots will render above posts and threads."],
"Reduce Mascot Opacity": [true, "Reduces opacity of mascots until hover. Warning: Overrides pointer events."],
"Grayscale Mascots": [false, "Desaturates mascots."],
":: Replies": ["header", ""],
"Fit Width": [true, "Replies stretch to the width of the page."],
"Show Reply Header": [true, "Shows reply header background and line border."],
"Show Post Info On Hover": [false, "Shows post number and file info on hover only."],
"Show File Info": [true, "Hides filename, dimensions and size info."],
"Underline QuoteLinks": [false, "Underlines quotelinks only."],
"Indent OP": [false, "Indents the OP instead of touching the screen."],
"Allow Wrapping Around OP": [false, "Allow for replies to wrap around OP instead of being forced onto their own line."],
"OP Background": [false, "Give OP a background similar to a reply."],
"Recolor Even Replies": [false, "Makes every other post a darker color. If Quote Threading is enabled darkens every root reply."],
"Reduce Thumbnail Opacity": [false, "Reduces opacity of thumbnails."],
"Backlink Icons": [true, "Use icons for backlinks instead of text."],
"Backlinks on Bottom": [false, "Move backlinks to the bottom right of replies."],
"Borders": [
2, "Changes which sides of replies have borders.", [{
name: "Normal (4chan default)",
value: 1
}, {
name: "On all sides",
value: 2
}, {
name: "None",
value: 3
}]
],
"Margin Between Replies": ['', "Change size of spacing in between replies.", [{
name: "Very Large",
value: 15
}, {
name: "Large",
value: 8
}, {
name: "Normal (4chan default)",
value: ''
}, {
name: "Minimal",
value: -2
}, {
name: "None",
value: -4
}, {
name: "Overlapping Borders",
value: -5
}]],
"Post Message Margin": [
2, "Change size of margin around post message.", [{
name: "Small",
value: 1
}, {
name: "Normal",
value: 2
}, {
name: "Large",
value: 3
}]
],
":: Catalog": ["header", ""],
"Justified Text": [true, "Justifies the teaser text of every thread to be more uniform."],
"Show Background": [true, "Threads receive a matching background."],
"Unified Thumbnail Size": [false, "Makes all thumbnails the same size regardless of aspect ratio."],
":: 4chan X Header": ["header", ""],
"Show Header Background Gradient": [true, "Gives the header bar a gradient background."],
"Show Header Shadow": [true, "Gives the header a drop shadow."],
"Highlight Current Board": [true, "Gives the current board link a bottom highlight border."],
":: Highlighting": ["header", ""],
"Highlight (OP) quotes": [false, "Highlights all (OP) mentions."],
"Highlight (You) quotes": [false, "Highlights all posts quoting (You)"],
"Post Decoration Style": [
0, "Changes the highlight decoration of posts.", [{
name: "None",
value: 0
}, {
name: "Border",
value: 1
}, {
name: "Outline",
value: 2
}, {
name: "Separator",
value: 3
}]
],
"Post Decoration Width": [
1, "Changes decoration width of highlighted posts.", [{
name: "Large",
value: 6
}, {
name: "Medium",
value: 3
}, {
name: "Small",
value: 1
}, {
name: "Custom",
value: 999
}], true
],
"Custom Decoration Width": [
0, "Enter a custom width for the decoration (pixels).", "Post Decoration Width", 999, true
],
"Post Highlight Style": [
"solid", "Changes style of post highlight.", [{
name: "Dashed",
value: "dashed"
}, {
name: "Dotted",
value: "dotted"
}, {
name: "Double",
value: "double"
}, {
name: "Solid",
value: "solid"
}]
],
":: Fonts": ["header", ""],
"Font Family": [
"sans-serif", "Set the default font family.", [{
name: "Default",
value: "sans-serif"
}, {
name: "Monospace",
value: "monospace"
}, {
name: "Ubuntu",
value: "Ubuntu"
}, {
name: "Consolas",
value: "Consolas"
}, {
name: "Droid Sans",
value: "Droid Sans"
}, {
name: "Segoe UI",
value: "Segoe UI"
}, {
name: "Calibri",
value: "Calibri"
}, {
name: "Arial",
value: "Arial"
}, {
name: "Lucida Grande",
value: "Lucida Grande"
}, {
name: "Helvetica",
value: "Helvetica"
}]
],
"Font Size": [13, "Set the general size of text (Pixels). Min: 10px, Max: 18px"],
"Backlink Font Size": [9, "Set the font size of backlinks."],
"Bitmap Font": [false, "Check this if you are using a bitmap font."],
":: Compatibility": ["header", ""],
"Version Fix": [
1, "Applies CSS fixes for different forks. Default is for seaweed/ccd0 forks. Make sure you enable QR and Persistent QR for maximum compatibility.", [{
name: "Default",
value: 1
}, {
name: "loadletter",
value: 3
}], true
],
"Themes": [],
"Hidden Themes": [],
"Selected Theme": 13,
"NSFW Theme": 12,
"Selected Mascots": [54],
"Mascots": [],
"Hidden Mascots": []
},
MAX_FONT_SIZE = 18,
MIN_FONT_SIZE = 10,
NAME = "OneeChan",
NAMESPACE = "OneeChan.",
VERSION = "5.6.1",
CHANGELOG = "https://github.com/nebukazar/OneeChan/blob/master/CHANGELOG.md",
inputImages = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAgCAYAAAAv8DnQAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAP9JREFUOMvV0CFLQ2EYxfHfrtdiURgbmCxOmFPBJgZZ0CQD0Q+goFkwabWIyWIWFgwmy7Qp7DPI3GD7ACZlYLNcy31ljG0aDHrSy3N43nOef6ZULBiifczEQ8wV7OAtGmBO4wgfOI2whsXUnMAJ8rhCJ8IxDpHDHpZwixqM5XPZBBtYxioauEgjRLjBI2bRxTneQ6EYCS4xiTu89DbONJrtP88hwnV64hm28YRqyPsFDkmSGKUYFubnsqignM7rqDWa7dcAqoLdnsXwrgZQ5QG/l8MVIxX1ZPar/lUyUOsv+aMzv+0Qw3OrM4VNrKfzB9yXioVu6LDVx+EA4/+Gwycw/Uz36O07WwAAAABJRU5ErkJggg==",
fontListSWF = "https://ahodesuka.github.com/FontList.swf",
themeInputs = [{
dName: "Reply Background",
name: "mainColor",
property: "background-color"
}, {
dName: "Reply Border",
name: "brderColor",
property: "border-color"
}, {
dName: "Input Background",
name: "inputColor",
property: "background-color"
}, {
dName: "Input Border",
name: "inputbColor",
property: "border-color"
}, {
dName: "Header Background",
name: "headerBGColor",
property: "background-color"
}, {
dName: "Header Text",
name: "headerColor",
property: "color"
}, {
dName: "Board Title",
name: "boardColor",
property: "color"
}, {
dName: "Body Background",
name: "bgColor",
property: "background-color"
}, {
dName: "Text",
name: "textColor",
property: "color"
}, {
dName: "Backlink",
name: "blinkColor",
property: "color"
}, {
dName: "Header Link",
name: "headerLColor",
property: "color"
}, {
dName: "Header Link Hover",
name: "headerLHColor",
property: "color"
}, {
dName: "Link",
name: "linkColor",
property: "color"
}, {
dName: "Link Hover",
name: "linkHColor",
property: "color"
}, {
dName: "Quotelinks",
name: "qlColor",
property: "color"
}, {
dName: "Name",
name: "nameColor",
property: "color"
}, {
dName: "Tripcode",
name: "tripColor",
property: "color"
}, {
dName: "Subject",
name: "titleColor",
property: "color"
}, {
dName: "Greentext",
name: "quoteColor",
property: "color"
}, {
dName: "Unread Line",
name: "unreadColor",
property: "color"
}, {
dName: "Highlighting",
name: "postHLColor",
property: "color"
}, {
dName: "Posts Quoting You",
name: "quotesYouHLColor",
property: "color"
}, {
dName: "Own Posts",
name: "ownPostHLColor",
property: "color"
}, {
dName: "Highlighted Threads",
name: "threadHLColor",
property: "color"
}, {
dName: "Highlighted Reply BG",
name: "replybgHLColor",
property: "background"
}, {
dName: "Reply Selection",
name: "replyslctColor",
property: "outline"
}],
$lib, $SS;
if (!Array.isArray)
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === "[object Array]";
};
Number.prototype.toHexStr = function() {
var s = "",
v;
for (var i = 7; i >= 0; i--) {
v = (this >>> (i * 4)) & 0xf;
s += v.toString(16);
}
return s;
};
/* STYLE SCRIPT LIBRARY */
/* More or less based off jQuery */
$lib = window.$ = function(selector, root) {
return this instanceof $lib ?
this.init(selector, root) : new $lib(selector, root);
};
/* From 4chan X, unchainable */
/* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE */
/* https://github.com/ccd0/4chan-x/blob/master/LICENSE */
$.asap = function(test, cb) {
if (test()) {
return cb();
} else {
return setTimeout($.asap, 25, test, cb);
}
};
$lib.prototype = {
constructor: $lib,
elems: [],
length: function() {
return this.elems.length;
},
/* CONSTRUCTOR */
init: function(selector, root) {
if (selector == null || selector == undefined) return this;
if (selector.constructor === $lib) return selector;
else if (typeof selector === "string") {
var root = root || document;
var tagCheck = /^<(\w+)([^>]*)>(.*)$/.exec(selector); // No closing tag for root node.
if (root.constructor === $lib)
root = root.get();
if (tagCheck) {
var tag = document.createElement(tagCheck[1]);
if (tagCheck[2]) {
var attribs, atRegEx = /(\w+)=((?:"(?:[^"]+)"|'(?:[^']+)'|(?:\w+)))/g;
while ((attribs = atRegEx.exec(tagCheck[2])) != null) {
var val = attribs[2];
if ((val[0] == '"' || val[0] === "'") && val[0] == val[val.length - 1])
val = val.substr(1, val.length - 2)
tag.setAttribute(attribs[1], val);
}
}
tag.innerHTML = tagCheck[3];
this.elems = [tag];
} else if (/^#[\w-]+$/.test(selector) && root == document) {
var el;
if ((el = document.getElementById(selector.substr(1))) != null)
this.elems = [el];
} else {
var results = root.querySelectorAll(selector);
this.elems = Array.prototype.slice.call(results);
}
} else if (selector.nodeType)
this.elems = [selector];
else if (Array.isArray(selector))
this.elems = Array.prototype.slice.call(selector);
return this;
},
/* DOM NODE RETRIEVAL */
clone: function() {
var ret = [];
this.each(function() {
ret.push(this.cloneNode(true));
});
return new $lib(ret);
},
elements: function() {
if (!this.hasSingleEl())
return this;
this.elems = Array.prototype.slice.call(this.elems[0].elements);
return this;
},
get: function(index) {
if (index == undefined && this.elems.length === 1)
return this.elems[0];
else if (index == undefined && !this.hasSingleEl())
return this.elems;
return this.elems[index];
},
/* DOM MANIPULATION */
prepend: function(el) {
if (el.constructor === $lib)
el = el.get();
return this.each(function() {
this.insertBefore(el, this.firstChild);
});
},
append: function(el) {
if (el.constructor === $lib)
el = el.get();
return this.each(function() {
this.appendChild(el);
});
},
before: function(el) {
if (el.constructor === $lib)
el = el.get();
return this.each(function() {
this.parentNode.insertBefore(el, this);
});
},
after: function(el) {
if (el.constructor === $lib)
el = el.get();
return this.each(function() {
if (this.nextSibling != null)
this.parentNode.insertBefore(el, this.nextSibling);
else if (this.parentNode != null)
this.parentNode.appendChild(el);
});
},
replace: function(el) {
return this.each(function() {
$(this).before(el).remove();
});
},
html: function(html) {
if (html == undefined)
return this.elems[0].innerHTML;
return this.each(function() {
this.innerHTML = html;
});
},
text: function(text) {
if (this.length() === 0)
return;
if (text == undefined)
return this.elems[0].textContent;
return this.each(function() {
this.textContent = text;
});
},
appendText: function(text) {
return this.each(function() {
this.textContent += text;
});
},
attr: function(name, val) {
if (val == undefined)
if (!this.hasSingleEl())
return this;
else
return this.elems[0].getAttribute(name);
else
if (val === "")
return this.each(function() {
this.removeAttribute(name);
});
return this.each(function() {
this.setAttribute(name, val);
});
},
disabled: function(bDisabled) {
if (bDisabled == undefined)
return this.elems[0].disabled;
return this.each(function() {
this.disabled = bDisabled;
});
},
toggle: function(bHidden) {
return this.each(function() {
var $this = $(this);
if (bHidden == undefined)
bHidden = !($this.attr("disabled") === "true");
$this.attr("hidden", bHidden || "");
});
},
hide: function() {
return this.toggle(true);
},
show: function() {
return this.toggle(false);
},
val: function(val) {
if (val == undefined) {
var el = this.elems[0];
if (el == undefined)
return false;
switch (el.type) {
case "checkbox":
case "radio":
return el.checked == true;
default:
if (/^\d+$/.test(el.value))
return parseInt(el.value);
return el.value;
}
}
return this.each(function() {
switch (this.type) {
case "checkbox":
case "radio":
this.checked = val;
break;
default:
this.value = val;
break;
}
});
},
checked: function(state) {
return this.each(function() {
this.checked = state;
});
},
addClass: function(classNames) {
return this.each(function() {
classNames = classNames.split(" ");
for (var j = 0, jMAX = classNames.length; j < jMAX; j++)
if (!$(this).hasClass(classNames[j]))
this.className += (this.className ? " " : "") + classNames[j];
});
},
hasClass: function(className) {
if (!this.hasSingleEl() || this.elems[0].className == undefined)
return false;
var regx = new RegExp("\\b" + className + "\\b");
return regx.test(this.elems[0].className);
},
removeClass: function(classNames) {
return this.each(function() {
classNames = classNames.split(" ");
for (var j = 0, jMAX = classNames.length; j < jMAX; j++)
if ($(this).hasClass(classNames[j])) {
var cclassNames = this.className.split(" ");
this.className = "";
for (var k = 0, kMAX = cclassNames.length; k < kMAX; k++)
if (classNames[j] !== cclassNames[k])
this.className += (this.className ? " " : "") + cclassNames[k];
}
});
},
toggleClass: function(classNames) {
return this.each(function() {
classNames = classNames.split(" ");
for (var j = 0, jMAX = classNames.length; j < jMAX; j++)
if (!$(this).hasClass(classNames[j]))
$(this).addClass(classNames[j]);
else
$(this).removeClass(classNames[j]);
});
},
optionClass: function(optionName, optionValue, className) {
return this.each(function() {
if ($SS.conf[optionName] === optionValue && !$(this).hasClass(className))
$(this).addClass(className);
else if ($SS.conf[optionName] !== optionValue && $(this).hasClass(className))
$(this).removeClass(className);
else
return
});
},
remove: function() {
return this.each(function() {
this.parentNode.removeChild(this);
});
},
/* DOM TRAVERSING */
parent: function() {
if (!this.hasSingleEl()) return this;
return new $lib(this.elems[0].parentNode);
},
children: function(selector) {
if (!this.hasSingleEl())
return this;
else if (selector == null)
selector = "*";
return new $lib(selector, this.elems[0]);
},
nextSibling: function(selector) {
if (!this.hasSingleEl() ? true : this.elems[0].nextSibling == null)
return new $lib(null);
if (selector != undefined) {
var t, m = new $lib(selector, this.elems[0].parentNode),
s = this.elems[0].parentNode.childNodes;
for (var i = s.length - 1; i >= 0; --i) {
if (s[i] === this.elems[0] && t == undefined) // end and no matching siblings
return new $lib(null);
else if (s[i] === this.elems[0] && t != undefined) // end and matched sibling
return new $lib(t);
else if (m.elems.indexOf(s[i]) !== -1) // this element matches the selector
t = s[i];
}
}
return new $lib(this.elems[0].nextSibling);
},
previousSibling: function(selector) {
if (!this.hasSingleEl() ? true : this.elems[0].previousSibling == null)
return new $lib(null);
if (selector != undefined) {
var t, m = new $lib(selector, this.elems[0].parentNode),
s = this.elems[0].parentNode.childNodes;
for (var i = 0, MAX = s.length; i < MAX; ++i) {
if (s[i] === this.elems[0] && t == undefined)
return new $lib(null);
else if (s[i] === this.elems[0] && t != undefined)
return new $lib(t);
else if (m.elems.indexOf(s[i]) !== -1)
t = s[i];
}
}
return new $lib(this.elems[0].previousSibling);
},
/* EVENT METHODS */
bind: function(type, listener) {
return this.each(function() {
this.addEventListener(type, listener, false);
});
},
unbind: function(type, listener) {
return this.each(function() {
this.removeEventListener(type, listener, false);
});
},
fire: function(evnt) {
var ev = document.createEvent("HTMLEvents");
return this.each(function() {
ev.initEvent(evnt, true, true);
this.dispatchEvent(ev);
});
},
blur: function() {
return this.each(function() {
this.blur();
});
},
click: function() {
return this.each(function() {
this.click();
});
},
scrollIntoView: function(alignWithTop) {
return this.each(function() {
this.scrollIntoView(alignWithTop);
});
},
/* HELPER METHODS */
delay: function(func, time) {
return this.each(function() {
var $this = this;
setTimeout(function() {
func.call($this);
}, time);
});
},
each: function(func, args) {
if (args != null && !Array.isArray(args))
args = [args];
for (var i = 0, MAX = this.elems.length; i < MAX; ++i)
func.apply(this.elems[i], args || [i]);
return this;
},
exists: function() {
return this.elems.length > 0;
},
hasSingleEl: function() {
return this.elems.length === 1;
},
riceCheck: function() {
return this.each(function() {
var click = function(e) {
e.preventDefault();
this.previousSibling.click();
};
if (this.isRiced) return;
else if (this.nextSibling != undefined && this.nextSibling.className === "riceCheck")
return $(this.nextSibling).bind("click", click);
var titleAttr;
if (this.hasAttribute("title"))
titleAttr = $(this).attr("title");
else
titleAttr = "";
var div = $("<div class=riceCheck title='" + titleAttr + "'>").bind("click", click);
$(this).hide().after(div);
return this.isRiced = true;
});
},
jsColor: function() {
return this.each(function() {
this.color = new $SS.jscolor.color(this);
});
}
};
/* END STYLE SCRIPT LIBRARY */
/* STYLE SCRIPT CLASSES & METHODS */
$SS = {
browser: {},
DOMLoaded: function(reload) {
$SS.classes.init();
var div;
if (reload !== true) {
$SS.options.init();
$("#index-rev").riceCheck();
$(document).bind("QRDialogCreation", $SS.QRDialogCreationHandler)
.bind("OpenSettings", $SS.NodeInsertionHandler)
.bind("ThreadUpdate", $SS.NodeInsertionHandler);
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var observer = new MutationObserver(function(mutations) {
var i, j, MAX, _MAX, nodes;
for (i = 0, MAX = mutations.length; i < MAX; ++i) {
nodes = mutations[i].addedNodes;
for (j = 0, _MAX = nodes.length; j < _MAX; ++j)
if (nodes[j].nodeType !== 3)
$("input[type=checkbox]", nodes[j]).riceCheck();
}
});
observer.observe(document, {
childList: true,
subtree: true
});
if ((!(html = $("*[xmlns]")).exists()) && (!(ctxmenu = $("#ctxmenu-main").exists())))
if ((link = $("link[title][rel='stylesheet']")).exists())
link.each(function() {
$(this).attr("href", "");
});
if ((div = $("#globalMessage *[style]")).exists())
div.each(function() {
$(this).attr("style", "");
});
// 4chan ads being added with JS
if (!$SS.conf["Show Top Ad"]) {
$(".topad.center").remove();
$(".aboveMidAd.center").remove();
} else if (!$SS.conf["Show Middle Ad"]) {
$(".middlead.center").remove();
} else if (!$SS.conf["Show Bottom Ad"]) {
$(".bottomad.center").remove();
}
// things that need to change after 4chan X loads.
setTimeout(function() {
if (!$SS.QRhandled && (div = $("#qr")).exists())
$SS.QRDialogCreationHandler({
target: div
});
});
}
$SS.insertMascot();
$SS.riceInputs.init();
},
init: function(reload) {
if (!reload) {
if (/^about:neterror/.test(document.documentURI)) return;
localStorage["4chan-settings"] = "{ \"disableAll\" : true, \"dropDownNav\": false }";
var m_VERSION;
$SS.browser.webkit = /AppleWebKit/.test(navigator.userAgent);
$SS.browser.gecko = /Gecko\//.test(navigator.userAgent);
$SS.location = $SS.getLocation();
if ((m_VERSION = $SS.Config.get("VERSION")) !== VERSION) {
// Signal that OneeChan has updated
var detail = {
type: 'info',
content: NAME + ' has been updated to version ' + VERSION + '.',
lifetime: 15
};
if (typeof cloneInto === 'function') {
detail = cloneInto(detail, document.defaultView);
}
var event = new CustomEvent('CreateNotification', {
bubbles: true,
detail: detail
});
setTimeout(function() {
document.dispatchEvent(event);
}, 25);
// Correct selected theme/mascot after updating
// and the number defaults has changed.
var ntMascots = $SS.Mascots.defaults.length, // new total
ntThemes = $SS.Themes.defaults.length,
otMascots = $SS.Config.get("Total Mascots"), // old total
otThemes = $SS.Config.get("Total Themes"),
sMascots = $SS.Config.get("Selected Mascots"),
sTheme = $SS.Config.get("Selected Theme");
if (otMascots !== ntMascots && otMascots != undefined) {
var mDiff = ntMascots - otMascots;
for (var i = 0, MAX = sMascots.length; i < MAX; ++i)
if (sMascots[i] < otMascots) break;
else sMascots[i] += mDiff;
$SS.Config.set("Selected Mascots", sMascots);
}
if (otThemes !== ntThemes && otThemes != undefined && sTheme >= otThemes) {
sTheme += ntThemes - otThemes;
$SS.Config.set("Selected Theme", sTheme);
}
$SS.Config.set("VERSION", VERSION);
$SS.Config.set("Total Mascots", ntMascots);
$SS.Config.set("Total Themes", ntThemes);
}
}
$SS.Config.init();
$SS.Themes.init();
$SS.Mascots.init();
if (reload) {
$SS.insertCSS();
$SS.DOMLoaded(true);
} else {
$.asap((function() {
return $("link[rel=stylesheet]", document.head).exists();
}), $SS.insertCSS);
if (/complete|interactive/.test(document.readyState))
$SS.DOMLoaded();
else
$(document).bind("DOMContentLoaded", $SS.DOMLoaded);
}
},
/* STYLING & DOM */
insertCSS: function() {