forked from zixaphir/appchan-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappchan_x.user.js
11704 lines (11259 loc) · 529 KB
/
appchan_x.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 appchan x
// @namespace zixaphir
// @version 1.2.6
// @description Cross-browser userscript for maximum lurking on 4chan.
// @copyright 2013 Zixaphir <[email protected]>
// @copyright 2009-2011 James Campos <[email protected]>
// @copyright 2013 Nicolas Stepien <[email protected]>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @match *://*.4chan.org/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_openInTab
// @run-at document-start
// @updateURL https://github.com/zixaphir/appchan-x/raw/stable/appchan_x.meta.js
// @downloadURL https://github.com/zixaphir/appchan-x/raw/stable/appchan_x.user.js
// @icon data:image/gif;base64,R0lGODlhIAAgAKIAAAQCBARmBHy6VKTShP///////wAAAAAAACH5BAEAAAUALAAAAAAgACAAAAO6WLrc/jDKWYK9VF3cts2Vx1hDaX4RaZaouqKQewZjINwCS3dBiQuwheWnc6h+weFPAGg6n88lcKf8Qa9OadLTJHi/4KZnV9t0wWixaHK+epsgRhv6BsQXZ/QXfi/k9QR8d3NPdX1+AHWFgXZxFnMKc0ESj4mMkZZqFCpXmE9FKT0DnYifA5NCokhkqUSnrBqqOKhVOa9GNku0uau4WrAhv75TN7vFucbEU8NKqLHPodAxVMA10ofY2REJADs=
// ==/UserScript==
/*
* appchan-x - Version 1.2.6 - 2013-04-13
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
*
* Appchan X Copyright © 2013 Zixaphir <[email protected]>
* http://zixaphir.github.com/appchan-x/
* 4chan x Copyright © 2009-2011 James Campos <[email protected]>
* http://aeosynth.github.com/4chan-x/
* 4chan x Copyright © 2013 Nicolas Stepien <[email protected]>
* http://mayhemydg.github.com/4chan-x/
* OneeChan Copyright © 2013 Jordan Bates
* http://seaweedchan.github.com/oneechan/
* 4chan SS Copyright © 2013 Ahodesuka
* http://ahodesuka.github.com/4chan-Style-Script
* Raphael Icons Copyright © 2013 Dmitry Baranovskiy
* http://raphaeljs.com/icons/
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Contributors:
* aeosynth
* mayhemydg
* noface
* !K.WeEabo0o
* blaise
* that4chanwolf
* desuwa
* seaweed
* e000
* ahodesuka
* Shou
* ferongr
* xat
* Ongpot
* thisisanon
* Anonymous
* Seiba
* herpaderpderp
* WakiMiko
* btmcsweeney
* AppleBloom
* Gógol
*
* All the people who've taken the time to write bug reports.
*
* Thank you.
*/
/*
* Linkify based on:
* http://downloads.mozdev.org/greasemonkey/linkify.user.js
* https://github.com/MayhemYDG/LinkifyPlusFork
*
* Originally written by Anthony Lieuallen of http://arantius.com/
* Licensed for unlimited modification and redistribution as long as
* this notice is kept intact.
*/
/*
* JSColor, JavaScript Color Picker
*
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
* @author Jan Odvarko, http://odvarko.cz
* @link http://JSColor.com
*/
(function() {
var $, $$, Anonymize, ArchiveLink, BanChecker, Build, CatalogLinks, Conf, Config, CustomNavigation, DeleteLink, DownloadLink, EmbedLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Get, IDColor, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MarkOwn, Markdown, MascotTools, Mascots, Menu, MutationObserver, Nav, Navigation, Options, Prefetch, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHideLink, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, Style, ThemeTools, Themes, ThreadHideLink, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, editMascot, editTheme, g, userNavigation, _base,
__slice = [].slice;
Config = {
main: {
Enhancing: {
'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'],
'External Catalog': [false, 'Link to external catalog instead of the internal one.'],
'404 Redirect': [true, 'Redirect dead threads and images'],
'Keybinds': [true, 'Binds actions to keys'],
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
'File Info Formatting': [true, 'Reformats the file information'],
'Comment Expansion': [true, 'Expand too long comments'],
'Thread Expansion': [true, 'View all replies'],
'Index Navigation': [true, 'Navigate to previous / next thread'],
'Reply Navigation': [false, 'Navigate to top / bottom of thread'],
'Custom Navigation': [false, 'Customize your Navigation bar.'],
'Append Delimiters': [false, 'Adds delimiters before and after custom navigation.'],
'Check for Updates': [true, 'Check for updated versions of Appchan X'],
'Check for Bans': [false, 'Check ban status and prepend it to the top of the page.'],
'Check for Bans constantly': [false, 'Optain ban status on every refresh. Note that this will cause delay on getting the result.']
},
Linkification: {
'Linkify': [true, 'Convert text into links where applicable.'],
'Embedding': [true, 'Embed supported services.'],
'Link Title': [true, 'Replace the link of a supported site with its actual title. Currently Supported: YouTube, Vimeo, SoundCloud']
},
Filtering: {
'Anonymize': [false, 'Make everybody anonymous'],
'Filter': [true, 'Self-moderation placebo'],
'Recursive Filtering': [true, 'Filter replies of filtered posts, recursively'],
'Reply Hiding': [false, 'Hide single replies'],
'Thread Hiding': [false, 'Hide entire threads'],
'Show Stubs': [true, 'Of hidden threads / replies']
},
Imaging: {
'Image Expansion': [true, 'Expand images'],
'Image Hover': [false, 'Show full image on mouseover'],
'Sauce': [true, 'Add sauce to images'],
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'],
'Don\'t Expand Spoilers': [true, 'Don\'t expand spoilers when using ImageExpand.'],
'Expand From Current': [false, 'Expand images from current position to thread end.'],
'Fappe Tyme': [false, 'Toggle display of posts without images.'],
'Prefetch': [false, 'Prefetch images.'],
'Replace GIF': [false, 'Replace thumbnail of gifs with its actual image.'],
'Replace PNG': [false, 'Replace pngs.'],
'Replace JPG': [false, 'Replace jpgs.']
},
Menu: {
'Menu': [true, 'Add a drop-down menu in posts.'],
'Report Link': [true, 'Add a report link to the menu.'],
'Delete Link': [true, 'Add post and image deletion links to the menu.'],
'Download Link': [true, 'Add a download with original filename link to the menu. Chrome-only currently.'],
'Archive Link': [true, 'Add an archive link to the menu.'],
'Embed Link': [true, 'Add an embed link to the menu to embed all supported formats in a post.'],
'Thread Hiding Link': [true, 'Add a link to hide entire threads.'],
'Reply Hiding Link': [true, 'Add a link to hide single replies.']
},
Monitoring: {
'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'],
'Optional Increase': [false, 'Increase value of Updater over time.'],
'Interval per board': [false, 'Change the intervals of updates on a board-by-board basis.'],
'Unread Count': [true, 'Show unread post count in tab title'],
'Unread Favicon': [true, 'Show a different favicon when there are unread posts'],
'Post in Title': [true, 'Show the op\'s post in the tab title'],
'Thread Stats': [true, 'Display reply and image count'],
'Thread Watcher': [true, 'Bookmark threads'],
'Auto Watch': [true, 'Automatically watch threads that you start'],
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'],
'Color user IDs': [false, 'Assign unique colors to user IDs on boards that use them'],
'Mark Owned Posts': [true, 'Mark quotes to posts you\'ve authored.'],
'Remove Spoilers': [false, 'Remove all spoilers in text.'],
'Indicate Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled.']
},
Posting: {
'Cooldown': [true, 'Prevent "flood detected" errors.'],
'Persistent QR': [true, 'The Quick reply won\'t disappear after posting.'],
'Auto Hide QR': [false, 'Automatically hide the quick reply when posting.'],
'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'],
'Per Board Persona': [false, 'Remember Name, Email, Subject, etc per board instead of globally.'],
'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'],
'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'],
'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'],
'Remember Sage': [false, 'Remember email even if it contains sage.'],
'Markdown': [false, 'Code, italic, bold, italic bold, double struck - `, *, **, ***, ||, respectively. _ can be used instead of *.']
},
Quoting: {
'Quote Backlinks': [true, 'Add quote backlinks'],
'OP Backlinks': [false, 'Add backlinks to the OP'],
'Quote Highlighting': [true, 'Highlight the previewed post'],
'Quote Inline': [true, 'Show quoted post inline on quote click'],
'Quote Hash Navigation': [true, 'Show a "#" to jump around the thread as if Quote Inline were disabled.'],
'Quote Preview': [true, 'Show quote content on hover'],
'Resurrect Quotes': [true, 'Linkify dead quotes to archives'],
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'],
'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'],
'Forward Hiding': [true, 'Hide original posts of inlined backlinks']
}
},
filter: {
name: "# Filter any namefags:\n#/^(?!Anonymous$)/",
uniqueid: "# Filter a specific ID:\n#/Txhvk1Tl/",
tripcode: "# Filter any tripfags\n#/^!/",
mod: "# Set a custom class for mods:\n#/Mod$/;highlight:mod;op:yes\n# Set a custom class for moot:\n#/Admin$/;highlight:moot;op:yes",
email: "# Filter any e-mails that are not `sage` on /a/ and /jp/:\n#/^(?!sage$)/;boards:a,jp",
subject: "# Filter Generals on /v/:\n#/general/i;boards:v;op:only'",
comment: "# Filter Stallman copypasta on /g/:\n#/what you\'re refer+ing to as linux/i;boards:g",
country: '',
filename: '',
dimensions: "# Highlight potential wallpapers:\n#/1920x1080/;op:yes;highlight;top:no;boards:w,wg",
filesize: '',
md5: ''
},
sauces: "http://iqdb.org/?url=$1\nhttp://www.google.com/searchbyimage?image_url=$1\n#http://tineye.com/search?url=$1\n#http://saucenao.com/search.php?db=999&url=$1\n#http://3d.iqdb.org/?url=$1\n#http://regex.info/exif.cgi?imgurl=$2\n# uploaders:\n#http://imgur.com/upload?url=$2;text:Upload to imgur\n#http://omploader.org/upload?url1=$2;text:Upload to omploader\n# \"View Same\" in archives:\n#http://archive.foolz.us/_/search/image/$3/;text:View same on foolz\n#http://archive.foolz.us/$4/search/image/$3/;text:View same on foolz /$4/\n#https://archive.installgentoo.net/$4/image/$3;text:View same on installgentoo /$4/",
time: '%m/%d/%y(%a)%H:%M',
backlink: '>>%id',
fileInfo: '%l (%p%s, %r)',
favicon: 'ferongr',
updateIncrease: '5,10,15,20,30,60,90,120,240,300',
updateIncreaseB: '5,10,15,20,30,60,90,120,240,300',
customCSS: "/* Tripcode Italics: */\n/*\nspan.postertrip {\n font-style: italic;\n}\n*/\n\n/* Add a rounded border to thumbnails (but not expanded images): */\n/*\n.fileThumb > img:first-child {\n border: solid 2px rgba(0,0,100,0.5);\n border-radius: 10px;\n}\n*/\n\n/* Make highlighted posts look inset on the page: */\n/*\ndiv.post:target,\ndiv.post.highlight {\n box-shadow: inset 2px 2px 2px rgba(0,0,0,0.2);\n}\n*/",
hotkeys: {
openQR: ['I', 'Open QR with post number inserted'],
openEmptyQR: ['i', 'Open QR without post number inserted'],
openOptions: ['ctrl+o', 'Open Options'],
close: ['Esc', 'Close Options or QR'],
spoiler: ['ctrl+s', 'Quick spoiler tags'],
math: ['ctrl+m', 'Quick math tags'],
eqn: ['ctrl+e', 'Quick eqn tags'],
code: ['alt+c', 'Quick code tags'],
sageru: ['alt+n', 'Sage keybind'],
submit: ['alt+s', 'Submit post'],
hideQR: ['h', 'Toggle hide status of QR'],
toggleCatalog: ['alt+t', 'Toggle links in nav bar'],
watch: ['w', 'Watch thread'],
update: ['u', 'Update now'],
unreadCountTo0: ['z', 'Mark thread as read'],
expandImage: ['m', 'Expand selected image'],
expandAllImages: ['M', 'Expand all images'],
zero: ['0', 'Jump to page 0'],
nextPage: ['L', 'Jump to the next page'],
previousPage: ['H', 'Jump to the previous page'],
nextThread: ['n', 'See next thread'],
previousThread: ['p', 'See previous thread'],
expandThread: ['e', 'Expand thread'],
openThreadTab: ['o', 'Open thread in new tab'],
openThread: ['O', 'Open thread in current tab'],
nextReply: ['J', 'Select next reply'],
previousReply: ['K', 'Select previous reply'],
hide: ['x', 'Hide thread']
},
updater: {
checkbox: {
'Beep': [false, 'Beep on new post to completely read thread'],
'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'],
'Scroll BG': [false, 'Scroll background tabs'],
'Verbose': [true, 'Show countdown timer, new post count'],
'Auto Update': [true, 'Automatically fetch new posts']
},
Interval: 30,
BGInterval: 60
},
embedWidth: 640,
embedHeight: 390,
style: {
Interface: {
'Single Column Mode': [true, 'Presents options in a single column, rather than in blocks.'],
'Sidebar': ['normal', 'Alter the sidebar size. Completely hiding it can cause content to overlap, but with the correct option combinations can create a minimal 4chan layout that has more efficient screen real-estate than vanilla 4chan.', ['large', 'normal', 'minimal', 'hide']],
'Sidebar Location': ['right', 'The side of the page the sidebar content is on. It is highly recommended that you do not hide the sidebar if you change this option.', ['left', 'right']],
'Top Thread Padding': ['0', 'Add some spacing between the top edge of document and the threads.', 'text'],
'Bottom Thread Padding': ['0', 'Add some spacing between the bottom edge of document and the threads.', 'text'],
'Left Thread Padding': ['0', 'Add some spacing between the left edge of document and the threads.', 'text'],
'Right Thread Padding': ['0', 'Add some spacing between the right edge of document and the threads.', 'text'],
'Announcements': ['slideout', 'The style of announcements and the ability to hide them.', ['4chan default', 'slideout', 'hide']],
'Board Title': ['at sidebar top', 'The positioning of the board\'s logo and subtitle.', ['at sidebar top', 'at sidebar bottom', 'at top', 'under post form', 'hide']],
'Custom Board Titles': [false, 'Customize Board Titles by shift-clicking the board title or subtitle.'],
'Board Subtitle': [true, 'Show the board subtitle.'],
'4chan Banner': ['at sidebar top', 'The positioning of 4chan\'s image banner.', ['at sidebar top', 'at sidebar bottom', 'under post form', 'at top', 'hide']],
'4chan Banner Reflection': [false, 'Adds reflection effects to 4chan\'s image banner.'],
'Faded 4chan Banner': [true, 'Make 4chan\'s image banner translucent.'],
'Icon Orientation': ['horizontal', 'Change the orientation of the appchan x icons.', ['horizontal', 'vertical']],
'Slideout Watcher': [true, 'Adds an icon you can hover over to show the watcher, as opposed to having the watcher always visible.'],
'Updater Position': ['top', 'The position of 4chan thread updater and stats', ['top', 'bottom', 'moveable']]
},
Posts: {
'Alternate Post Colors': [false, 'Make post background colors alternate every other post.'],
'Color Reply Headings': [false, 'Give the post info a background.'],
'Color File Info': [false, 'Give the file info a background.'],
'OP Background': [false, 'Adds a border and background color to the OP Post, as if it were a reply.'],
'Backlinks Position': ['default', 'The position of backlinks in relation to the post.', ['default', 'lower left', 'lower right']],
'Sage Highlighting': ['image', 'Icons or text to highlight saged posts.', ['text', 'image', 'none']],
'Sage Highlight Position': ['after', 'Position of Sage Highlighting', ['before', 'after']],
'Filtered Backlinks': [true, 'Mark backlinks to filtered posts.'],
'Force Reply Break': [false, 'Force replies to occupy their own line and not be adjacent to the OP image.'],
'Fit Width Replies': [true, 'Replies fit the entire width of the page.'],
'Hide Delete UI': [false, 'Hides vanilla report and delete functionality and UI. This does not affect Appchan\'s Menu functionality.'],
'Post Spacing': ['2', 'The amount of space between replies.', 'text'],
'Vertical Post Padding': ['5', 'The vertical padding around post content of replies.', 'text'],
'Horizontal Post Padding': ['20', 'The horizontal padding around post content of replies.', 'text'],
'Hide Horizontal Rules': [false, 'Hides lines between threads.'],
'Images Overlap Post Form': [true, 'Images expand over the post form and sidebar content, usually used with "Expand images" set to "full".']
},
Aesthetics: {
'4chan SS Navigation': [false, 'Try to emulate the appearance of 4chan SS\'s Navigation.'],
'4chan SS Sidebar': [false, 'Try to emulate the appearance of 4chan SS\'s Sidebar.'],
'Block Ads': [false, 'Block advertisements. It\'s probably better to use AdBlock for this.'],
'Shrink Ads': [false, 'Make 4chan advertisements smaller.'],
'Bolds': [true, 'Bold text for names and such.'],
'Italics': [false, 'Give tripcodes italics.'],
'Sidebar Glow': [false, 'Adds a glow to the sidebar\'s text.'],
'Circle Checkboxes': [false, 'Make checkboxes circular.'],
'Custom CSS': [false, 'Add (more) custom CSS to Appchan X'],
'Emoji': ['enabled', 'Enable emoji', ['enabled', 'disable ponies', 'only ponies', 'disable']],
'Emoji Position': ['before', 'Position of emoji icons, like sega and neko.', ['before', 'after']],
'Emoji Spacing': ['5', 'Add some spacing between emoji and text.', 'text'],
'Font': ['sans-serif', 'The font used by all elements of 4chan.', 'text'],
'Font Size': ['12', 'The font size of posts and various UI. This changes most, but not all, font sizes.', 'text'],
'Icons': ['oneechan', 'Icon theme which Appchan will use.', ['oneechan', '4chan SS']],
'Invisible Icons': [false, 'Makes icons invisible unless hovered. Invisible really is "invisible", so don\'t use it if you don\'t have your icons memorized or don\'t use keybinds.'],
'Quote Shadows': [true, 'Add shadows to the quote previews and inline quotes.'],
'Rounded Edges': [false, 'Round the edges of various 4chan elements.'],
'Underline Links': [false, 'Put lines under hyperlinks.'],
'NSFW/SFW Themes': [false, 'Choose your theme based on the SFW status of the board you are viewing.']
},
Mascots: {
'Mascots': [true, 'Add a pretty picture of your waifu to Appchan.'],
'Mascot Location': ['sidebar', 'Change where your mascot is located.', ['sidebar', 'opposite']],
'Mascot Position': ['default', 'Change where your mascot is placed in relation to the post form.', ['above post form', 'default', 'bottom']],
'Mascots Overlap Posts': [true, 'Mascots overlap threads and posts.'],
'NSFW/SFW Mascots': [false, 'Enable or disable mascots based on the SFW status of the board you are viewing.'],
'Grayscale Mascots': [false, 'Force mascots to be monochrome.'],
'Mascot Opacity': ['1.00', 'Make Mascots transparent.', 'text'],
'Hide Mascots on Catalog': [false, 'Do not show mascots on the official catalog pages.']
},
Navigation: {
'Boards Navigation': ['sticky top', 'The position of 4chan board navigation', ['sticky top', 'sticky bottom', 'top', 'hide']],
'Navigation Alignment': ['center', 'Change the text alignment of the navigation.', ['left', 'center', 'right']],
'Slideout Navigation': ['compact', 'How the slideout navigation will be displayed.', ['compact', 'list', 'hide']],
'Pagination': ['sticky bottom', 'The position of 4chan page navigation', ['sticky top', 'sticky bottom', 'top', 'bottom', 'on side', 'hide']],
'Pagination Alignment': ['center', 'Change the text alignment of the pagination.', ['left', 'center', 'right']],
'Hide Navigation Decorations': [false, 'Hide non-link text in the board navigation and pagination. This also disables the delimiter in <code>Custom Navigation</code>']
},
'Post Form': {
'Compact Post Form Inputs': [true, 'Use compact inputs on the post form.'],
'Hide Show Post Form': [false, 'Hides the "Show Post Form" button when Persistent QR is disabled.'],
'Show Post Form Header': [false, 'Force the Post Form to have a header.'],
'Post Form Style': ['tabbed slideout', 'How the post form will sit on the page.', ['fixed', 'slideout', 'tabbed slideout', 'transparent fade', 'float']],
'Post Form Slideout Transitions': [true, 'Animate slideouts for the post form.'],
'Post Form Decorations': [false, 'Add a border and background to the post form (does not apply to the "float" post form style.'],
'Textarea Resize': ['vertical', 'Options to resize the post form\'s comment box.', ['both', 'horizontal', 'vertical', 'none']],
'Tripcode Hider': [true, 'Intelligent name field hiding.']
}
},
theme: 'Yotsuba B',
mascot: ''
};
if (!/^[a-z]+\.4chan\.org$/.test(location.hostname)) {
return;
}
Conf = {};
editTheme = {};
editMascot = {};
userNavigation = {};
d = document;
g = {};
g.TYPE = 'sfw';
MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver;
/*
loosely follows the jquery api:
http://api.jquery.com/
not chainable
*/
$ = function(selector, root) {
var result;
root || (root = d.body);
if (result = root.querySelector(selector)) {
return result;
}
};
$.extend = function(object, properties) {
var key, val;
for (key in properties) {
val = properties[key];
object[key] = val;
}
};
$.extend(Array.prototype, {
add: function(object, position) {
var keep;
keep = this.slice(position);
this.length = position;
this.push(object);
return this.pushArrays(keep);
},
contains: function(object) {
return this.indexOf(object) > -1;
},
indexOf: function(object) {
var i;
i = this.length;
while (i--) {
if (this[i] === object) {
break;
}
}
return i;
},
pushArrays: function() {
var arg, args, _i, _len;
args = arguments;
for (_i = 0, _len = args.length; _i < _len; _i++) {
arg = args[_i];
this.push.apply(this, arg);
}
return this;
},
remove: function(object) {
var index;
if ((index = this.indexOf(object)) > -1) {
return this.splice(index, 1);
} else {
return false;
}
}
});
$.extend(String.prototype, {
capitalize: function() {
return this.charAt(0).toUpperCase() + this.slice(1);
},
contains: function(string) {
return this.indexOf(string) > -1;
}
});
$.DAY = 24 * ($.HOUR = 60 * ($.MINUTE = 60 * ($.SECOND = 1000)));
$.extend($, {
NBSP: '\u00A0',
minmax: function(value, min, max) {
return (value < min ? min : value > max ? max : value);
},
log: typeof (_base = console.log).bind === "function" ? _base.bind(console) : void 0,
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(),
ready: function(fc) {
var cb;
if (['interactive', 'complete'].contains(d.readyState)) {
return setTimeout(fc);
}
if (!$.callbacks) {
$.callbacks = [];
cb = function() {
var callback, _i, _len, _ref;
_ref = $.callbacks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
callback = _ref[_i];
callback();
}
return $.off(d, 'DOMContentLoaded', cb);
};
$.on(d, 'DOMContentLoaded', cb);
}
$.callbacks.push(fc);
return $.on(d, 'DOMContentLoaded', cb);
},
sync: function(key, cb) {
var parse;
key = Main.namespace + key;
parse = JSON.parse;
return $.on(window, 'storage', function(e) {
if (e.key === key) {
return cb(parse(e.newValue));
}
});
},
id: function(id) {
return d.getElementById(id);
},
formData: function(arg) {
var fd, key, val;
if (arg instanceof HTMLFormElement) {
fd = new FormData(arg);
} else {
fd = new FormData();
for (key in arg) {
val = arg[key];
if (val) {
fd.append(key, val);
}
}
}
return fd;
},
ajax: function(url, callbacks, opts) {
var form, headers, key, r, type, upCallbacks, val;
if (!opts) {
opts = {};
}
type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form;
r = new XMLHttpRequest();
r.overrideMimeType('text/html');
type || (type = form && 'post' || 'get');
r.open(type, url, true);
for (key in headers) {
val = headers[key];
r.setRequestHeader(key, val);
}
$.extend(r, callbacks);
$.extend(r.upload, upCallbacks);
if (type === 'post') {
r.withCredentials = true;
}
r.send(form);
return r;
},
cache: function(url, cb) {
var req;
if (req = $.cache.requests[url]) {
if (req.readyState === 4) {
return cb.call(req);
} else {
return req.callbacks.push(cb);
}
} else {
req = $.ajax(url, {
onload: function() {
var _i, _len, _ref;
_ref = this.callbacks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
cb = _ref[_i];
cb.call(this);
}
},
onabort: function() {
return delete $.cache.requests[url];
},
onerror: function() {
return delete $.cache.requests[url];
}
});
req.callbacks = [cb];
return $.cache.requests[url] = req;
}
},
cb: {
checked: function() {
$.set(this.name, this.checked);
return Conf[this.name] = this.checked;
},
value: function() {
$.set(this.name, this.value.trim());
return Conf[this.name] = this.value;
}
},
addStyle: function(css, identifier) {
var style;
style = $.el('style', {
innerHTML: css,
id: identifier
});
$.add(d.head, style);
return style;
},
x: function(path, root) {
root || (root = d.body);
return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
},
X: function(path, root) {
root || (root = d.body);
return d.evaluate(path, root, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
},
addClass: function(el, className) {
return el.classList.add(className);
},
rmClass: function(el, className) {
return el.classList.remove(className);
},
toggleClass: function(el, className) {
return el.classList.toggle(className);
},
rm: function(el) {
return el.parentNode.removeChild(el);
},
tn: function(string) {
return d.createTextNode(string);
},
nodes: function(nodes) {
var frag, node, _i, _len;
if (!(nodes instanceof Array)) {
return nodes;
}
frag = $.frag();
for (_i = 0, _len = nodes.length; _i < _len; _i++) {
node = nodes[_i];
$.add(frag, node);
}
return frag;
},
frag: function() {
return d.createDocumentFragment();
},
add: function(parent, children) {
return parent.appendChild($.nodes(children));
},
prepend: function(parent, children) {
return parent.insertBefore($.nodes(children), parent.firstChild);
},
after: function(root, el) {
return root.parentNode.insertBefore($.nodes(el), root.nextSibling);
},
before: function(root, el) {
return root.parentNode.insertBefore($.nodes(el), root);
},
replace: function(root, el) {
return root.parentNode.replaceChild($.nodes(el), root);
},
el: function(tag, properties) {
var el;
el = d.createElement(tag);
if (properties) {
$.extend(el, properties);
}
return el;
},
on: function(el, events, handler) {
var event, _i, _len, _ref;
_ref = events.split(' ');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
event = _ref[_i];
el.addEventListener(event, handler, false);
}
},
off: function(el, events, handler) {
var event, _i, _len, _ref;
_ref = events.split(' ');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
event = _ref[_i];
el.removeEventListener(event, handler, false);
}
},
event: function(el, e) {
return el.dispatchEvent(e);
},
globalEval: function(code) {
var script;
script = $.el('script', {
textContent: "(" + code + ")()"
});
$.add(d.head, script);
return $.rm(script);
},
shortenFilename: function(filename, isOP) {
var threshold;
threshold = 30 + 10 * isOP;
if (filename.replace(/\.\w+$/, '').length > threshold) {
return "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/));
} else {
return filename;
}
},
bytesToString: function(size) {
var unit;
unit = 0;
while (size >= 1024) {
size /= 1024;
unit++;
}
size = unit > 1 ? Math.round(size * 100) / 100 : Math.round(size);
return "" + size + " " + ['B', 'KB', 'MB', 'GB'][unit];
},
hidden: function() {
return d.hidden || d.mozHidden || d.webkitHidden || d.oHidden;
}
});
$.cache.requests = {};
$.extend($, typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null ? {
"delete": function(name) {
name = Main.namespace + name;
return GM_deleteValue(name);
},
get: function(name, defaultValue) {
var value;
name = Main.namespace + name;
if ((value = GM_getValue(name)) && value !== 'undefined') {
return JSON.parse(value);
} else {
return defaultValue;
}
},
set: function(name, value) {
name = Main.namespace + name;
localStorage.setItem(name, JSON.stringify(value));
return GM_setValue(name, JSON.stringify(value));
},
open: function(url) {
return GM_openInTab(location.protocol + url, true);
}
} : {
"delete": function(name) {
return localStorage.removeItem(Main.namespace + name);
},
get: function(name, defaultValue) {
var value;
if (value = localStorage.getItem(Main.namespace + name)) {
return JSON.parse(value);
} else {
return defaultValue;
}
},
set: function(name, value) {
return localStorage.setItem(Main.namespace + name, JSON.stringify(value));
},
open: function(url) {
return window.open(location.protocol + url, '_blank');
}
});
$$ = function(selector, root) {
var result;
root || (root = d.body);
if (result = __slice.call(root.querySelectorAll(selector))) {
return result;
}
return null;
};
UI = {
dialog: function(id, position, html) {
var el, move;
el = $.el('div', {
className: 'reply dialog',
innerHTML: html,
id: id
});
el.style.cssText = $.get(id + ".position", position);
if (move = $('.move', el)) {
move.addEventListener('mousedown', UI.dragstart, false);
}
return el;
},
dragstart: function(e) {
var el, rect;
e.preventDefault();
UI.el = el = this.parentNode;
d.addEventListener('mousemove', UI.drag, false);
d.addEventListener('mouseup', UI.dragend, false);
rect = el.getBoundingClientRect();
UI.dx = e.clientX - rect.left;
UI.dy = e.clientY - rect.top;
UI.width = d.documentElement.clientWidth - rect.width;
return UI.height = d.documentElement.clientHeight - rect.height;
},
drag: function(e) {
var left, style, top;
left = e.clientX - UI.dx;
top = e.clientY - UI.dy;
left = left < 10 ? '0px' : UI.width - left < 10 ? null : left + 'px';
top = top < 10 ? '0px' : UI.height - top < 10 ? null : top + 'px';
style = UI.el.style;
style.left = left;
style.top = top;
style.right = left === null ? '0px' : null;
return style.bottom = top === null ? '0px' : null;
},
dragend: function() {
$.set(UI.el.id + ".position", UI.el.style.cssText);
d.removeEventListener('mousemove', UI.drag, false);
d.removeEventListener('mouseup', UI.dragend, false);
return delete UI.el;
},
hover: function(e, mode) {
var clientHeight, clientWidth, clientX, clientY, height, style, top, _ref;
clientX = e.clientX, clientY = e.clientY;
style = UI.el.style;
_ref = d.documentElement, clientHeight = _ref.clientHeight, clientWidth = _ref.clientWidth;
height = UI.el.offsetHeight;
if ((mode || 'default') === 'default') {
top = clientY - 120;
style.top = "" + (clientHeight <= height || top <= 0 ? 0 : top + height >= clientHeight ? clientHeight - height : top) + "px";
if (clientX <= clientWidth - 400) {
style.left = clientX + 45 + 'px';
return style.right = null;
} else {
style.left = null;
style.right = clientWidth - clientX + 20 + 'px';
return top = clientY - 120;
}
} else {
if (clientX <= clientWidth - 400) {
style.left = clientX + 20 + 'px';
style.right = null;
top = clientY;
} else {
style.left = null;
style.right = clientWidth - clientX + 20 + 'px';
top = clientY - 120;
}
return style.top = "" + (clientHeight <= height || top <= 0 ? 0 : top + height >= clientHeight ? clientHeight - height : top) + "px";
}
},
hoverend: function() {
$.rm(UI.el);
return delete UI.el;
}
};
Options = {
init: function() {
var a;
if (!$.get('firstrun')) {
$.set('firstrun', true);
if (!Favicon.el) {
Favicon.init();
}
Options.dialog();
}
a = $.el('a', {
id: 'appchanOptions',
title: 'Appchan X Settings',
href: 'javascript:;'
});
$.on(a, 'click', function() {
return Options.dialog();
});
return $.replace($.id('settingsWindowLink'), a);
},
dialog: function(tab) {
var archiver, arr, back, category, checked, customCSS, description, dialog, div, favicon, fileInfo, filter, height, hiddenNum, hiddenThreads, input, key, label, li, liHTML, name, obj, optionname, optionvalue, overlay, sauce, selectoption, styleSetting, time, toSelect, tr, ul, updateIncrease, updateIncreaseB, value, width, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4;
if (Conf['editMode'] === "theme") {
if (confirm("Opening the options dialog will close and discard any theme changes made with the theme editor.")) {
ThemeTools.close();
}
return;
}
if (Conf['editMode'] === "mascot") {
if (confirm("Opening the options dialog will close and discard any mascot changes made with the mascot editor.")) {
MascotTools.close();
}
return;
}
d.body.style.overflow = 'hidden';
dialog = Options.el = $.el('div', {
id: 'options',
className: 'reply dialog',
innerHTML: '<div id=optionsbar>\
<div id=credits>\
<label for=apply>Apply</label>\
| <a target=_blank href=http://zixaphir.github.com/appchan-x/>AppChan X</a>\
| <a target=_blank href=https://raw.github.com/zixaphir/appchan-x/master/changelog>' + Main.version + '</a>\
| <a target=_blank href=http://zixaphir.github.com/appchan-x/#bug-report>Issues</a>\
</div>\
<div class=tabs>\
<label for=style_tab id=selected_tab>Style</label><label for=theme_tab>Themes</label><label for=mascot_tab>Mascots</label><label for=main_tab>Script</label><label for=filter_tab>Filter</label><label for=sauces_tab>Sauce</label><label for=keybinds_tab>Keybinds</label><label for=rice_tab>Rice</label>\
</div>\
</div>\
<div id=optionsContent>\
<input type=radio name=tab hidden id=main_tab>\
<div class=main_tab></div>\
<input type=radio name=tab hidden id=sauces_tab>\
<div class=sauces_tab>\
<div class=warning><code>Sauce</code> is disabled.</div>\
Lines starting with a <code>#</code> will be ignored.<br>\
You can specify a certain display text by appending <code>;text:[text]</code> to the url.\
<ul>These parameters will be replaced by their corresponding values:\
<li>$1: Thumbnail url.</li>\
<li>$2: Full image url.</li>\
<li>$3: MD5 hash.</li>\
<li>$4: Current board.</li>\
</ul>\
<textarea name=sauces id=sauces class=field></textarea>\
</div>\
<input type=radio name=tab hidden id=filter_tab>\
<div class=filter_tab>\
<div class=warning><code>Filter</code> is disabled.</div>\
<select name=filter>\
<option value=guide>Guide</option>\
<option value=name>Name</option>\
<option value=uniqueid>Unique ID</option>\
<option value=tripcode>Tripcode</option>\
<option value=mod>Admin/Mod</option>\
<option value=email>E-mail</option>\
<option value=subject>Subject</option>\
<option value=comment>Comment</option>\
<option value=country>Country</option>\
<option value=filename>Filename</option>\
<option value=dimensions>Image dimensions</option>\
<option value=filesize>Filesize</option>\
<option value=md5>Image MD5 (uses exact string matching, not regular expressions)</option>\
</select>\
</div>\
<input type=radio name=tab hidden id=rice_tab>\
<div class=rice_tab>\
<ul>\
Archiver\
<li>\
Select an Archiver for this board:\
<select name=archiver></select>\
</li>\
</ul>\
<div class=warning><code>Quote Backlinks</code> are disabled.</div>\
<ul>\
Backlink formatting\
<li><input name=backlink class=field> : <span id=backlinkPreview></span></li>\
</ul>\
<div class=warning><code>Time Formatting</code> is disabled.</div>\
<ul>\
Time formatting\
<li><input name=time class=field> : <span id=timePreview></span></li>\
<li>Supported <a href=http://en.wikipedia.org/wiki/Date_%28Unix%29#Formatting>format specifiers</a>:</li>\
<li>Day: %a, %A, %d, %e</li>\
<li>Month: %m, %b, %B</li>\
<li>Year: %y</li>\
<li>Hour: %k, %H, %l (lowercase L), %I (uppercase i), %p, %P</li>\
<li>Minutes: %M</li>\
<li>Seconds: %S</li>\
</ul>\
<div class=warning><code>File Info Formatting</code> is disabled.</div>\
<ul>\
File Info Formatting\
<li><input name=fileInfo class=field> : <span id=fileInfoPreview class=fileText></span></li>\
<li>Link: %l (lowercase L, truncated), %L (untruncated), %t (Unix timestamp)</li>\
<li>Original file name: %n (truncated), %N (untruncated), %T (Unix timestamp)</li>\
<li>Spoiler indicator: %p</li>\
<li>Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)</li>\
<li>Resolution: %r (Displays PDF on /po/, for PDFs)</li>\
</ul>\
<ul>\
Specify size of video embeds<br>\
Height: <input name=embedHeight type=number />px\
|\
Width: <input name=embedWidth type=number />px\
<button name=resetSize>Reset</button>\
</ul>\
<ul>\
<li>Amounts for Optional Increase</li>\
<li>Visible tab</li>\
<li><input name=updateIncrease class=field></li>\
<li>Background tab</li>\
<li><input name=updateIncreaseB class=field></li>\
</ul>\
<div class=warning><code>Custom Navigation</code> is disabled.</div>\
<div id=customNavigation>\
</div>\
<div class=warning><code>Per Board Persona</code> is disabled.</div>\
<div id=persona>\
<select name=personaboards></select>\
<ul>\
<li>\