-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBooru-mass-editor.user.js
1613 lines (1514 loc) · 76.7 KB
/
Booru-mass-editor.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 Booru mass editor
// @description Quickly edit images at websites running Gelbooru software
// @version 5
// @author usernam
// @include https://*.booru.org/index.php*
// @include http*://safebooru.org/index.php*
// @include https://rule34.xxx/index.php*
// @include https://anime-pictures.net/*
// @include https://xbooru.com/index.php*
// @include https://bboy.booru.org/index.php*
// @include https://gelbooru.com/index.php*
// @include https://danbooru.donmai.us/*
// @include https://furry.booru.org/index.php*
// @include https://chan.sankakucomplex.com/*
// @include https://tbib.org/*
// @include https://realbooru.com/*
// @grant none
// @noframes
// ==/UserScript==
// IDK if this does anything:
// if (!(/expires=/.test(document.cookie)))
// {
// document.cookie = "expires=Thu, 01 Jan 9999 00:00:00 UTC";
// }
// *********************** //
// Individual image pages: //
// *********************** //
if (window.location.href.match("&id=") &&
!(window.location.href.match(/(realbooru.com|rule34.xxx|xbooru.com|gelbooru.com|danbooru.donmai.us|furry.booru.org|tbib.org)/)))
{
// Part 1:
var ID = window.location.href.replace(/^.*&id=/g, "").replace(/#$/g, "");
var IDnext = Number(ID) + 1;
var IDnextx2 = IDnext + 1;
var IDnextx3 = IDnext + 2;
var IDprev = Number(ID) - 1;
var IDprevx2 = IDprev - 1;
var IDprevx3 = IDprev - 2;
var booruName = document.getElementsByTagName("h2")[0].textContent;
var score = document.getElementById("post-view").innerHTML.match(/<a id="psc">\d+<\/a>/g);
var sidebar = document.getElementById("tag_list").innerHTML;
var imageSrc = document.getElementById("image").src;
var imageSrcOneDir = imageSrc.substring(imageSrc.lastIndexOf("//") + 9, imageSrc.lastIndexOf("/"));
var imageSrcThumb = document.getElementById("image").src.replace(/img\.booru\.org/g, "thumbs.booru.org")
.replace(/\/\/images\//g, "/thumbnails//")
.replace(/\/\/\d+\//g, "//" + imageSrcOneDir + "/thumbnail_");
var imageSrcExt = imageSrc.replace(/^.*\./g, "").toUpperCase().replace(/JPEG/g, "JPG");
var imageSizeWandH = sidebar.substring(sidebar.lastIndexOf(" Size: ") + 16,
sidebar.lastIndexOf(" <br>\n Source: "));
var imageSizeWidth = Number(imageSizeWandH.replace(/x\d+/g, ""));
var imageSizeHeight = Number(imageSizeWandH.replace(/\d+x/g, ""));
var userName = escape(sidebar.substring(sidebar.lastIndexOf(" By: ") + 14,
sidebar.lastIndexOf(" <br>\n Size:")));
var userCheckAnon = (userName !== 'Anonymous') ? "account_profile&uname=" : "post&s=list&tags=user%3A";
var timeYMD = sidebar.substring(sidebar.lastIndexOf(" Posted: ") + 18,
sidebar.lastIndexOf(" Posted: ") + 28);
var timeSpecific = sidebar.substring(sidebar.lastIndexOf(" Posted: ") + 29,
sidebar.lastIndexOf(" <br>\n By: "));
var parentID = document.getElementsByName("parent")[0].value;
document.getElementsByTagName("h2")[0].style.display = "inline";
document.getElementsByTagName("h2")[0].innerHTML += " ";
// 1.0 Improve $("title"):
if (document.getElementById("tags").value.match(" ")) {
document.getElementsByTagName("title")[0].innerHTML = booruName + " - " +
document.getElementById("tags").value.replace(/ /g, ", ").replace(/_/g, " ");
}
// 2.0 Top notifications of parent/child and "resized":
// 2.1 Display parent if viewing child and not "resized":
if (parentID !== "" && imageSizeWidth < 800) {
document.getElementById("post-view").innerHTML =
"<div style='background: #f0f0f0; padding: 10px; text-align: center; border: 3px solid #dadada;'>" +
"This post has a <a href='index.php?page=post&s=list&tags=parent:" + parentID +
"'><b>parent post</b></a>.</div><br><br>" +
document.getElementById("post-view").innerHTML;
}
// 2.2 Display parent if viewing child and "resized":
else if (parentID !== "" && imageSizeWidth > 800) {
document.getElementById("post-view").innerHTML =
"<div style='background: #f0f0f0; padding: 10px; text-align: center; border: 3px solid #dadada;'>" +
"This post has a <a href='index.php?page=post&s=list&tags=parent:" + parentID +
"'><b>parent post</b></a>.</div><br><div style='background: #f0f0f0; padding: 10px; text-align: " +
"center; border: 3px solid #dadada;'>This image has been \"resized\"; however, if you copy or " +
"save it then it will be the full sized version. Click to expand and contract.</div><br><br>" +
document.getElementById("post-view").innerHTML;
}
// 2.3 Display "resized" when viewing parent:
//else if (parentID == "" && imageSizeWidth > 800 && document.getElementById("post-view").match("<b>child posts</b>")) {
// document.getElementById("post-view").innerHTML =
// "<div style='background: #f0f0f0; padding: 10px; text-align: center; border: 3px solid #dadada;'>" +
// "This image has been \"resized\"; however, if you copy or save it then it will be the full sized " +
// "version. Click to expand and contract.</div><br>" +
// document.getElementById("post-view").innerHTML;
//}
// 2.4 Display "resized" if no parent/child:
else if (parentID == "" && imageSizeWidth > 800) {
document.getElementById("post-view").innerHTML =
"<div style='background: #f0f0f0; padding: 10px; text-align: center; border: 3px solid #dadada;'>" +
"This image has been \"resized\"; however, if you copy or save it then it will be the full sized " +
"version. Click to expand and contract.</div><br><br>" +
document.getElementById("post-view").innerHTML;
}
// 3.0 Improving $("#tag_list"):
// 3.1 Replace header "Tags" with "Tags (# | history)" where "#" is the amount of tags and "(# | history)" is red if # < 5:
var metadataHeader = document.createElement("h4");
metadataHeader.innerHTML = "Metadata";
document.getElementById("tag_list").insertBefore(metadataHeader, document.getElementById("tag_list").childNodes[0]);
if (document.getElementById("tags").value.match(" ")) {
var tagHistoryLink = " | <a href='index.php?page=history&type=tag_history&id=" + ID + "' style='color:#006ffa' " +
"onmouseover=\"this.style.color = '#33cfff'\" onmouseout=\"this.style.color = '#006ffa'\">history<" +
"/a> | <a href='index.php?page=post&s=list&tags=" +
document.getElementById("tags").value.replace(/ /g, "+") + "' style='color:#006ffa' onmouseover=\"" +
"this.style.color = '#33cfff'\" onmouseout=\"this.style.color = '#006ffa'\">uniqueness</a>)</small>";
if (document.getElementById("tags").value.match(/(^tagme | tagme | tagme$)/g)) {
if (document.getElementById("tags").value.match(/ /g).length > 4) {
var numberOfTags = "Tags <small>(" + document.getElementById("tags").value.match(/ /g).length + tagHistoryLink;
} else {
var numberOfTags = "Tags <small style='color:red'>(" + document.getElementById("tags").value.match(/ /g).length +
tagHistoryLink;
}
} else {
if (document.getElementById("tags").value.match(/ /g).length > 3) {
var numberOfTagsTemp = Number(document.getElementById("tags").value.match(/ /g).length) + 1;
var numberOfTags = "Tags <small>(" + numberOfTagsTemp + tagHistoryLink;
} else {
var numberOfTagsTemp = Number(document.getElementById("tags").value.match(/ /g).length) + 1;
var numberOfTags = "Tags <small style='color:red'>(" + numberOfTagsTemp + tagHistoryLink;
}
}
document.getElementsByTagName("h5")[1].innerHTML = numberOfTags;
}
// 3.2 Get the index of the first link that is a tag and the correct iteration offset to get tags from an array:
if (document.getElementById("navbar").innerHTML.match(">Mass Upload<") &&
!(document.getElementById("navbar").innerHTML.match("Booru.org Imageboard Network</strong></a> »"))) {
var tagListq = 11;
} else if (document.getElementById("navbar").innerHTML.match(">Mass Upload<") &&
document.getElementById("navbar").innerHTML.match("Booru.org Imageboard Network</strong></a> »")) {
var tagListq = 11;
} else {
var tagListq = 10;
}
if (document.getElementById("tags").value.match(" ")) {
for (i = 12; i < document.getElementById("tags").value.match(/ /g).length + 14; i++) {
// 3.3 Color artist, character, and copyright tags:
if (!(document.getElementsByTagName("a")[i].href
.match(/(_\((artist|character|copyright)\)\+|\+.*_\((artist|character|copyright)\)$)/g))) {
if (document.getElementsByTagName("a")[i].href.match(/_\(artist\)/g)) {
document.getElementsByTagName("a")[i].style.color = "#A00";
document.getElementsByTagName("a")[i].setAttribute("onmouseover", "this.style.color = '#9093ff'");
document.getElementsByTagName("a")[i].setAttribute("onmouseout", "this.style.color = '#A00'");
} else if (document.getElementsByTagName("a")[i].href.match(/_\(character\)/g)) {
document.getElementsByTagName("a")[i].style.color = "#0A0";
document.getElementsByTagName("a")[i].setAttribute("onmouseover", "this.style.color = '#9093ff'");
document.getElementsByTagName("a")[i].setAttribute("onmouseout", "this.style.color = '#0A0'");
} else if (document.getElementsByTagName("a")[i].href.match(/_\(copyright\)/g)) {
document.getElementsByTagName("a")[i].style.color = "#A0A";
document.getElementsByTagName("a")[i].setAttribute("onmouseover", "this.style.color = '#9093ff'");
document.getElementsByTagName("a")[i].setAttribute("onmouseout", "this.style.color = '#A0A'");
}
}
// 3.4 If the tag is only on one image then "1" will be colored red:
if (document.getElementsByTagName("li")[i - 2].innerHTML.match(/<\/a> 1<\/span>/g)) {
document.getElementsByTagName("li")[i - 2].innerHTML = document.getElementsByTagName("li")[i - 2].innerHTML
.replace(/<\/a> 1<\/span>/g, "</a> <span style='color:red;'>1</span></span>");
}
// 3.5 Non breaking space between "? tag" and "#":
document.getElementsByTagName("li")[i - 2].innerHTML = document.getElementsByTagName("li")[i - 2].innerHTML
.replace(/<\/a> /g, "</a> ");
}
// 3.6 "?" - intended to link to a tag wiki, now links to a Google search of the tag (it is also appropriately colored):
for (i = 10; i < document.getElementById("tags").value.match(/ /g).length + 12; i++) {
var tagsArray = document.getElementById("tags").value.replace(/_/g, "+").split(" ");
if (document.getElementsByTagName("li")[i].innerHTML.match(/_\(artist\)/g)) {
document.getElementsByTagName("li")[i].innerHTML = document.getElementsByTagName("li")[i].innerHTML
.replace(/\? /g, "<a href='https://www.google.com/#q=" + escape(tagsArray[i - tagListq]) +
"' onmouseover=\"this.style.color = '#9093ff'\" onmouseout = \"this.style.color = '#A00'\"" +
"style='color:#A00;'>?</a> ");
} else if (document.getElementsByTagName("li")[i].innerHTML.match(/_\(character\)/g)) {
document.getElementsByTagName("li")[i].innerHTML = document.getElementsByTagName("li")[i].innerHTML
.replace(/\? /g, "<a href='https://www.google.com/#q=" + escape(tagsArray[i - tagListq]) +
"' onmouseover=\"this.style.color = '#9093ff'\" onmouseout = \"this.style.color = '#0A0'\"" +
"style='color:#0A0;'>?</a> ");
} else if (document.getElementsByTagName("li")[i].innerHTML.match(/_\(copyright\)/g)) {
document.getElementsByTagName("li")[i].innerHTML = document.getElementsByTagName("li")[i].innerHTML
.replace(/\? /g, "<a href='https://www.google.com/#q=" + escape(tagsArray[i - tagListq]) +
"' onmouseover=\"this.style.color = '#9093ff'\" onmouseout = \"this.style.color = '#A0A'\"" +
"style='color:#A0A;'>?</a> ");
} else {
document.getElementsByTagName("li")[i].innerHTML = document.getElementsByTagName("li")[i].innerHTML
.replace(/\? /g, "<a href='https://www.google.com/#q=" + escape(tagsArray[i - tagListq]) +
"'>?</a> ");
}
}
}
// 4.0 Improving $("#my-tags"):
var getMyTagsText1 = document.getElementById("my-tags").textContent;
var getMyTagsText = getMyTagsText1.substring(0, getMyTagsText1.length - 1);
function refreshMyTags(sep) {
var getMyTagsAsArray = getMyTagsText.split(sep);
var myTagsNew = "";
for (i = 0; i < getMyTagsAsArray.length; i++) {
var myTagsMatchCase1 = new RegExp(" " + getMyTagsAsArray[i] + " ", "gi");
var myTagsMatchCase2 = new RegExp("^" + getMyTagsAsArray[i] + " ", "gi");
var myTagsMatchCase3 = new RegExp(" " + getMyTagsAsArray[i] + "$", "gi");
if (document.getElementById("tags").value.match(myTagsMatchCase1) ||
document.getElementById("tags").value.match(myTagsMatchCase2) ||
document.getElementById("tags").value.match(myTagsMatchCase3)) {
var myTagsBoldToggle = "if (document.getElementById('tags').value.match(/ /g)) { \
document.getElementById('tags').value = \
document.getElementById('tags').value.replace(/ /g, ' '); \
}; \
if (!(document.getElementById('tags').value.match(/ $/g))) { \
document.getElementById('tags').value = \
document.getElementById('tags').value + ' '; \
}; \
if (this.style.fontWeight == 'bold') { \
this.style.fontWeight = 'normal' \
} else { \
this.style.fontWeight = 'bold'; \
}; \
return false;\" style='font-weight:bold;'";
} else {
var myTagsBoldToggle = "if (document.getElementById('tags').value.match(/ /g)) { \
document.getElementById('tags').value = \
document.getElementById('tags').value.replace(/ /g, ' '); \
}; \
if (!(document.getElementById('tags').value.match(/ $/g))) { \
document.getElementById('tags').value = \
document.getElementById('tags').value + ' '; \
}; \
return false;\"";
}
if (getMyTagsAsArray[i].match(/.*?:.*?;.*?;/g)) {
var myTagsHiddenTags = "style='display:none;' ";
} else {
var myTagsHiddenTags = "";
}
myTagsNew += "<a " +
myTagsHiddenTags +
"href=\"index.php?page=post&s=list&tags=" +
escape(getMyTagsAsArray[i].toLowerCase()) +
"\" id=\"t_" +
escape(getMyTagsAsArray[i].toLowerCase()) +
"\" onclick=\"javascript:toggleTags('" +
escape(getMyTagsAsArray[i].toLowerCase()) +
"','tags','t_" +
escape(getMyTagsAsArray[i].toLowerCase()) +
"');" +
myTagsBoldToggle +
">"
+
getMyTagsAsArray[i]
+
"</a> ";
}
document.getElementById("my-tags").innerHTML = myTagsNew;
}
// 5.0 Replacing:
document.body.innerHTML =
document.body.innerHTML
// 5.1 Removing:
.replace(/<b>Score<\/b>.*Report post.<\/a>/g, "")
.replace(/Source<br>/g, "")
.replace(/Title<br>/g, "")
.replace(/Parent<br>/g, "")
.replace(/<br.*Posted on \d.* by <a href="index.php\?page=account_profile&uname=.*?<\/a>.*\n.*\n.*\n.*\n.*\n.*\n.*\d+">Next<\/a>/g, "")
.replace(/<a href="index.php\?page=post&s=view&id=\d+"><\/a><br>/g, "")
.replace(/0 comment<a href="#" id="ci" onclick="showHideIgnored\(\d{1,},'ci'\); return false;"> \(0 hidden\)<\/a><br><br><br>/g, "")
.replace(/Don't like these ads\? Want em removed or want to donate to booru.org\? Check out our Patreon!/g, "")
.replace(/>Next Post</g, "><")
.replace(/My Tags<br>/g, "<br>")
.replace(/ Posted: .* <br>/g, "")
.replace(/ Source: <br>/g, "")
// 5.2 Replacing:
.replace(/div style="float\: left; margin\: 1em 0"/g, "div style='float: left;'")
.replace(/ Id.*<br>/g, "<u>ID</u>: <a href='index.php?page=post&s=view&id=" + IDprevx3 + "'><small>-3</small></a> | " +
"<a href='index.php?page=post&s=view&id=" + IDprevx2 +
"'>-2</a> | <a href='index.php?page=post&s=view&id=" + IDprev + "'>-1</a> | " + ID +
" | <a href='index.php?page=post&s=view&id=" + IDnext + "'>+1</a> | <a href='index.php?page=post&s=view&id=" +
IDnextx2 + "'>+2</a> | <a href='index.php?page=post&s=view&id=" + IDnextx3 + "'><small>+3</small></a>" +
"<br><u>File format:</u> " + imageSrcExt + "<br>")
.replace(/ \d+:\d+:\d+ <br>\n By: /g, " (" + timeSpecific + ")<br> By: ")
.replace(/ By: .*? <br>/g, " <u>Uploader:</u> <a href='index.php?page=" + userCheckAnon + userName + "'>" + userName +
"</a><br>on " + timeYMD + " (" + timeSpecific + ")" + "<br>")
.replace(/ Size.*<br>/g, "<u>Size:</u> " + imageSizeWidth + " <b style='font-size:7.5pt;position:relative;top:-1px;'>×</b> " +
imageSizeHeight + " pixels<br>")
.replace(/ Source: /g, " <u>Source:</u> ")
.replace(/ Rating: /g, "<br><h4>Actions</h4><h5>Value judgements</h5><u>Rating:</u> ")
.replace(/ Score: \d+ <br>/g, " <u>Score:</u> " + score +
" (vote: <a href='#' onclick=\"post_vote('" + ID + "', 'up')\">up</a>/<a href='#' " +
"onclick=\"post_vote('" + ID + "', 'down')\">down</a>)<br><a href='#' onclick=\"addFav('" + ID +
"');post_vote('" + ID + "', 'up');" +
"return false;\">Favorite</a><br><a href='" + imageSrc + "' download='" + document.getElementById("tags").value +
" " + booruName + "#" + ID + "'>Download</a><br>" +
"<a href='#' id='rp" + ID + "' onclick=\"Element.toggle('report_form')\">Report</a><br>" +
"<a href='#' onclick=\"if(confirm('Are you sure you want to delete this post?')){var f = document.createElement('form');" +
"f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = './public/remove.php?id=" + ID +
"&removepost=1'; f.submit();}; return false;\">Remove</a>")
.replace(/<br \/><p id="note-count">/g, "<p id='note-count'>")
.replace(/<td>\n.*<br>\n.*<input /g, "<td><div style='height:4px;'></div><input ")
.replace(/Recent Tags<br>\n.*?\n.*?<\/td>/g, "</td>")
.replace(/Previous Post<br>/g, "<br>")
.replace(/<input name="submit" value="Save changes" type="submit">/g, "<input id='SubmitButton' style='position:relative;top:-80px;width:" +
"403px;height:100px;font-size:20pt;' name='submit' value='Save changes' type='submit'>")
.replace(/type="radio">Safe/g, "type='radio'>Safe (←Rating)")
.replace(/ type="text">\n <\/td><\/tr><tr><td>\n <input name="parent"/g, " type='text'> (←Title)<\/td><\/tr><tr><td><input " +
"name='parent'")
.replace(/ type="text">\n <\/td><\/tr><tr><td><br>\n <input name="next_post"/g, " type='text'> (←Parent) (↓Source)</td>" +
"</tr><tr><td><br><input style='display: none;' name='next_post'")
.replace(/<strong>Statistics<\/strong><br>/g, "<h5>Other</h5>")
// This should be switched on/off via the tags cookie
// .replace(/<textarea id="tags"/g, "<textarea id='tags' autofocus")
;
// Improve Search header (h5 ---> h4):
var headerNew = document.createElement("h4");
headerNew.appendChild(document.createTextNode("Search"));
var headerOld = document.getElementsByClassName("space")[0];
headerOld.replaceChild(headerNew, headerOld.children[0]);
// 6.0 Improving $("#image"):
document.getElementById("image").style.maxWidth = "800px";
document.getElementById("image").style.position = "relative";
document.getElementById("image").style.top = "-7px";
document.getElementById("image").addEventListener("click", function() {
if (document.getElementById("image").style.maxWidth == '800px') {
document.getElementById("image").style.maxWidth = 'none';
} else {
document.getElementById("image").style.maxWidth = '800px';
}
});
// 7.0 Set rating (based on ("#my-tags")):
if (document.getElementById("my-tags").textContent.match(/r:.*?;r;/g)) {
var myTagsSettingRating = true;
var myTagsSetRatingTag = document.getElementById("my-tags").textContent.replace(/.*r:/g, "").replace(/;r;.*/, "");
var myTagsSettingRatingInfo = "<li><u>Setting rating:</u> <code>" + myTagsSetRatingTag + "</code></li>";
for (i = 0; i < 3; i++) {
if (document.getElementsByName("rating")[i].value == myTagsSetRatingTag) {
document.getElementsByName("rating")[i].checked = true;
}
}
} else {
var myTagsSettingRating = false;
var myTagsSettingRatingInfo = "";
}
// 8.0 Delete source feild (based on ("#my-tags")):
if (document.getElementById("my-tags").textContent.match(/del:.*;del;/g)) {
if (document.getElementById("my-tags").textContent.match(/del:s;del;/g)) {
document.getElementById("source").value = "";
} else if (document.getElementById("my-tags").textContent.match(/del:t;del;/g)) {
document.getElementById("title").value = "";
} else if (document.getElementById("my-tags").textContent.match(/del:p;del;/g)) {
document.getElementsByName("parent")[0].value = "";
}
}
// 9.0 Remove "mass upload" text in feilds:
if (document.getElementById("title").value == "Booru mass uploader") {
document.getElementById("title").value = "";
}
/* if (document.getElementById("source").value == "https://ibsearch.xxx" ||
document.getElementById("source").value == "http://ibsearch.i-forge.net/mass-upload" ||
document.getElementById("source").value == "http://i-forge.net/imageboards/mass-upload" ||
document.getElementById("source").value == "Booru mass uploader") {
document.getElementById("source").value = "";
} */
// 10.0 Functions for adding and replacing tags:
function addTags(tagToAdd) {
var addTagMatchCases =
new RegExp("(^" + tagToAdd + " | " + tagToAdd + " | " + tagToAdd + "$)", "gi");
if (!(document.getElementById("tags").value.match(addTagMatchCases))) {
document.getElementById("tags").value = document.getElementById("tags").value + " " + tagToAdd + " ";
}
}
function replaceTags(tagToReplace, mc1to, mc2to, mc3to) {
var replaceTagMatchCase1 = new RegExp(" " + tagToReplace + " ", "gi");
var replaceTagMatchCase2 = new RegExp("^" + tagToReplace + " ", "gi");
var replaceTagMatchCase3 = new RegExp(" " + tagToReplace + "$", "gi");
if (document.getElementById("tags").value.match(replaceTagMatchCase1)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase1, mc1to);
}
if (document.getElementById("tags").value.match(replaceTagMatchCase2)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase2, mc2to);
}
if (document.getElementById("tags").value.match(replaceTagMatchCase3)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase3, mc3to);
}
}
function implyTags(tagImplyFrom, tagImplyTo) {
var implyFromMatchCases =
new RegExp("(^" + tagImplyFrom + " | " + tagImplyFrom + " | " + tagImplyFrom + "$)", "gi");
if (document.getElementById("tags").value.match(implyFromMatchCases)) {
addTags(tagImplyTo);
}
}
// 11.0 Dealing with the "tagme" tag:
// 11.1 Remove it if there is 10 other tags:
if (document.getElementById("tags").value.match(" ")) {
if (document.getElementById("my-tags").textContent.match(/tagmeif:lt\d+;endif;/g) &&
document.getElementById("tags").value.match(/(^tagme | tagme | tagme$)/g) &&
document.getElementById("tags").value.match(/ /g).length >= 10) {
replaceTags("tagme", " ", "", "");
}
} else {
// 11.2 Add it (based on ("#my-tags")):
if (document.getElementById("my-tags").textContent.match(/tagmeif:lt\d+;endif;/g) &&
document.getElementById("tags").value.match(/ /g).length <=
Number(document.getElementById("my-tags").textContent.replace(/.*tagmeif:lt/g, "").replace(/;endif;.*/, ""))) {
document.getElementById("tags").value = document.getElementById("tags").value + " tagme ";
}
}
// 12.0 Add resolution tags:
if (imageSizeWidth <= 500 && imageSizeHeight <= 500 && imageSrcExt !== "GIF") {
addTags("lowres");
}
if (imageSizeWidth >= 1600 && imageSizeHeight >= 1200) {
addTags("highres");
}
if (imageSizeWidth >= 3200 && imageSizeHeight >= 2400) {
addTags("absurdres");
}
if (imageSizeWidth >= 10000 && imageSizeHeight >= 10000) {
addTags("incredibly_absurdres");
}
if (imageSizeHeight > imageSizeWidth * 3) {
addTags("tall_image");
addTags("long_image");
}
if (imageSizeWidth == imageSizeHeight) {
addTags("1:1_aspect_ratio");
}
// 13.0 TAGGING OPERATIONS (based on ("#my-tags")):
// 13.1 Replace tags (doesn't work very well with parentheses in the "My Tags"):
if (document.getElementById("my-tags").textContent.match(/re:.*;re;/g)) {
var myTagsReplacing = true;
var myTagsReplaceTag = document.getElementById("my-tags").textContent.replace(/.*re:/g, "").replace(/;re;.*/g, "");
if (myTagsReplaceTag.match(/\|/g)) {
var myTagsReplaceTags = myTagsReplaceTag.split("|");
var myTagsReplaceTagsLefts = [];
var myTagsReplaceTagsRights = [];
for (i = 0; i < myTagsReplaceTags.length; i++) {
var myTagsReplaceTag1 = myTagsReplaceTags[i].replace(/_>_.*/g, "");
var myTagsReplaceTag2 = myTagsReplaceTags[i].replace(/.*_>_/g, "");
replaceTags(myTagsReplaceTag1, " " + myTagsReplaceTag2 + " ", myTagsReplaceTag2 + " ", " " + myTagsReplaceTag2);
myTagsReplaceTagsLefts[i] = myTagsReplaceTag1;
myTagsReplaceTagsRights[i] = myTagsReplaceTag2;
}
var myTagsReplaceTagInfo = "<li><u>Replacing tags:</u><br>";
for (i = 0; i < myTagsReplaceTagsLefts.length; i++) {
if (myTagsReplaceTagsLefts.length == 2) {
if (i == 0) {
var twoReplacements = "and<br>";
} else {
var twoReplacements = "";
}
myTagsReplaceTagInfo += "<code>" + myTagsReplaceTagsLefts[i] + "</code> → <code>" +
myTagsReplaceTagsRights[i] + "</code> " + twoReplacements;
} else {
if (i < myTagsReplaceTagsLefts.length - 2) {
var gtTwoReplacements = ",<br>";
} else if (i < myTagsReplaceTagsLefts.length - 1) {
var gtTwoReplacements = ", and<br>";
} else {
var gtTwoReplacements = "";
}
myTagsReplaceTagInfo += "<code>" + myTagsReplaceTagsLefts[i] + "</code> → <code>" +
myTagsReplaceTagsRights[i] + "</code>" + gtTwoReplacements;
}
}
myTagsReplaceTagInfo += "</li>";
} else {
var myTagsReplaceTag1 = myTagsReplaceTag.replace(/_>_.*/g, "");
var myTagsReplaceTag2 = myTagsReplaceTag.replace(/.*_>_/g, "");
replaceTags(myTagsReplaceTag1, " " + myTagsReplaceTag2 + " ", myTagsReplaceTag2 + " ", " " + myTagsReplaceTag2);
var myTagsReplaceTagInfo = "<li><u>Replacing:</u><br><code>" + myTagsReplaceTag1 + "</code> → <code>" +
myTagsReplaceTag2 + "</code></li>";
}
} else {
var myTagsReplacing = false;
var myTagsReplaceTagInfo = "";
}
// 13.2 Add tags:
if (document.getElementById("my-tags").textContent.match(/add:.*;add;/g)) {
var myTagsAdding = true;
var myTagsAddTag = document.getElementById("my-tags").textContent.replace(/.*add:/g, "").replace(/;add;.*/g, "");
if (myTagsAddTag.match("|")) {
var myTagsAddTags = myTagsAddTag.split("|");
} else {
var myTagsAddTags = myTagsAddTag;
}
if (typeof(myTagsAddTags) == "object") {
for (i = 0; i < myTagsAddTags.length; i++) {
addTags(myTagsAddTags[i]);
}
var myTagsAddTagInfo = "<li><u>Adding:</u> <code>" + myTagsAddTags.join(" ") + "</code></li>";
} else {
addTags(myTagsAddTags);
var myTagsAddTagInfo = "<li><u>Adding:</u> <code>" + myTagsAddTags + "</code></li>";
}
} else {
var myTagsAdding = false;
var myTagsAddTagInfo = "";
}
// 13.3 Remove tags:
if (document.getElementById("my-tags").textContent.match(/rm:.*;rm;/g)) {
var myTagsRming = true;
var myTagsRmTag = document.getElementById("my-tags").textContent.replace(/.*rm:/g, "").replace(/;rm;.*/g, "");
if (myTagsRmTag.match("|")) {
var myTagsRmTags = myTagsRmTag.split("|");
} else {
var myTagsRmTags = myTagsRmTag;
}
if (typeof(myTagsRmTags) == "object") {
for (i = 0; i < myTagsRmTags.length; i++) {
replaceTags(myTagsRmTags[i], " ", " ", " ");
}
var myTagsRmTagInfo = "<li><u>Removing:</u> <code>" + myTagsRmTags.join(" ") + "</code></li>";
} else {
replaceTags(myTagsRmTags, " ", "", "");
var myTagsRmTagInfo = "<li><u>Removing:</u> <code>" + myTagsRmTags + "</code></li>";
}
} else {
var myTagsRming = false;
var myTagsRmTagInfo = "";
}
// 13.4 Imply tags:
if (document.getElementById("my-tags").textContent.match(/im:.*;im;/g)) {
var myTagsImplyTag = document.getElementById("my-tags").textContent.replace(/.*im:/g, "").replace(/;im;.*/g, "");
if (myTagsImplyTag.match(/\|/g)) {
var myTagsImplyTags = myTagsImplyTag.split("|");
for (i = 0; i < myTagsImplyTags.length; i++) {
var myTagsImplyTag1 = myTagsImplyTags[i].replace(/_>_.*/g, "");
var myTagsImplyTag2 = myTagsImplyTags[i].replace(/.*_>_/g, "");
implyTags(myTagsImplyTag1, myTagsImplyTag2);
}
} else {
var myTagsImplyTag1 = myTagsImplyTag.replace(/_>_.*/g, "");
var myTagsImplyTag2 = myTagsImplyTag.replace(/.*_>_/g, "");
implyTags(myTagsImplyTag1, myTagsImplyTag2);
}
}
// 14.0 Move filename tags:
if (document.getElementById("tags").value.match(/[^ ]+\.(jpe?g|png|gif)/g) &&
(document.getElementById("source").value == "" ||
document.getElementById("title").value == "")) {
if (document.getElementById("source").value == "") {
document.getElementById("source").value =
document.getElementById("tags").value.match(/[^ ]+\.(jpe?g|png|gif)/g);
document.getElementById("tags").value =
document.getElementById("tags").value.replace(/ ?(\.+)?[^ ]+\.(jpe?g|png|gif) ?/g, " ");
} else if (document.getElementById("title").value == "") {
document.getElementById("title").value =
document.getElementById("tags").value.match(/[^ ]+\.(jpe?g|png|gif)/g);
document.getElementById("tags").value =
document.getElementById("tags").value.replace(/ ?(\.+)?[^ ]+\.(jpe?g|png|gif) ?/g, " ");
}
}
// 14.1 Move UNIX timestamp:
if (document.getElementById("tags").value.match(/^\d{13}/g) &&
(document.getElementById("source").value == "" ||
document.getElementById("title").value == "")) {
if (document.getElementById("source").value == "") {
document.getElementById("source").value = document.getElementById("tags").value.match(/\d{13}/g);
document.getElementById("tags").value = document.getElementById("tags").value.replace(/\d{13} /g, "");
} else if (document.getElementById("title").value == "") {
document.getElementById("title").value = document.getElementById("tags").value.match(/\d{13}/g);
document.getElementById("tags").value = document.getElementById("tags").value.replace(/\d{13} /g, "");
}
}
// 15.0 Add " " at the end and replace " " with " ":
document.getElementById("tags").value = document.getElementById("tags").value + " ";
document.getElementById("tags").value = document.getElementById("tags").value.replace(/ /g, " ");
// 16.0 Changing visibility
// 16.1 Hiding:
document.getElementById("previous_post").style.display = "none";
document.getElementById("next_post").style.display = "none";
// 16.2 Unhiding:
document.getElementById("edit_form").style.display = "block";
// 17.0 Positioning:
document.getElementById("source").style.position = "relative";
document.getElementById("source").style.top = "-40px";
document.getElementById("tags").style.position = "relative";
document.getElementById("tags").style.top = "-55px";
document.getElementById("my-tags").style.position = "relative";
document.getElementById("my-tags").style.top = "-72px";
// 17.1 "Save changes" button:
document.getElementsByName("submit")[1].style.width = "403px";
document.getElementsByName("submit")[1].style.height = "100px";
document.getElementsByName("submit")[1].style.fontSize = "20pt";
if (document.getElementById("my-tags").innerHTML.match("save:top;save;")) {
document.getElementsByName("submit")[1].style.position = "absolute";
document.getElementsByName("submit")[1].style.top = "0";
} else {
document.getElementsByName("submit")[1].style.position = "relative";
document.getElementsByName("submit")[1].style.top = "-80px";
}
// 18.0 Improve $("#my-tags") onload and onkeyup:
// 18.1 Update $("#my-tags") when typing:
document.getElementById("tags").addEventListener("keyup", function(e) {
if (getMyTagsText.match(/\+/g)) {
refreshMyTags("+");
} else {
refreshMyTags(" ");
}
});
// 18.2 Update $("#my-tags") when the page loads (sometimes this fails):
window.addEventListener("load", function(e) {
if (getMyTagsText.match(/\+/g)) {
refreshMyTags("+");
} else {
refreshMyTags(" ");
}
});
// 19.0 Mass edit tags: submission of changes a second or less after the page loads (based on ("#my-tags")):
function htmlDecode(input){
var e = document.createElement('span');
e.innerHTML = input;
return e.childNodes[0].nodeValue;
}
function simulateClickSubmit(element)
{
var oEvent = document.createEvent('MouseEvents');
oEvent.initMouseEvent("click", true, true, document.defaultView,
0, 0, 0, 0, 0, false, false, false, false, 0, element);
element.dispatchEvent(oEvent);
}
if (document.getElementById("my-tags").textContent.match(/op:onload;op;/g))
{
var myTagsSubmitOnLoadInfo = "<li><span style='font-size:400%;position:relative;top:-15px;'>☞</span> " +
"<span style='position:relative;top:-30px;'>Submitting tag<br>" +
"operation(s) on page load</li>";
if (htmlDecode(document.getElementById("tags").innerHTML) + " " !== document.getElementById("tags").value)
{
simulateClickSubmit(document.getElementsByName("submit")[1]);
}
if (document.getElementById("my-tags").textContent.match(/close:(1|yes);close;/g))
{
window.addEventListener("load", function() {
window.close();
});
}
} else {
var myTagsSubmitOnLoadInfo = "";
}
// 20.0 Add reverse search section:
var reverseSearch = document.createElement("ul");
reverseSearch.style.cssText = "max-width:20em;position:relative;bottom:125px;";
reverseSearch.innerHTML =
"<h5>Reverse search</h5> " +
"<li><a href='http://www.google.com/searchbyimage?image_url=" + imageSrc + "'>Google</a> (for general images)</li> " +
"<li><a href='http://iqdb.org/?url=" + imageSrc + "'>iqdb</a> (for anime images)</li>";
document.getElementById("tag_list").appendChild(reverseSearch);
// 21.0 Display user defined changes:
if (myTagsSettingRating === true || myTagsReplacing === true || myTagsAdding === true || myTagsRming === true) {
var tagsMods = document.createElement("ul");
tagsMods.style.cssText = "max-width:20em;position:relative;bottom:122px;";
tagsMods.innerHTML =
"<h5>User-defined change(s)</h5>" +
myTagsSettingRatingInfo +
myTagsReplaceTagInfo +
myTagsAddTagInfo +
myTagsRmTagInfo +
myTagsSubmitOnLoadInfo;
document.getElementById("tag_list").appendChild(tagsMods);
}
// 22.0 Add section to view and edit "My Tags":
// 21.1 Header:
var myTagsEdit1 = document.createElement("h5");
myTagsEdit1.style.cssText = "max-width:20em;position:relative;bottom:120px;";
myTagsEdit1.innerHTML = "Change My Tags";
document.getElementById("tag_list").appendChild(myTagsEdit1);
// 21.2 Text area:
var myTagsEdit2 = document.createElement("textarea");
myTagsEdit2.setAttribute("id", "MyTagsEdit");
myTagsEdit2.style.cssText = "max-width:19em;height:15em;position:relative;bottom:118px;";
if (readCookie("tags").match(/\+/g))
{
myTagsEdit2.innerHTML = readCookie("tags").replace(/\+/g, " ");
}
else
{
myTagsEdit2.innerHTML = readCookie("tags");
}
document.getElementById("tag_list").appendChild(myTagsEdit2);
// 22.3 Submit button:
var myTagsEdit3 = document.createElement("button");
myTagsEdit3.setAttribute("id", "ButtonToChangeMyTags");
myTagsEdit3.setAttribute("type", "button");
myTagsEdit3.style.cssText = "max-width:20em;position:relative;bottom:120px;display:block;";
myTagsEdit3.innerHTML = "Edit my tags";
document.getElementById("tag_list").appendChild(myTagsEdit3);
// 22.3.1 Reload the page when it is clicked:
document.getElementById("ButtonToChangeMyTags").addEventListener("click", function() {
document.cookie = "tags=" + escape(document.getElementById("MyTagsEdit").value) + ";";
location.reload();
});
// todo: "tag_(c)" should color as a copyright
}
// ********************************************* //
// Individual image pages for Gelbooru beta 0.2: //
// ********************************************* //
if (window.location.href.match("&id=")
&& (window.location.href.match(/(realbooru.com|rule34.xxx|xbooru.com|gelbooru.com|furry.booru.org)/)))
{
// HTML entities into the character
function htmlDecode(input)
{
var e = document.createElement('span');
e.innerHTML = input;
return e.childNodes[0].nodeValue;
}
if (window.location.href.match(/xbooru.com.index.php.page.post.s.view.id/))
{
// Getting some URLs of the file
if (document.getElementById("gelcomVideoPlayer") == null)
{
if (document.getElementById("resized_notice") == null)
{
var imageSrc = document.getElementById("image").src.replace(/\?\d+$/g, "");
}
else
{
// 6th ul > 3rd li > 1st a > href
var imageSrc = document.getElementsByTagName("ul")[5].childNodes[4].childNodes[0].href;
var imageSrcSample = document.getElementById("image").src.replace(/\?\d+$/g, "");
}
var imageSrcOneDir = imageSrc.substring(imageSrc.lastIndexOf("//") + 9, imageSrc.lastIndexOf("/"));
var imageSrcThumb = imageSrc
.replace(/img\.xbooru\.com\/\/images\/\d+\//g, "img.xbooru.com/thumbnails/" + imageSrcOneDir + "/thumbnail_")
.replace(/\.jpeg/g, ".jpg").replace(/\.png/g, ".jpg").replace(/\.gif/g, ".jpg").replace(/\.webm/g, ".jpg");
}
else
{
var imageSrc = document.getElementsByTagName("source")[0].src;
var imageSrcOneDir = imageSrc.substring(imageSrc.lastIndexOf("//") + 9, imageSrc.lastIndexOf("/"));
var imageSrcSample = imageSrc.replace(/\.webm/g, ".jpg");
// 8th ul > 4th li > 1st a > href
var imageSrcThumb = document.getElementsByTagName("ul")[7].childNodes[4].childNodes[0].href
.replace(/^http:\/\/iqdb.org\/\?url./, "");
}
var theIdOfIt = window.location.href.replace(/^https:\/\/xbooru\.com\/index\.php\?page.post.s.view.id./g, "")
.replace(/\D/g, "");
var newlineChar = document.createElement("div");
newlineChar.setAttribute("style", "clear: both");
var newlineChar2 = document.createElement("div");
newlineChar2.setAttribute("style", "clear: both");
var newlineChar3 = document.createElement("div");
newlineChar3.setAttribute("style", "clear: both");
var newlineChar4 = document.createElement("div");
newlineChar4.setAttribute("style", "clear: both");
var newlineChar5 = document.createElement("div");
newlineChar5.setAttribute("style", "clear: both");
var newlineChar6 = document.createElement("div");
newlineChar6.setAttribute("style", "clear: both");
var newlineChar7 = document.createElement("div");
newlineChar7.setAttribute("style", "clear: both");
var urlsOnThePageT = document.createElement("span");
urlsOnThePageT.setAttribute("style", "float: left");
urlsOnThePageT.appendChild(document.createTextNode("Full file:"));
var urlsOnThePage = document.createElement("a");
urlsOnThePage.setAttribute("href", imageSrc);
urlsOnThePage.setAttribute("style", "float: left");
urlsOnThePage.appendChild(document.createTextNode(imageSrc));
var urlsOnThePageTi = document.createElement("span");
urlsOnThePageTi.setAttribute("style", "float: left");
urlsOnThePageTi.appendChild(document.createTextNode("Full file with ID ref:"));
var urlsOnThePagei = document.createElement("a");
urlsOnThePagei.setAttribute("href", imageSrc + "?" + theIdOfIt);
urlsOnThePagei.setAttribute("style", "float: left");
urlsOnThePagei.appendChild(document.createTextNode(imageSrc + "?" + theIdOfIt));
if (typeof imageSrcSample !== 'undefined')
{
var urlsOnThePageTA = document.createElement("span");
urlsOnThePageTA.setAttribute("style", "float: left");
urlsOnThePageTA.appendChild(document.createTextNode("Sample file:"));
var urlsOnThePageA = document.createElement("a");
urlsOnThePageA.setAttribute("href", imageSrcSample);
urlsOnThePageA.setAttribute("style", "float: left");
urlsOnThePageA.appendChild(document.createTextNode(imageSrcSample));
var urlsOnThePageTii = document.createElement("span");
urlsOnThePageTii.setAttribute("style", "float: left");
urlsOnThePageTii.appendChild(document.createTextNode("Sample file with ID ref:"));
var urlsOnThePageii = document.createElement("a");
urlsOnThePageii.setAttribute("href", imageSrcSample + "?" + theIdOfIt);
urlsOnThePageii.setAttribute("style", "float: left");
urlsOnThePageii.appendChild(document.createTextNode(imageSrcSample + "?" + theIdOfIt));
}
var urlsOnThePageT2 = document.createElement("span");
urlsOnThePageT2.setAttribute("style", "float: left");
urlsOnThePageT2.appendChild(document.createTextNode("Thumbnail:"));
var urlsOnThePage2 = document.createElement("a");
urlsOnThePage2.setAttribute("href", imageSrcThumb);
urlsOnThePage2.setAttribute("style", "float: left");
urlsOnThePage2.appendChild(document.createTextNode(imageSrcThumb));
var urlsOnThePageTiii = document.createElement("span");
urlsOnThePageTiii.setAttribute("style", "float: left");
urlsOnThePageTiii.appendChild(document.createTextNode("Thumbnail with ID ref:"));
var urlsOnThePageiii = document.createElement("a");
urlsOnThePageiii.setAttribute("href", imageSrcThumb + "?" + theIdOfIt);
urlsOnThePageiii.setAttribute("style", "float: left");
urlsOnThePageiii.appendChild(document.createTextNode(imageSrcThumb + "?" + theIdOfIt));
var urlsOnPageNum = document.createElement("span");
urlsOnPageNum.setAttribute("style", "float: left");
urlsOnPageNum.appendChild(document.createTextNode("Directory number: " + imageSrcOneDir));
// Displaying said URLs
var someURLs = document.getElementById("paginator");
someURLs.appendChild(document.createElement("p"))
someURLs.appendChild(urlsOnThePageT);
someURLs.appendChild(urlsOnThePage);
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar);
someURLs.appendChild(urlsOnThePageTi)
someURLs.appendChild(urlsOnThePagei)
if (typeof imageSrcSample !== 'undefined')
{
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar2);
someURLs.appendChild(urlsOnThePageTA);
someURLs.appendChild(urlsOnThePageA);
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar3);
someURLs.appendChild(urlsOnThePageTii);
someURLs.appendChild(urlsOnThePageii);
}
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar4);
someURLs.appendChild(urlsOnThePageT2);
someURLs.appendChild(urlsOnThePage2);
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar5);
someURLs.appendChild(urlsOnThePageTiii);
someURLs.appendChild(urlsOnThePageiii);
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar6);
someURLs.appendChild(urlsOnPageNum);
someURLs.appendChild(document.createTextNode(""));
someURLs.appendChild(newlineChar7);
var myTagsss = htmlDecode(decodeURIComponent(document.cookie.replace(/.*; tags=/g, "").replace(/;.*/g, "")));
}
// Rule34.xxx stuff
if (document.getElementById("tags").value.match(" ") && document.getElementsByTagName("a")[0].href.value == "//rule34.xxx/")
{
var tagUniqueLink = " | <a href='index.php?page=post&s=list&tags=" +
document.getElementById("tags").value.replace(/ /g, "+") +
"' style='color:#000099' onmouseover=\"this.style.color = '#000'\" onmouseout=\"this.style.color = " +
"'#000099'\">uniqueness</a>)</small>";
if (document.getElementById("tags").value.match(/(^tagme | tagme | tagme$)/g))
{
if (document.getElementById("tags").value.match(/ /g).length > 4)
{
var numberOfTags = "Tags <small>(" + document.getElementById("tags").value.match(/ /g).length +
tagUniqueLink;
} else {
var numberOfTags = "Tags <small style='color:red'>(" + document.getElementById("tags").value.match(/ /g).length +
tagUniqueLink;
}
} else {
if (document.getElementById("tags").value.match(/ /g).length > 3) {
var numberOfTagsTemp = Number(document.getElementById("tags").value.match(/ /g).length) + 1;
var numberOfTags = "Tags <small>(" + numberOfTagsTemp + tagUniqueLink;
} else {
var numberOfTagsTemp = Number(document.getElementById("tags").value.match(/ /g).length) + 1;
var numberOfTags = "Tags <small style='color:red'>(" + numberOfTagsTemp + tagUniqueLink;
}
}
document.getElementsByTagName("h5")[1].innerHTML = numberOfTags;
}
document.getElementById("edit_form").style.display = "block";
if (document.getElementById("source").value == "--- !ruby/object:File {} " ||
document.getElementById("source").value == "--- !ruby/object:File {}")
{
document.getElementById("source").value = "";
}
if (window.location.href.match(/gelbooru\.com/))
{
document.body.style.background = "white";
document.getElementById("tag-list").innerHTML = document.getElementById("tag-list").innerHTML
.replace(/<a href="index.php.*>Tag Merge<\/a>/g, "<a href='#' id='BgC'>Background check</a>");
document.getElementById("BgC").addEventListener("click", backgc);
function backgc() {
if (document.body.style.background == "white none repeat scroll 0% 0%" ||
document.body.style.background == "rgb(232, 244, 248) none repeat scroll 0% 0%") {
document.body.style.background =
"url('http://img.booru.org/artwork//images/1/8a151c03d675a5e82058394dff7c482b299c18bc.gif?14694')";
} else if (document.body.style.background ==
'transparent url("http://img.booru.org/artwork//images/1/8a151c03d675a5e8205839' +
'4dff7c482b299c18bc.gif?14694") repeat scroll 0% 0%') {
document.body.style.background = "#E8F4F8";
}
}
var events =
"var ta = document.getElementById('tags');\
ta.addEventListener('keyup', function textAreaSize() {\
ta.style.height = '136px';\
ta.style.height = (25+ta.scrollHeight)+'px';\
});";
events += events.replace(/keyup/g, "load").replace(/ta.add/g, "window.add");
eval(events);
}
document.getElementsByName("submit")[0].style.width = "403px";
document.getElementsByName("submit")[0].style.height = "100px";
document.getElementsByName("submit")[0].style.fontSize = "20pt";
if (document.getElementsByClassName("tag-type-character").length == 0
&& (window.location.href.match(/(rule34.xxx|xbooru.com)/))) {
document.getElementsByClassName("sidebar")[0].innerHTML =
document.getElementsByClassName("sidebar")[0].innerHTML
.replace(/<div(.*\n){2}function iCame\(c\)(.*\n){6}<li>.*alt="I came!".*\n.*<\/div>/g, "")
}
function addTags(tagToAdd) {
var addTagMatchCases =
new RegExp("(^" + tagToAdd + " | " + tagToAdd + " | " + tagToAdd + "$)", "gi");
if (!(document.getElementById("tags").value.match(addTagMatchCases)))
{
document.getElementById("tags").value = document.getElementById("tags").value + " " + tagToAdd + " ";
}
}
function replaceTags(tagToReplace, mc1to, mc2to, mc3to) {
// Now works: x_(artist) -> x
var replaceTagMatchCase1 = new RegExp(" " + tagToReplace.replace(/\(/g, "\\(").replace(/\)/g, "\\)") + " ", "gi");
var replaceTagMatchCase2 = new RegExp("^" + tagToReplace.replace(/\(/g, "\\(").replace(/\)/g, "\\)") + " ", "gi");
var replaceTagMatchCase3 = new RegExp(" " + tagToReplace.replace(/\(/g, "\\(").replace(/\)/g, "\\)") + "$", "gi");
if (document.getElementById("tags").value.match(replaceTagMatchCase1)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase1, mc1to);
}
if (document.getElementById("tags").value.match(replaceTagMatchCase2)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase2, mc2to);
}
if (document.getElementById("tags").value.match(replaceTagMatchCase3)) {
document.getElementById("tags").value = document.getElementById("tags").value.replace(replaceTagMatchCase3, mc3to);
}
}
function implyTags(tagImplyFrom, tagImplyTo) {
var implyFromMatchCases =
new RegExp("(^" + tagImplyFrom + " | " + tagImplyFrom + " | " + tagImplyFrom + "$)", "gi");
if (document.getElementById("tags").value.match(implyFromMatchCases))
{
addTags(tagImplyTo);
}
}
if (document.getElementById("tags").value.match(" "))
{
if (myTagsss.match(/tagmeif:lt\d+;endif;/g) &&
document.getElementById("tags").value.match(/(^tagme | tagme | tagme$)/g) &&
document.getElementById("tags").value.match(/ /g).length >= 10)
{
replaceTags("tagme", " ", "", "");
}
} else {
// 11.2 Add it (based on ("#my-tags")):
if (myTagsss.match(/tagmeif:lt\d+;endif;/g) &&
document.getElementById("tags").value.match(/ /g).length <=
Number(myTagsss.replace(/.*tagmeif:lt/g, "").replace(/;endif;.*/, "")))
{
document.getElementById("tags").value = document.getElementById("tags").value + " tagme ";
}
}
if (myTagsss.match(/add:.*;add;/g))
{
var myTagsAddTag = myTagsss.replace(/.*add:/g, "").replace(/;add;.*/g, "");
if (myTagsAddTag.match("|")) {
var myTagsAddTags = myTagsAddTag.split("|");
} else {