forked from Seedmanc/Booru-Augmentation-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBooru-mass-editor.user.js
95 lines (87 loc) · 4.56 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
// ==UserScript==
// @name Booru Mass Editor
// @description Quickly edit images on older versions of Gelbooru
// @version 1
// @author usernam
// @include http://*.booru.org/index.php?page=post&s=view&id=*
// @include http://safebooru.org/index.php?page=post&s=view&id=*
// @include http://rule34.xxx/index.php?page=post&s=view&id=*
// @include http://xbooru.com/index.php?page=post&s=view&id=*
// @grant none
// @noframes
// ==/UserScript==
/*
// Enter pressed anywhere = submit forum:
var insertScript = document.createElement("script");
var textarea = getElementById("tags")
insertScript.textContent = "\
document.textarea.addEventListener(onkeypress, function(e) { \
if (e.which == 13) { \
doument.getElementById('edit_form').submit(); \
} \
});";
document.body.appendChild(insertScript);
*/
var ID = window.location.href.replace(/^.*&id=/g, "").replace(/#$/g, "");
// Replacing and hiding:
document.body.innerHTML =
document.body.innerHTML
.replace(/div style="float\: left; margin\: 1em 0"/g, "div style='float: left;'")
.replace(/<b>Score<\/b>.*Report post.<\/a>/g, "")
.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(/>Next Post</g, "><")
.replace(/Recent Tags<br>\n.*?\n.*?<\/td>/g, "</td>")
.replace(/>Tag History<\/a>/g, ">Tag history</a> • Vote: <a href='#' onclick=\"post_vote('" + ID + "', 'up')\">+</a> <a href='#' onclick=\"post_vote('" + ID+ "', 'down')\">-</a>")
.replace(/>Note history</g, "><")
.replace(/>Add note</g, "><")
.replace(/ \| /g, "")
.replace(/>Next</g, "><")
.replace(/>Previous</g, "><")
.replace(/Previous Post<br>/g, "<br>")
.replace(/ id="image" onclick="Note.toggle\(\);" style="margin-right\: 70px;"/g, " id='image' onclick='Note.toggle();' style='max-width:800px; margin-right: 70px; position:relative; top:-7px;'")
.replace(/<br.*Posted on \d.* by <a href="index.php\?page=account_profile&uname=.*?">.*?<\/a>/g, "")
.replace(/>Remove<\/a>/g, ">Remove</a> • ")
.replace(/>Keep<\/a>/g, ">Favorite</a> • ")
.replace(/>Edit</g, "><")
.replace(/<input name="submit" value="Save changes" type="submit">/g, "<input style='position:relative;top:-80px;' name='submit' value='Save changes' type='submit'>")
.replace(/<a href="index.php\?page=post&s=view&id=\d+"><\/a><br>/g, "")
.replace(/Source<br>/g, "")
.replace(/Title<br>/g, "")
.replace(/Parent<br>/g, "")
.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(/Rating<br>/g, "<br>")
.replace(/ Id.*\n/g, "")
.replace(/ Rating.*\n/g, "")
.replace(/My Tags<br>/g, "<br>")
.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, "")
document.getElementById("previous_post").style.display = "none";
document.getElementById("next_post").style.display = "none";
// Unhiding:
document.getElementById("edit_form").style.display = "block";
// 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";
/* Editing buttons:
document.getElementById("my-tags").innerHTML =
"<button type='button' onclick='fnTagToSource()'><tt>filename tag → source</tt></button>" +
" or <button type='button' onclick='fnTagToTitle()'><tt>filename tag → title</tt></button>"
function fnTagToSource() {
var textarea = document.getElementById("tags");
var filename = textarea.value.match(/\w+\.(jp?g|png|gif)/g)
textarea.value = textarea.value.replace(filename, "").replace("bad_tag", "")
document.getElementById("source").value = filename
}
function fnTagToTitle() {
var textarea = document.getElementById("tags");
var filename = textarea.value.match(/\w+\.(jp?g|png|gif)/g)
textarea.value = textarea.value.replace(filename, "").replace("bad_tag", "")
document.getElementById("title").value = filename
} */