Migrate assets to use Webpacker

This commit is contained in:
Albert Yi
2018-07-06 16:41:08 -07:00
parent 95b72f5f5c
commit 6fa0ae2cf1
175 changed files with 11518 additions and 3726 deletions

View File

@@ -1,11 +0,0 @@
//= require hammer.js
//= require jquery.dropdown.js
//= require stupidtable.js
//= require jquery.qtip.js
//= require jquery.hammer.js
//= require jquery.timeout.js
//= require jquery.hotkeys.js
//= require ugoira_player.js
//= require jquery_ujs
//= require common.js
//= require_tree .

View File

@@ -1,151 +0,0 @@
(function() {
Danbooru.ArtistCommentary = {};
Danbooru.ArtistCommentary.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
if ($("#original-artist-commentary").length && $("#translated-artist-commentary").length) {
this.initialize_commentary_display_tabs();
}
this.initialize_edit_commentary_dialog();
}
}
Danbooru.ArtistCommentary.initialize_commentary_display_tabs = function() {
$("#commentary-sections li a").click(function(e) {
if (e.target.hash === "#original") {
$("#original-artist-commentary").show();
$("#translated-artist-commentary").hide();
} else if (e.target.hash === "#translated") {
$("#original-artist-commentary").hide();
$("#translated-artist-commentary").show();
}
$("#commentary-sections li").removeClass("active");
$(e.target).parent("li").addClass("active");
e.preventDefault();
});
$("#commentary-sections li:last-child").addClass("active");
$("#original-artist-commentary").hide();
}
Danbooru.ArtistCommentary.initialize_edit_commentary_dialog = function() {
$("#add-commentary-dialog").dialog({
autoOpen: false,
width: 500,
buttons: {
"Submit": function() {
$("#add-commentary-dialog #edit-commentary").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#add-commentary-dialog #edit-commentary').submit(function() {
$('#add-commentary-dialog').dialog('close');
});
$("#add-commentary").click(function(e) {
e.preventDefault();
$("#add-commentary-dialog").dialog("open");
});
$('#fetch-commentary select[name="commentary_source_type"]').change(function() {
$("#fetch-commentary input").toggle();
});
$('#fetch-commentary button[type="submit"]').click(Danbooru.ArtistCommentary.fetch_commentary);
}
Danbooru.ArtistCommentary.fetch_commentary = function() {
Danbooru.notice("Fetching artist commentary...");
var type = $('#fetch-commentary select[name="commentary_source_type"]').val();
if (type === "Source") {
var source = $('#fetch-commentary input[name="commentary_source"]').val();
var commentary = Danbooru.ArtistCommentary.from_source(source);
} else if (type === "Post") {
var id = $('#fetch-commentary input[name="commentary_post_id"]').val();
var commentary = Danbooru.ArtistCommentary.from_post_id(id);
}
commentary.then(Danbooru.ArtistCommentary.fill_commentary).then(function (success) {
var message = success ? "Artist commentary copied." : "Artist commentary copied; conflicting fields ignored.";
Danbooru.notice(message);
}).catch(function () {
Danbooru.notice("Fetching artist commentary failed.");
});
return false;
};
Danbooru.ArtistCommentary.from_source = function(source) {
return $.get("/source.json?url=" + encodeURIComponent(source)).then(function(data) {
return {
original_title: data.artist_commentary.dtext_title,
original_description: data.artist_commentary.dtext_description,
source: source,
};
});
};
Danbooru.ArtistCommentary.from_post_id = function(post_id) {
return $.get("/posts/" + encodeURIComponent(post_id) + "/artist_commentary.json").then(function(commentary) {
commentary.source = "post #" + post_id;
return commentary;
});
};
Danbooru.ArtistCommentary.fill_commentary = function(commentary) {
var description = Danbooru.ArtistCommentary.merge_commentaries($("#artist_commentary_original_description").val().trim(), commentary);
$("#artist_commentary_original_description").val(description);
// Update the other fields if they're blank. Return success if none conflict.
return [
Danbooru.ArtistCommentary.update_field($("#artist_commentary_original_title"), commentary.original_title),
Danbooru.ArtistCommentary.update_field($("#artist_commentary_translated_title"), commentary.translated_title),
Danbooru.ArtistCommentary.update_field($("#artist_commentary_translated_description"), commentary.translated_description),
].every(function (i) { return i; });
};
// If the new description conflicts with the current description, merge them
// by appending the new description onto the old one.
Danbooru.ArtistCommentary.merge_commentaries = function(description, commentary) {
var post_source = $('#image-container').data().source;
var normalized_source = $("#image-container").data().normalizedSource;
if ((commentary.original_description && description) &&
(commentary.original_description != description)) {
return description
+ "\n\n[tn]\nSource: " + normalized_source + "\n[/tn]"
+ "\n\nh6. " + (commentary.original_title || "Untitled")
+ "\n\n" + commentary.original_description
+ "\n\n[tn]\nSource: " + commentary.source + "\n[/tn]";
} else if (commentary.source != post_source) {
return commentary.original_description + "\n\n[tn]\nSource: " + commentary.source + "\n[/tn]";
} else {
return commentary.original_description || description;
}
};
// Update commentary field if it's blank, signal an error if there's a conflict.
Danbooru.ArtistCommentary.update_field = function($field, value) {
if ($field.val().trim() === "") {
$field.val(value);
return true;
} else if ($field.val().trim() !== value) {
$field.effect("shake", { direction: "up", distance: 5 });
return false;
} else {
return true;
}
}
})();
$(function() {
Danbooru.ArtistCommentary.initialize_all();
});

View File

@@ -1,46 +0,0 @@
(function() {
Danbooru.Artist = {};
Danbooru.Artist.initialize_all = function() {
if ($("#c-artists").length) {
Danbooru.Artist.initialize_check_name();
Danbooru.Artist.initialize_shortcuts();
}
}
Danbooru.Artist.initialize_check_name = function() {
$("#artist_name").keyup(function(e) {
if ($("#artist_name").val().length > 0) {
$("#check-name-result").html("");
$.getJSON("/artists?search[name]=" + escape($("#artist_name").val()), function(data) {
if (data.length === 0) {
$.getJSON("/wiki_pages/" + escape($("#artist_name").val()), function(data) {
if (data !== null) {
$("#check-name-result").html("<a href='/wiki_pages/" + escape($("#artist_name").val()) + "'>A wiki page with this name already exists</a>. You must either move the wiki page or pick another artist name.")
}
});
} else {
$("#check-name-result").html("An artist with this name already exists.")
}
});
}
});
}
Danbooru.Artist.initialize_shortcuts = function() {
if ($("#c-artists #a-show").length) {
Danbooru.keydown("e", "edit", function(e) {
$("#artist-edit a")[0].click();
});
Danbooru.keydown("shift+d", "delete", function(e) {
$("#artist-delete a")[0].click();
});
}
};
})();
$(document).ready(function() {
Danbooru.Artist.initialize_all();
});

View File

@@ -1,524 +0,0 @@
(function() {
Danbooru.Autocomplete = {};
Danbooru.Autocomplete.AUTOCOMPLETE_VERSION = 1;
Danbooru.Autocomplete.PREFIXES = /^(-|~|<%= TagCategory.mapping.keys.map {|category| category + ':'}.join('|') %>)(.*)$/i;
Danbooru.Autocomplete.METATAGS = /^(<%= Tag::METATAGS %>):(.*)$/i;
Danbooru.Autocomplete.initialize_all = function() {
if (Danbooru.meta("enable-auto-complete") === "true") {
$.widget("ui.autocomplete", $.ui.autocomplete, {
options: {
delay: 0,
minLength: 1,
autoFocus: false,
focus: function() { return false; },
},
_create: function() {
this.element.on("keydown.danbooru.autocomplete.tab", null, "tab", Danbooru.Autocomplete.on_tab);
this._super();
},
_renderItem: Danbooru.Autocomplete.render_item,
});
this.initialize_tag_autocomplete();
this.initialize_mention_autocomplete($(".autocomplete-mentions textarea"));
this.initialize_artist_autocomplete($('[data-autocomplete="artist"]'));
this.initialize_pool_autocomplete($('[data-autocomplete="pool"]'));
this.initialize_wiki_autocomplete($('[data-autocomplete="wiki-page"]'));
}
}
Danbooru.Autocomplete.initialize_mention_autocomplete = function($fields) {
$fields.autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
select: function(event, ui) {
Danbooru.Autocomplete.insert_completion(this, ui.item.value);
return false;
},
source: function(req, resp) {
var cursor = this.element.get(0).selectionStart;
var i;
var name = null;
for (i=cursor; i>=1; --i) {
if (req.term[i-1] === " ") {
return;
}
if (req.term[i-1] === "@") {
if (i == 1 || /[ \r\n]/.test(req.term[i-2])) {
name = req.term.substring(i, cursor);
break;
} else {
return;
}
}
}
if (name) {
Danbooru.Autocomplete.user_source(name, resp, "@");
}
return;
}
});
}
Danbooru.Autocomplete.initialize_tag_autocomplete = function() {
var $fields_multiple = $('[data-autocomplete="tag-query"], [data-autocomplete="tag-edit"]');
var $fields_single = $('[data-autocomplete="tag"]');
$fields_multiple.autocomplete({
search: function() {
if ($(this).data("ui-autocomplete")) {
$(this).data("ui-autocomplete").menu.bindings = $();
}
},
select: function(event, ui) {
// Prevent Danbooru.Upload.initialize_enter_on_tags from running if the
// Enter key is used to select a tag from the autocomplete menu.
if (event.key === "Enter") {
event.stopImmediatePropagation();
}
Danbooru.Autocomplete.insert_completion(this, ui.item.value);
return false;
},
source: function(req, resp) {
var query = Danbooru.Autocomplete.parse_query(req.term, this.element.get(0).selectionStart);
var metatag = query.metatag;
var term = query.term;
if (!metatag && !term) {
this.close();
return;
}
switch(metatag) {
case "md5":
case "width":
case "height":
case "mpixels":
case "ratio":
case "score":
case "favcount":
case "filesize":
case "source":
case "id":
case "date":
case "age":
case "limit":
case "tagcount":
case "pixiv_id":
case "pixiv":
<% TagCategory.short_name_list.each do |category| %>
case "<%= category %>tags":
<% end %>
resp([]);
return;
case "order":
case "status":
case "rating":
case "locked":
case "child":
case "parent":
case "filetype":
Danbooru.Autocomplete.static_metatag_source(term, resp, metatag);
return;
case "user":
case "approver":
case "commenter":
case "comm":
case "noter":
case "noteupdater":
case "artcomm":
case "fav":
case "ordfav":
case "appealer":
case "flagger":
case "upvote":
case "downvote":
Danbooru.Autocomplete.user_source(term, resp, metatag);
break;
case "pool":
case "ordpool":
Danbooru.Autocomplete.pool_source(term, resp, metatag);
break;
case "favgroup":
Danbooru.Autocomplete.favorite_group_source(term, resp, metatag);
break;
case "search":
Danbooru.Autocomplete.saved_search_source(term, resp);
break;
default:
Danbooru.Autocomplete.normal_source(term, resp);
break;
}
}
});
$fields_single.autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
source: function(req, resp) {
Danbooru.Autocomplete.normal_source(req.term, resp);
}
});
}
Danbooru.Autocomplete.initialize_artist_autocomplete = function($fields) {
$fields.autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
source: function(req, resp) {
$.ajax({
url: "/artists.json",
data: {
"search[name]": req.term + "*",
"search[is_active]": true,
"search[order]": "post_count",
"limit": 10,
"expiry": 7
},
method: "get",
success: function(data) {
resp($.map(data, function(artist) {
return {
type: "tag",
label: artist.name.replace(/_/g, " "),
value: artist.name,
category: <%= Tag.categories.artist %>,
};
}));
}
});
}
});
};
Danbooru.Autocomplete.initialize_pool_autocomplete = function($fields) {
$fields.autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
source: function(req, resp) {
Danbooru.Autocomplete.pool_source(req.term, resp);
},
});
};
Danbooru.Autocomplete.initialize_wiki_autocomplete = function($fields) {
$fields.autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
source: function(req, resp) {
$.ajax({
url: "/wiki_pages.json",
data: {
"search[title]": req.term + "*",
"search[hide_deleted]": "Yes",
"search[order]": "post_count",
"limit": 10,
"expiry": 7
},
method: "get",
success: function(data) {
resp($.map(data, function(wiki_page) {
return {
type: "tag",
label: wiki_page.title.replace(/_/g, " "),
value: wiki_page.title,
category: wiki_page.category_name
};
}));
}
});
}
});
};
Danbooru.Autocomplete.normal_source = function(term, resp) {
var key = "ac-" + term.replace(/\./g,'\uFFFF');
$.ajax({
url: "/tags/autocomplete.json",
data: {
"search[name_matches]": term,
"expiry": 7
},
method: "get",
success: function(data) {
var d = $.map(data, function(tag) {
return {
type: "tag",
label: tag.name.replace(/_/g, " "),
antecedent: tag.antecedent_name,
value: tag.name,
category: tag.category,
post_count: tag.post_count
};
});
resp(d);
}
});
}
Danbooru.Autocomplete.parse_query = function(text, caret) {
var metatag = "";
var term = "";
var before_caret_text = text.substring(0, caret);
var match = before_caret_text.match(/\S+$/g);
if (match) {
term = match[0];
} else {
return {};
}
if (match = term.match(Danbooru.Autocomplete.PREFIXES)) {
metatag = match[1].toLowerCase();
term = match[2];
}
if (match = term.match(Danbooru.Autocomplete.METATAGS)) {
metatag = match[1].toLowerCase();
term = match[2];
}
return { metatag: metatag, term: term };
};
// Update the input field with the item currently focused in the
// autocomplete menu, then position the caret just after the inserted completion.
Danbooru.Autocomplete.insert_completion = function(input, completion) {
var before_caret_text = input.value.substring(0, input.selectionStart).trim();
var after_caret_text = input.value.substring(input.selectionStart).trim();
var prefixes = "-|~|" + "<%= TagCategory.mapping.keys.map {|category| category + ':'}.join('|') %>";
var regexp = new RegExp("(" + prefixes + ")?\\S+$", "g");
before_caret_text = before_caret_text.replace(regexp, "$1") + completion + " ";
input.value = before_caret_text + after_caret_text;
input.selectionStart = input.selectionEnd = before_caret_text.length;
};
// If we press tab while the autocomplete menu is open but nothing is
// focused, complete the first item and close the menu.
Danbooru.Autocomplete.on_tab = function(event) {
var input = this;
var autocomplete = $(input).autocomplete("instance");
var $autocomplete_menu = autocomplete.menu.element;
if (!$autocomplete_menu.is(":visible")) {
return;
}
if ($autocomplete_menu.has(".ui-state-active").length === 0) {
var $first_item = $autocomplete_menu.find(".ui-menu-item").first();
var completion = $first_item.data().uiAutocompleteItem.value;
Danbooru.Autocomplete.insert_completion(input, completion);
autocomplete.close();
}
// Prevent the tab key from moving focus to the next element.
event.preventDefault();
};
Danbooru.Autocomplete.render_item = function(list, item) {
var $link = $("<a/>");
$link.text(item.label);
$link.attr("href", "/posts?tags=" + encodeURIComponent(item.value));
$link.click(function(e) {
e.preventDefault();
});
if (item.antecedent) {
var antecedent = item.antecedent.replace(/_/g, " ");
var arrow = $("<span/>").html(" &rarr; ").addClass("autocomplete-arrow");
var antecedent_element = $("<span/>").text(antecedent).addClass("autocomplete-antecedent");
$link.prepend([
antecedent_element,
arrow
]);
}
if (item.post_count !== undefined) {
var count;
if (item.post_count >= 1000) {
count = Math.floor(item.post_count / 1000) + "k";
} else {
count = item.post_count;
}
var $post_count = $("<span/>").addClass("post-count").css("float", "right").text(count);
$link.append($post_count);
}
if (item.type === "tag") {
$link.addClass("tag-type-" + item.category);
} else if (item.type === "user") {
var level_class = "user-" + item.level.toLowerCase();
$link.addClass(level_class);
if (Danbooru.meta("style-usernames") === "true") {
$link.addClass("with-style");
}
} else if (item.type === "pool") {
$link.addClass("pool-category-" + item.category);
}
var $menu_item = $("<div/>").append($link);
return $("<li/>").data("item.autocomplete", item).append($menu_item).appendTo(list);
};
Danbooru.Autocomplete.static_metatags = {
order: [
"id", "id_desc",
"score", "score_asc",
"favcount", "favcount_asc",
"created_at", "created_at_asc",
"change", "change_asc",
"comment", "comment_asc",
"comment_bumped", "comment_bumped_asc",
"note", "note_asc",
"artcomm", "artcomm_asc",
"mpixels", "mpixels_asc",
"portrait", "landscape",
"filesize", "filesize_asc",
"tagcount", "tagcount_asc",
"rank",
"random",
"custom"
].concat(<%= TagCategory.short_name_list.map {|category| [category + "tags", category + "tags_asc"]}.flatten %>),
status: [
"any", "deleted", "active", "pending", "flagged", "banned"
],
rating: [
"safe", "questionable", "explicit"
],
locked: [
"rating", "note", "status"
],
child: [
"any", "none"
],
parent: [
"any", "none"
],
filetype: [
"jpg", "png", "gif", "swf", "zip", "webm", "mp4"
],
}
Danbooru.Autocomplete.static_metatag_source = function(term, resp, metatag) {
var sub_metatags = this.static_metatags[metatag];
var regexp = new RegExp("^" + $.ui.autocomplete.escapeRegex(term), "i");
var matches = $.grep(sub_metatags, function (sub_metatag) {
return regexp.test(sub_metatag);
});
resp($.map(matches, function(sub_metatag) {
return metatag + ":" + sub_metatag;
}));
}
Danbooru.Autocomplete.user_source = function(term, resp, metatag) {
$.ajax({
url: "/users.json",
data: {
"search[order]": "post_upload_count",
"search[current_user_first]": "true",
"search[name_matches]": term + "*",
"limit": 10
},
method: "get",
success: function(data) {
var prefix;
var display_name;
if (metatag === "@") {
prefix = "@";
display_name = function(name) {return name;};
} else {
prefix = metatag + ":";
display_name = function(name) {return name.replace(/_/g, " ");};
}
resp($.map(data, function(user) {
return {
type: "user",
label: display_name(user.name),
value: prefix + user.name,
level: user.level_string
};
}));
}
});
}
Danbooru.Autocomplete.pool_source = function(term, resp, metatag) {
$.ajax({
url: "/pools.json",
data: {
"search[order]": "post_count",
"search[name_matches]": term,
"limit": 10
},
method: "get",
success: function(data) {
resp($.map(data, function(pool) {
return {
type: "pool",
label: pool.name.replace(/_/g, " "),
value: (metatag ? (metatag + ":" + pool.name) : pool.name),
post_count: pool.post_count,
category: pool.category
};
}));
}
});
}
Danbooru.Autocomplete.favorite_group_source = function(term, resp, metatag) {
$.ajax({
url: "/favorite_groups.json",
data: {
"search[name_matches]": term,
"limit": 10
},
method: "get",
success: function(data) {
resp($.map(data, function(favgroup) {
return {
label: favgroup.name.replace(/_/g, " "),
value: metatag + ":" + favgroup.name,
post_count: favgroup.post_count
};
}));
}
});
}
Danbooru.Autocomplete.saved_search_source = function(term, resp) {
return Danbooru.SavedSearch.labels(term).then(function(labels) {
resp(labels.map(function(label) {
return {
label: label.replace(/_/g, " "),
value: "search:" + label,
};
}));
});
}
})();
$(document).ready(function() {
Danbooru.Autocomplete.initialize_all();
});

View File

@@ -1,200 +0,0 @@
(function() {
Danbooru.Blacklist = {};
Danbooru.Blacklist.entries = [];
Danbooru.Blacklist.parse_entry = function(string) {
var entry = {
"tags": string,
"require": [],
"exclude": [],
"disabled": false,
"hits": 0,
"min_score": null
};
var matches = string.match(/\S+/g) || [];
$.each(matches, function(i, tag) {
if (tag.charAt(0) === '-') {
entry.exclude.push(tag.slice(1));
} else if (tag.match(/^score:<.+/)) {
var score = tag.match(/^score:<(.+)/)[1];
entry.min_score = parseInt(score);
} else {
entry.require.push(tag);
}
});
return entry;
}
Danbooru.Blacklist.parse_entries = function() {
var entries = (Danbooru.meta("blacklisted-tags") || "nozomiisthebestlovelive").replace(/(rating:[qes])\w+/ig, "$1").toLowerCase().split(/,/);
$.each(entries, function(i, tags) {
var entry = Danbooru.Blacklist.parse_entry(tags);
Danbooru.Blacklist.entries.push(entry);
});
}
Danbooru.Blacklist.toggle_entry = function(e) {
var tags = $(e.target).text();
var match = $.grep(Danbooru.Blacklist.entries, function(entry, i) {
return entry.tags === tags;
})[0];
if (match) {
match.disabled = !match.disabled;
if (match.disabled) {
Danbooru.Blacklist.post_hide(e.target);
} else {
Danbooru.Blacklist.post_unhide(e.target);
}
}
Danbooru.Blacklist.apply();
}
Danbooru.Blacklist.update_sidebar = function() {
$.each(this.entries, function(i, entry) {
if (entry.hits === 0) {
return;
}
var item = $("<li/>");
var link = $("<a/>");
var count = $("<span/>");
var hash = entry.tags.hash();
link.text(entry.tags);
link.click(Danbooru.Blacklist.toggle_entry);
count.html(entry.hits);
count.addClass("count");
item.append(link);
item.append(" ");
item.append(count);
$("#blacklist-list").append(item);
});
$("#blacklist-box").show();
}
Danbooru.Blacklist.initialize_disable_all_blacklists = function() {
if (Danbooru.Cookie.get("dab") === "1") {
$("#re-enable-all-blacklists").show();
$("#blacklist-list a:not(.blacklisted-active)").click();
Danbooru.Blacklist.apply();
} else {
$("#disable-all-blacklists").show()
}
$("#disable-all-blacklists").click(function(e) {
$("#disable-all-blacklists").hide();
$("#re-enable-all-blacklists").show();
Danbooru.Cookie.put("dab", "1");
$("#blacklist-list a:not(.blacklisted-active)").click();
e.preventDefault();
});
$("#re-enable-all-blacklists").click(function(e) {
$("#disable-all-blacklists").show();
$("#re-enable-all-blacklists").hide();
Danbooru.Cookie.put("dab", "0");
$("#blacklist-list a.blacklisted-active").click();
e.preventDefault();
});
}
Danbooru.Blacklist.apply = function() {
$.each(this.entries, function(i, entry) {
entry.hits = 0;
});
var count = 0
$.each(this.posts(), function(i, post) {
var post_count = 0;
$.each(Danbooru.Blacklist.entries, function(i, entry) {
if (Danbooru.Blacklist.post_match(post, entry)) {
entry.hits += 1;
count += 1;
post_count += 1;
}
});
if (post_count > 0) {
Danbooru.Blacklist.post_hide(post);
} else {
Danbooru.Blacklist.post_unhide(post);
}
});
return count;
}
Danbooru.Blacklist.posts = function() {
return $(".post-preview, #image-container, #c-comments .post");
}
Danbooru.Blacklist.post_match = function(post, entry) {
if (entry.disabled) {
return false;
}
var $post = $(post);
var score = parseInt($post.attr("data-score"));
if (entry.min_score !== null && score < entry.min_score) {
return true;
}
var tags = String($post.attr("data-tags")).match(/\S+/g) || [];
tags = tags.concat(String($post.attr("data-pools")).match(/\S+/g) || []);
tags.push("rating:" + $post.data("rating"));
if ($post.attr("data-uploader")) {
tags.push("user:" + $post.attr("data-uploader").toLowerCase());
}
tags.push("uploaderid:" + $post.attr("data-uploader-id"));
tags.push("toptaggerid:" + $post.attr("data-top-tagger"));
$.each(String($post.data("flags")).match(/\S+/g) || [], function(i, v) {
tags.push("status:" + v);
});
return (entry.require.length > 0 || entry.exclude.length > 0) && Danbooru.is_subset(tags, entry.require) && !Danbooru.intersect(tags, entry.exclude).length;
}
Danbooru.Blacklist.post_hide = function(post) {
var $post = $(post);
$post.addClass("blacklisted").addClass("blacklisted-active");
var $video = $post.find("video").get(0);
if ($video) {
$video.pause();
$video.currentTime = 0;
}
}
Danbooru.Blacklist.post_unhide = function(post) {
var $post = $(post);
$post.addClass("blacklisted").removeClass("blacklisted-active");
var $video = $post.find("video").get(0);
if ($video) {
$video.play();
}
}
Danbooru.Blacklist.initialize_all = function() {
Danbooru.Blacklist.parse_entries();
if (Danbooru.Blacklist.apply() > 0) {
Danbooru.Blacklist.update_sidebar();
Danbooru.Blacklist.initialize_disable_all_blacklists();
} else {
$("#blacklist-box").hide();
}
}
})();
$(document).ready(function() {
if ($("#blacklist-box").length == 0) {
return;
}
Danbooru.Blacklist.initialize_all();
});

View File

@@ -1,108 +0,0 @@
(function() {
Danbooru.Comment = {};
Danbooru.Comment.initialize_all = function() {
if ($("#c-posts").length || $("#c-comments").length) {
this.initialize_response_link();
this.initialize_reply_links();
this.initialize_expand_links();
this.initialize_vote_links();
if (!$("#a-edit").length) {
this.initialize_edit_links();
}
}
if ($("#c-posts").length && $("#a-show").length) {
Danbooru.Comment.highlight_threshold_comments(Danbooru.meta("post-id"));
}
}
Danbooru.Comment.quote = function(e) {
$.get(
"/comments/" + $(e.target).data('comment-id') + ".json",
function(data) {
var $link = $(e.target);
var $div = $link.closest("div.comments-for-post").find(".new-comment");
var $textarea = $div.find("textarea");
var msg = data["quoted_response"];
if ($textarea.val().length > 0) {
msg = $textarea.val() + "\n\n" + msg;
}
$textarea.val(msg);
$div.find("a.expand-comment-response").trigger("click");
$textarea.selectEnd();
}
);
e.preventDefault();
}
Danbooru.Comment.initialize_reply_links = function($parent) {
$parent = $parent || $(document);
$parent.find(".reply-link").click(Danbooru.Comment.quote);
}
Danbooru.Comment.initialize_expand_links = function() {
$(".comment-section form").hide();
$(".comment-section input.expand-comment-response").click(function(e) {
var post_id = $(this).closest(".comment-section").data("post-id");
$(this).hide();
$(".comment-section[data-post-id=" + post_id + "] form").slideDown("fast");
e.preventDefault();
});
}
Danbooru.Comment.initialize_response_link = function() {
$("a.expand-comment-response").click(function(e) {
$(e.target).hide();
var $form = $(e.target).closest("div.new-comment").find("form");
$form.show();
Danbooru.scroll_to($form);
e.preventDefault();
});
$("div.new-comment form").hide();
}
Danbooru.Comment.initialize_edit_links = function($parent) {
$parent = $parent || $(document);
$parent.find(".edit_comment").hide();
$parent.find(".edit_comment_link").click(function(e) {
var link_id = $(this).attr("id");
var comment_id = link_id.match(/^edit_comment_link_(\d+)$/)[1];
$("#edit_comment_" + comment_id).fadeToggle("fast");
e.preventDefault();
});
}
Danbooru.Comment.highlight_threshold_comments = function(post_id) {
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
var articles = $("article.comment[data-post-id=" + post_id + "]");
articles.each(function(i, v) {
var $comment = $(v);
if (parseInt($comment.data("score")) < threshold) {
$comment.addClass("below-threshold");
}
});
}
Danbooru.Comment.hide_threshold_comments = function(post_id) {
var threshold = parseInt(Danbooru.meta("user-comment-threshold"));
var articles = $("article.comment[data-post-id=" + post_id + "]");
articles.each(function(i, v) {
var $comment = $(v);
if (parseInt($comment.data("score")) < threshold) {
$comment.hide();
}
});
}
Danbooru.Comment.initialize_vote_links = function($parent) {
$parent = $parent || $(document);
$parent.find(".unvote-comment-link").hide();
}
})();
$(document).ready(function() {
Danbooru.Comment.initialize_all();
});

View File

@@ -1,49 +0,0 @@
$(function() {
// Table striping
$(".striped tbody tr:even").addClass("even");
$(".striped tbody tr:odd").addClass("odd");
// Account notices
$("#hide-sign-up-notice").click(function(e) {
$("#sign-up-notice").hide();
Danbooru.Cookie.put("hide_sign_up_notice", "1", 7);
e.preventDefault();
});
$("#hide-upgrade-account-notice").click(function(e) {
$("#upgrade-account-notice").hide();
Danbooru.Cookie.put('hide_upgrade_account_notice', '1', 7);
e.preventDefault();
});
$("#hide-dmail-notice").click(function(e) {
var $dmail_notice = $("#dmail-notice");
$dmail_notice.hide();
var dmail_id = $dmail_notice.data("id");
Danbooru.Cookie.put("hide_dmail_notice", dmail_id);
e.preventDefault();
});
$("#close-notice-link").click(function(e) {
$('#notice').fadeOut("fast");
e.preventDefault();
});
$("#desktop-version-link a").click(function(e) {
e.preventDefault();
$.ajax("/users/" + Danbooru.meta("current-user-id") + ".json", {
method: "PUT",
data: {
"user[disable_responsive_mode]": "true"
}
}).then(function() {
location.reload();
});
});
});
var Danbooru = {};
var submitInvisibleRecaptchaForm = function () {
document.getElementById("signup-form").submit();
};

View File

@@ -1,73 +0,0 @@
(function() {
Danbooru.Cookie = {};
Danbooru.Cookie.put = function(name, value, days) {
var expires = "";
if (days !== "session") {
if (!days) {
days = 365;
}
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "expires=" + date.toGMTString() + "; ";
}
var new_val = name + "=" + encodeURIComponent(value) + "; " + expires + "path=/";
if (document.cookie.length < (4090 - new_val.length)) {
document.cookie = new_val;
return true;
} else {
Danbooru.error("You have too many cookies on this site. Consider deleting them all.")
return false;
}
}
Danbooru.Cookie.raw_get = function(name) {
var nameEq = name + "=";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; ++i) {
var c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1, c.length);
}
if (c.indexOf(nameEq) == 0) {
return c.substring(nameEq.length, c.length);
}
}
return "";
}
Danbooru.Cookie.get = function(name) {
return this.unescape(this.raw_get(name));
}
Danbooru.Cookie.remove = function(name) {
this.put(name, "", -1);
}
Danbooru.Cookie.unescape = function(val) {
return decodeURIComponent(val.replace(/\+/g, " "));
}
Danbooru.Cookie.initialize = function() {
var loc = location.href;
if (loc.match(/^http/)) {
loc = loc.replace(/^https?:\/\/[^\/]+/, "");
}
if (this.get("hide-upgrade-account") != "1") {
$("#upgrade-account").show();
}
}
})();
$(function() {
Danbooru.Cookie.initialize();
});

View File

@@ -1,68 +0,0 @@
(function() {
Danbooru.Dtext = {};
Danbooru.Dtext.initialize_all = function() {
Danbooru.Dtext.initialize_links();
Danbooru.Dtext.initialize_expandables();
}
Danbooru.Dtext.initialize_links = function() {
$(".simple_form .dtext-preview").hide();
$(".simple_form input[value=Preview]").click(Danbooru.Dtext.click_button);
}
Danbooru.Dtext.initialize_expandables = function($parent) {
$parent = $parent || $(document);
$parent.find(".expandable-content").hide();
$parent.find(".expandable-button").click(function(e) {
var button = $(this);
button.parent().next().fadeToggle("fast");
if (button.val() === "Show") {
button.val("Hide");
} else {
button.val("Show");
}
});
}
Danbooru.Dtext.call_preview = function(e, $button, $input, $preview) {
$button.val("Edit");
$input.hide();
$preview.text("Loading...").fadeIn("fast");
$.ajax({
type: "post",
url: "/dtext_preview",
data: {
body: $input.val()
},
success: function(data) {
$preview.html(data).fadeIn("fast");
Danbooru.Dtext.initialize_expandables($preview);
}
});
}
Danbooru.Dtext.call_edit = function(e, $button, $input, $preview) {
$button.val("Preview");
$preview.hide();
$input.slideDown("fast");
}
Danbooru.Dtext.click_button = function(e) {
var $button = $(e.target);
var $input = $("#" + $button.data("input-id"));
var $preview = $("#" + $button.data("preview-id"));
if ($button.val().match(/preview/i)) {
Danbooru.Dtext.call_preview(e, $button, $input, $preview);
} else {
Danbooru.Dtext.call_edit(e, $button, $input, $preview);
}
e.preventDefault();
}
})();
$(document).ready(function() {
Danbooru.Dtext.initialize_all();
});

View File

@@ -1,51 +0,0 @@
(function() {
Danbooru.FavoriteGroup = {};
Danbooru.FavoriteGroup.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
this.initialize_add_to_favgroup_dialog();
Danbooru.keydown("1 2 3 4 5 6 7 8 9 0", "add_to_favgroup", Danbooru.FavoriteGroup.add_to_favgroup);
}
}
Danbooru.FavoriteGroup.initialize_add_to_favgroup_dialog = function() {
$("#add-to-favgroup-dialog").dialog({
autoOpen: false,
width: 500,
buttons: {
"Cancel": function() {
$(this).dialog("close");
}
}
});
var open_favgroup_dialog = function(e) {
if (Danbooru.meta("current-user-id") == "") { // anonymous
return;
}
if ($(".add-to-favgroup").length === 1) {
// If the user only has one favorite group we don't need to ask which group to add the post to.
$(".add-to-favgroup").click();
} else if ($(".add-to-favgroup").length > 1) {
$("#add-to-favgroup-dialog").dialog("open");
}
e.preventDefault();
}
Danbooru.keydown("g", "open_favgroup_dialog", open_favgroup_dialog);
$("#open-favgroup-dialog-link").click(open_favgroup_dialog);
}
Danbooru.FavoriteGroup.add_to_favgroup = function(e) {
var favgroup_index = (e.key === "0") ? "10" : e.key;
var link = $("#add-to-favgroup-" + favgroup_index + ":visible");
if (link.length) {
link.click();
}
}
})();
$(function() {
Danbooru.FavoriteGroup.initialize_all();
});

View File

@@ -1,61 +0,0 @@
(function() {
Danbooru.Favorite = {};
Danbooru.Favorite.initialize_all = function() {
if ($("#c-posts").length) {
this.hide_or_show_add_to_favorites_link();
}
}
Danbooru.Favorite.hide_or_show_add_to_favorites_link = function() {
var current_user_id = Danbooru.meta("current-user-id");
if (current_user_id == "") {
$("#add-to-favorites").hide();
$("#remove-from-favorites").hide();
$("#add-fav-button").hide();
$("#remove-fav-button").hide();
return;
}
if ($("#image-container").length && $("#image-container").data("is-favorited") == true) {
$("#add-to-favorites").hide();
$("#add-fav-button").hide();
} else {
$("#remove-from-favorites").hide();
$("#remove-fav-button").hide();
}
}
Danbooru.Favorite.create = function(post_id) {
Danbooru.Post.notice_update("inc");
$.ajax({
type: "POST",
url: "/favorites",
data: {
post_id: post_id
},
complete: function() {
Danbooru.Post.notice_update("dec");
},
error: function(data, status, xhr) {
Danbooru.notice("Error: " + data.reason);
}
});
}
Danbooru.Favorite.destroy = function(post_id) {
Danbooru.Post.notice_update("inc");
$.ajax({
type: "DELETE",
url: "/favorites/" + post_id,
complete: function() {
Danbooru.Post.notice_update("dec");
}
});
}
})();
$(document).ready(function() {
Danbooru.Favorite.initialize_all();
});

View File

@@ -1,2 +0,0 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@@ -1,45 +0,0 @@
(function() {
Danbooru.ForumPost = {};
Danbooru.ForumPost.initialize_all = function() {
if ($("#c-forum-topics #a-show,#c-forum-posts #a-show").length) {;
this.initialize_edit_links();
Danbooru.keydown("e", "edit", function(e) {
$(".edit_forum_topic_link")[0].click();
});
Danbooru.keydown("shift+d", "delete", function(e) {
$("#forum-topic-delete a")[0].click();
});
}
if ($("#c-forum-topics").length) {
Danbooru.keydown("shift+r", "mark_all_as_read", function(e) {
$("#forum-topic-mark-all-as-read a")[0].click();
});
}
}
Danbooru.ForumPost.initialize_edit_links = function() {
$(".edit_forum_post, .edit_forum_topic").hide();
$(".edit_forum_post_link").click(function(e) {
var link_id = $(this).attr("id");
var forum_post_id = link_id.match(/^edit_forum_post_link_(\d+)$/)[1];
$("#edit_forum_post_" + forum_post_id).fadeToggle("fast");
e.preventDefault();
});
$(".edit_forum_topic_link").click(function(e) {
var link_id = $(this).attr("id");
var forum_topic_id = link_id.match(/^edit_forum_topic_link_(\d+)$/)[1];
$("#edit_forum_topic_" + forum_topic_id).fadeToggle("fast");
e.preventDefault();
});
}
})();
$(document).ready(function() {
Danbooru.ForumPost.initialize_all();
});

View File

@@ -1,29 +0,0 @@
(function() {
Danbooru.JanitorTrials = {};
Danbooru.JanitorTrials.initialize_all = function() {
if ($("#c-janitor-trials").length) {
$("input[value=Test]").click(function(e) {
$.ajax({
type: "get",
url: "/janitor_trials/test.json",
data: {
janitor_trial: {
user_name: $("#janitor_trial_user_name").val()
}
},
success: function(data) {
$("#test-results").html(data);
}
});
e.preventDefault();
});
}
}
})();
$(document).ready(function() {
Danbooru.JanitorTrials.initialize_all();
});

View File

@@ -1,65 +0,0 @@
(function() {
Danbooru.ModQueue = {};
Danbooru.ModQueue.processed = 0;
Danbooru.ModQueue.increment_processed = function() {
if (Danbooru.meta("random-mode") === "1") {
Danbooru.ModQueue.processed += 1;
if (Danbooru.ModQueue.processed === 12) {
window.location = Danbooru.meta("return-to");
}
}
}
Danbooru.ModQueue.initialize_hilights = function() {
$.each($("div.post"), function(i, v) {
var $post = $(v);
var score = parseInt($post.data("score"));
if (score >= 3) {
$post.addClass("post-pos-score");
}
if (score <= -3) {
$post.addClass("post-neg-score");
}
if ($post.data("has-children")) {
$post.addClass("post-has-children");
}
});
}
Danbooru.ModQueue.initialize_detailed_rejection_links = function() {
$(".detailed-rejection-link").click(Danbooru.ModQueue.detailed_rejection_dialog)
}
Danbooru.ModQueue.detailed_rejection_dialog = function() {
$("#post_disapproval_post_id").val($(this).data("post-id"));
$("#detailed-rejection-dialog").dialog({
width: 500,
buttons: {
"Submit": function() {
$(this).find("form").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
return false;
}
})();
$(function() {
if ($("#c-moderator-post-queues").length) {
Danbooru.ModQueue.initialize_hilights();
Danbooru.ModQueue.initialize_detailed_rejection_links();
}
if ($("#c-posts #a-show").length) {
Danbooru.ModQueue.initialize_detailed_rejection_links();
}
});

View File

@@ -1,28 +0,0 @@
(function() {
Danbooru.NewsUpdate = {};
Danbooru.NewsUpdate.initialize = function() {
var key = $("#news-updates").data("id");
if (Danbooru.Cookie.get("news-ticker") == key) {
$("#news-updates").hide();
} else {
$("#news-updates").show();
$("#close-news-ticker-link").click(function(e) {
$("#news-updates").hide();
Danbooru.Cookie.put("news-ticker", key);
// need to reset the more link
var $site_map_link = $("#site-map-link");
$("#more-links").hide().offset({top: $site_map_link.offset().top + $site_map_link.height() + 10, left: $site_map_link.offset().left});
return false;
});
}
}
})();
$(function() {
Danbooru.NewsUpdate.initialize();
});

View File

@@ -1,830 +0,0 @@
Danbooru.Note = {
Box: {
create: function(id) {
var $inner_border = $('<div/>');
$inner_border.addClass("note-box-inner-border");
var opacity = 0;
if (Danbooru.Note.embed) {
opacity = 0.95
} else {
opacity = 0.5
}
$inner_border.css({
opacity: opacity,
});
var $note_box = $('<div/>');
$note_box.addClass("note-box");
if (Danbooru.Note.embed) {
$note_box.addClass("embedded");
}
$note_box.data("id", String(id));
$note_box.attr("data-id", String(id));
$note_box.draggable({
containment: $("#image"),
stop: function(e, ui) {
Danbooru.Note.Box.update_data_attributes($note_box);
}
});
$note_box.resizable({
containment: $("#image"),
handles: "se, nw",
stop: function(e, ui) {
Danbooru.Note.Box.update_data_attributes($note_box);
}
});
$note_box.css({position: "absolute"});
$note_box.append($inner_border);
Danbooru.Note.Box.bind_events($note_box);
return $note_box;
},
update_data_attributes: function($note_box) {
var $image = $("#image");
var ratio = $image.width() / parseFloat($image.data("original-width"));
var new_x = parseFloat($note_box.css("left"));
var new_y = parseFloat($note_box.css("top"));
var new_width = parseFloat($note_box.css("width"));
var new_height = parseFloat($note_box.css("height"));
new_x = parseInt(new_x / ratio);
new_y = parseInt(new_y / ratio);
new_width = parseInt(new_width / ratio);
new_height = parseInt(new_height / ratio);
$note_box.data("x", new_x);
$note_box.data("y", new_y);
$note_box.data("width", new_width);
$note_box.data("height", new_height);
},
bind_events: function($note_box) {
$note_box.on(
"dragstart resizestart",
function(e) {
var $note_box_inner = $(e.currentTarget);
$note_box_inner.find(".note-box-inner-border").addClass("unsaved");
Danbooru.Note.dragging = true;
Danbooru.Note.clear_timeouts();
Danbooru.Note.Body.hide_all();
if (Danbooru.Note.embed) {
var $bg = $note_box_inner.find("div.bg")
if ($bg.length) {
$bg.hide();
}
}
e.stopPropagation();
}
);
$note_box.resize(
function(e) {
var $note_box_inner = $(e.currentTarget);
Danbooru.Note.Box.resize_inner_border($note_box_inner);
e.stopPropagation();
}
);
$note_box.on(
"dragstop resizestop",
function(e) {
Danbooru.Note.dragging = false;
if (Danbooru.Note.embed) {
var $note_box_inner = $(e.currentTarget);
var $bg = $note_box_inner.find("div.bg")
if ($bg.length) {
$bg.show();
Danbooru.Note.Box.resize_inner_border($note_box_inner.closest(".note-box"));
}
}
e.stopPropagation();
}
);
$note_box.on(
"mouseover mouseout",
function(e) {
if (Danbooru.Note.dragging) {
return;
}
var $note_box_inner = $(e.currentTarget);
if (e.type === "mouseover") {
Danbooru.Note.Body.show($note_box_inner.data("id"));
if (Danbooru.Note.editing) {
var $this = $(this);
$this.resizable("enable");
$this.draggable("enable");
}
} else if (e.type === "mouseout") {
Danbooru.Note.Body.hide($note_box_inner.data("id"));
if (Danbooru.Note.editing) {
var $this = $(this);
$this.resizable("disable");
$this.draggable("disable");
}
}
e.stopPropagation();
}
);
},
find: function(id) {
return $("#note-container div.note-box[data-id=" + id + "]");
},
show_highlighted: function($note_box) {
var note_id = $note_box.data("id");
Danbooru.Note.Body.show(note_id);
$(".note-box-highlighted").removeClass("note-box-highlighted");
$note_box.addClass("note-box-highlighted");
Danbooru.scroll_to($note_box);
},
resize_inner_border: function($note_box) {
var $inner_border = $note_box.find("div.note-box-inner-border");
$inner_border.css({
height: $note_box.height() - 2,
width: $note_box.width() - 2
});
if ($inner_border.width() >= $note_box.width() - 2) {
$note_box.width($inner_border.width() + 2);
}
if ($inner_border.height() >= $note_box.height() - 2) {
$note_box.height($inner_border.height() + 2);
}
if (Danbooru.Note.embed) {
var $bg = $inner_border.find("div.bg");
if ($bg.length) {
$bg.height($inner_border.height());
$bg.width($inner_border.width());
}
}
},
scale: function($note_box) {
var $image = $("#image");
var ratio = $image.width() / parseFloat($image.data("original-width"));
var MIN_SIZE = 5;
$note_box.css({
top: Math.ceil(parseFloat($note_box.data("y")) * ratio),
left: Math.ceil(parseFloat($note_box.data("x")) * ratio),
width: Math.max(MIN_SIZE, Math.ceil(parseFloat($note_box.data("width")) * ratio)),
height: Math.max(MIN_SIZE, Math.ceil(parseFloat($note_box.data("height")) * ratio))
});
Danbooru.Note.Box.resize_inner_border($note_box);
},
scale_all: function() {
var container = document.getElementById('note-container');
if (container === null) {
return;
}
// Hide notes while rescaling, to prevent unnecessary reflowing
var was_visible = container.style.display != 'none';
if (was_visible) {
container.style.display = 'none';
}
$(".note-box").each(function(i, v) {
Danbooru.Note.Box.scale($(v));
});
if (was_visible) {
container.style.display = 'block';
}
},
toggle_all: function() {
var $note_container = $("#note-container");
var is_hidden = ($note_container.css('visibility') === 'hidden');
if (is_hidden) {
$note_container.css('visibility', 'visible');
} else {
$note_container.css('visibility', 'hidden');
}
}
},
Body: {
create: function(id) {
var $note_body = $('<div></div>');
$note_body.addClass("note-body");
$note_body.data("id", String(id));
$note_body.attr("data-id", String(id));
$note_body.hide();
Danbooru.Note.Body.bind_events($note_body);
return $note_body;
},
initialize: function($note_body) {
var $note_box = Danbooru.Note.Box.find($note_body.data("id"));
$note_body.css({
top: $note_box.position().top + $note_box.height() + 5,
left: $note_box.position().left
});
Danbooru.Note.Body.bound_position($note_body);
},
bound_position: function($note_body) {
var $image = $("#image");
var doc_width = $image.offset().left + $image.width();
/*while ($note_body[0].clientHeight < $note_body[0].scrollHeight) {
$note_body.css({height: $note_body.height() + 5});
}
while ($note_body[0].clientWidth < $note_body[0].scrollWidth) {
$note_body.css({width: $note_body.width() + 5});
}*/
if ($note_body.offset().left + $note_body.width() > doc_width) {
$note_body.css({
left: $note_body.position().left - 10 - ($note_body.offset().left + $note_body.width() - doc_width)
});
}
},
show: function(id) {
Danbooru.Note.Body.hide_all();
Danbooru.Note.clear_timeouts();
var $note_body = Danbooru.Note.Body.find(id);
if (!$note_body.data('resized')) {
Danbooru.Note.Body.resize($note_body);
$note_body.data('resized', 'true');
}
$note_body.show();
Danbooru.Note.Body.initialize($note_body);
},
find: function(id) {
return $("#note-container div.note-body[data-id=" + id + "]");
},
hide: function(id) {
var $note_body = Danbooru.Note.Body.find(id);
Danbooru.Note.timeouts.push($.timeout(250).done(function() {$note_body.hide();}));
},
hide_all: function() {
$("#note-container div.note-body").hide();
},
resize: function($note_body) {
$note_body.css("min-width", "");
var w = $note_body.width();
var h = $note_body.height();
var golden_ratio = 1.6180339887;
var last = 0;
var x = 0;
if ((w / h) < golden_ratio) {
var lo = 140;
var hi = 400;
do {
last = w;
x = (lo + hi) / 2;
$note_body.css("min-width", x);
w = $note_body.width();
h = $note_body.height();
if ((w / h) < golden_ratio) {
lo = x;
} else {
hi = x;
}
} while ((lo < hi) && (w > last));
} else if ($note_body[0].scrollWidth <= $note_body.width()) {
var lo = 20;
var hi = w;
do {
x = (lo + hi) / 2;
$note_body.css("min-width", x);
if ($note_body.height() > h) {
lo = x
} else {
hi = x;
}
} while ((hi - lo) > 4);
if ($note_body.height() > h) {
$note_body.css("min-width", hi);
}
}
},
set_text: function($note_body, $note_box, text) {
Danbooru.Note.Body.display_text($note_body, text);
if (Danbooru.Note.embed) {
Danbooru.Note.Body.display_text($note_box.children("div.note-box-inner-border"), text);
}
Danbooru.Note.Body.resize($note_body);
Danbooru.Note.Body.bound_position($note_body);
},
display_text: function($note_body, text) {
text = text.replace(/<tn>/g, '<p class="tn">');
text = text.replace(/<\/tn>/g, '</p>');
text = text.replace(/\n/g, '<br>');
$note_body.html(text);
},
bind_events: function($note_body) {
$note_body.mouseover(function(e) {
var $note_body_inner = $(e.currentTarget);
Danbooru.Note.Body.show($note_body_inner.data("id"));
e.stopPropagation();
});
$note_body.mouseout(function(e) {
var $note_body_inner = $(e.currentTarget);
Danbooru.Note.Body.hide($note_body_inner.data("id"));
e.stopPropagation();
});
if (Danbooru.meta("current-user-name") !== "Anonymous") {
$note_body.click(function(e) {
if (e.target.tagName !== "A") {
var $note_body_inner = $(e.currentTarget);
Danbooru.Note.Edit.show($note_body_inner);
}
e.stopPropagation();
});
} else {
$note_body.click(function(e) {
if (e.target.tagName !== "A") {
Danbooru.notice("You must be logged in to edit notes");
}
e.stopPropagation();
});
}
}
},
Edit: {
show: function($note_body) {
var id = $note_body.data("id");
if (Danbooru.Note.editing) {
return;
}
$(".note-box").resizable("disable");
$(".note-box").draggable("disable");
if (Danbooru.Note.embed) {
$(".note-box").css("opacity", "0.5");
}
$textarea = $('<textarea></textarea>');
$textarea.css({
width: "97%",
height: "92%",
resize: "none",
});
if ($note_body.html() !== "<em>Click to edit</em>") {
$textarea.val($note_body.data("original-body"));
}
$dialog = $('<div></div>');
$dialog.append($textarea);
$dialog.data("id", id);
$dialog.dialog({
width: 360,
height: 210,
position: {
my: "right",
at: "right-20",
of: window
},
classes: {
"ui-dialog": "note-edit-dialog",
},
title: "Edit note",
buttons: {
"Save": Danbooru.Note.Edit.save,
"Preview": Danbooru.Note.Edit.preview,
"Cancel": Danbooru.Note.Edit.cancel,
"Delete": Danbooru.Note.Edit.destroy,
"History": Danbooru.Note.Edit.history
}
});
$dialog.data("uiDialog")._title = function(title) {
title.html(this.options.title); // Allow unescaped html in dialog title
}
$dialog.dialog("option", "title", 'Edit note #' + id + ' (<a href="/wiki_pages/help:notes">view help</a>)');
$dialog.on("dialogclose", function() {
Danbooru.Note.editing = false;
$(".note-box").resizable("enable");
$(".note-box").draggable("enable");
if (Danbooru.Note.embed) {
$(".note-box").css("opacity", "0.95");
}
});
$textarea.selectEnd();
Danbooru.Note.editing = true;
},
parameterize_note: function($note_box, $note_body) {
var $image = $("#image");
var original_width = parseInt($image.data("original-width"));
var ratio = parseInt($image.width()) / original_width;
var hash = {
note: {
x: $note_box.position().left / ratio,
y: $note_box.position().top / ratio,
width: $note_box.width() / ratio,
height: $note_box.height() / ratio,
body: $note_body.data("original-body"),
}
}
if ($note_box.data("id").match(/x/)) {
hash.note.html_id = $note_box.data("id");
hash.note.post_id = Danbooru.meta("post-id");
}
return hash;
},
error_handler: function(xhr, status, exception) {
Danbooru.error("Error: " + (xhr.responseJSON.reason || xhr.responseJSON.reasons.join("; ")));
},
success_handler: function(data, status, xhr) {
if (data.html_id) { // new note
var $note_body = Danbooru.Note.Body.find(data.html_id);
var $note_box = Danbooru.Note.Box.find(data.html_id);
$note_body.data("id", String(data.id)).attr("data-id", data.id);
$note_box.data("id", String(data.id)).attr("data-id", data.id);
$note_box.find(".note-box-inner-border").removeClass("unsaved");
} else {
var $note_box = Danbooru.Note.Box.find(data.id);
$note_box.find(".note-box-inner-border").removeClass("unsaved");
}
},
save: function() {
var $this = $(this);
var $textarea = $this.find("textarea");
var id = $this.data("id");
var $note_body = Danbooru.Note.Body.find(id);
var $note_box = Danbooru.Note.Box.find(id);
var text = $textarea.val();
$note_body.data("original-body", text);
Danbooru.Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).then(function(data) {
Danbooru.Note.Body.set_text($note_body, $note_box, data.body);
Danbooru.Note.Box.resize_inner_border($note_box);
$note_body.show();
});
$this.dialog("close");
if (id.match(/\d/)) {
$.ajax("/notes/" + id + ".json", {
type: "PUT",
data: Danbooru.Note.Edit.parameterize_note($note_box, $note_body),
error: Danbooru.Note.Edit.error_handler,
success: Danbooru.Note.Edit.success_handler
});
} else {
$.ajax("/notes.json", {
type: "POST",
data: Danbooru.Note.Edit.parameterize_note($note_box, $note_body),
error: Danbooru.Note.Edit.error_handler,
success: Danbooru.Note.Edit.success_handler
});
}
},
preview: function() {
var $this = $(this);
var $textarea = $this.find("textarea");
var id = $this.data("id");
var $note_body = Danbooru.Note.Body.find(id);
var text = $textarea.val();
var $note_box = Danbooru.Note.Box.find(id);
$note_box.find(".note-box-inner-border").addClass("unsaved");
Danbooru.Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).then(function(data) {
Danbooru.Note.Body.set_text($note_body, $note_box, data.body);
$note_body.show();
});
},
cancel: function() {
$(this).dialog("close");
},
destroy: function() {
if (!confirm("Do you really want to delete this note?")) {
return
}
var $this = $(this);
var id = $this.data("id");
if (id.match(/\d/)) {
$.ajax("/notes/" + id + ".json", {
type: "DELETE",
success: function() {
Danbooru.Note.Box.find(id).remove();
Danbooru.Note.Body.find(id).remove();
$this.dialog("close");
}
});
}
},
history: function() {
var $this = $(this);
var id = $this.data("id");
if (id.match(/\d/)) {
window.location.href = "/note_versions?search[note_id]=" + id;
}
$(this).dialog("close");
}
},
TranslationMode: {
active: false,
toggle: function(e) {
if (Danbooru.Note.TranslationMode.active) {
Danbooru.Note.TranslationMode.stop(e);
} else {
Danbooru.Note.TranslationMode.start(e);
}
},
start: function(e) {
e.preventDefault();
if (Danbooru.meta("current-user-id") == "") {
Danbooru.notice("You must be logged in to edit notes");
return;
}
if (Danbooru.Note.TranslationMode.active) {
return;
}
$("#image").css("cursor", "crosshair");
Danbooru.Note.TranslationMode.active = true;
$(document.body).addClass("mode-translation");
$("#original-file-link").click();
$("#image").off("click", Danbooru.Note.Box.toggle_all);
$("#image").mousedown(Danbooru.Note.TranslationMode.Drag.start);
$(window).mouseup(Danbooru.Note.TranslationMode.Drag.stop);
$("#mark-as-translated-section").show();
Danbooru.notice('Translation mode is on. Drag on the image to create notes. <a href="#">Turn translation mode off</a> (shortcut is <span class="key">n</span>).');
$("#notice a:contains(Turn translation mode off)").click(Danbooru.Note.TranslationMode.stop);
},
stop: function(e) {
e.preventDefault();
Danbooru.Note.TranslationMode.active = false;
$("#image").css("cursor", "auto");
$("#image").click(Danbooru.Note.Box.toggle_all);
$("#image").off("mousedown", Danbooru.Note.TranslationMode.Drag.start);
$(window).off("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
$(document.body).removeClass("mode-translation");
$("#close-notice-link").click();
$("#mark-as-translated-section").hide();
},
create_note: function(e, x, y, w, h) {
var offset = $("#image").offset();
if (w > 9 || h > 9) { /* minimum note size: 10px */
if (w <= 9) {
w = 10;
} else if (h <= 9) {
h = 10;
}
Danbooru.Note.create(x - offset.left, y - offset.top, w, h);
}
$("#note-container").css('visibility', 'visible');
e.stopPropagation();
e.preventDefault();
},
Drag: {
dragging: false,
dragStartX: 0,
dragStartY: 0,
dragDistanceX: 0,
dragDistanceY: 0,
x: 0,
y: 0,
w: 0,
h: 0,
start: function (e) {
if (e.which !== 1) {
return;
}
e.preventDefault(); /* don't drag the image */
$(window).mousemove(Danbooru.Note.TranslationMode.Drag.drag);
Danbooru.Note.TranslationMode.Drag.dragStartX = e.pageX;
Danbooru.Note.TranslationMode.Drag.dragStartY = e.pageY;
},
drag: function (e) {
Danbooru.Note.TranslationMode.Drag.dragDistanceX = e.pageX - Danbooru.Note.TranslationMode.Drag.dragStartX;
Danbooru.Note.TranslationMode.Drag.dragDistanceY = e.pageY - Danbooru.Note.TranslationMode.Drag.dragStartY;
var $image = $("#image");
var offset = $image.offset();
var limitX1 = $image.width() - Danbooru.Note.TranslationMode.Drag.dragStartX + offset.left - 1;
var limitX2 = offset.left - Danbooru.Note.TranslationMode.Drag.dragStartX;
var limitY1 = $image.height()- Danbooru.Note.TranslationMode.Drag.dragStartY + offset.top - 1;
var limitY2 = offset.top - Danbooru.Note.TranslationMode.Drag.dragStartY;
if (Danbooru.Note.TranslationMode.Drag.dragDistanceX > limitX1) {
Danbooru.Note.TranslationMode.Drag.dragDistanceX = limitX1;
} else if (Danbooru.Note.TranslationMode.Drag.dragDistanceX < limitX2) {
Danbooru.Note.TranslationMode.Drag.dragDistanceX = limitX2;
}
if (Danbooru.Note.TranslationMode.Drag.dragDistanceY > limitY1) {
Danbooru.Note.TranslationMode.Drag.dragDistanceY = limitY1;
} else if (Danbooru.Note.TranslationMode.Drag.dragDistanceY < limitY2) {
Danbooru.Note.TranslationMode.Drag.dragDistanceY = limitY2;
}
if (Math.abs(Danbooru.Note.TranslationMode.Drag.dragDistanceX) > 9 && Math.abs(Danbooru.Note.TranslationMode.Drag.dragDistanceY) > 9) {
Danbooru.Note.TranslationMode.Drag.dragging = true; /* must drag at least 10pixels (minimum note size) in both dimensions. */
}
if (Danbooru.Note.TranslationMode.Drag.dragging) {
if (Danbooru.Note.TranslationMode.Drag.dragDistanceX >= 0) {
Danbooru.Note.TranslationMode.Drag.x = Danbooru.Note.TranslationMode.Drag.dragStartX;
Danbooru.Note.TranslationMode.Drag.w = Danbooru.Note.TranslationMode.Drag.dragDistanceX;
} else {
Danbooru.Note.TranslationMode.Drag.x = Danbooru.Note.TranslationMode.Drag.dragStartX + Danbooru.Note.TranslationMode.Drag.dragDistanceX;
Danbooru.Note.TranslationMode.Drag.w = -Danbooru.Note.TranslationMode.Drag.dragDistanceX;
}
if (Danbooru.Note.TranslationMode.Drag.dragDistanceY >= 0) {
Danbooru.Note.TranslationMode.Drag.y = Danbooru.Note.TranslationMode.Drag.dragStartY;
Danbooru.Note.TranslationMode.Drag.h = Danbooru.Note.TranslationMode.Drag.dragDistanceY;
} else {
Danbooru.Note.TranslationMode.Drag.y = Danbooru.Note.TranslationMode.Drag.dragStartY + Danbooru.Note.TranslationMode.Drag.dragDistanceY;
Danbooru.Note.TranslationMode.Drag.h = -Danbooru.Note.TranslationMode.Drag.dragDistanceY;
}
$('#note-preview').css({
display: 'block',
left: (Danbooru.Note.TranslationMode.Drag.x + 1),
top: (Danbooru.Note.TranslationMode.Drag.y + 1),
width: (Danbooru.Note.TranslationMode.Drag.w - 3),
height: (Danbooru.Note.TranslationMode.Drag.h - 3)
});
}
},
stop: function (e) {
if (e.which !== 1) {
return;
}
if (Danbooru.Note.TranslationMode.Drag.dragStartX === 0) {
return; /* 'stop' is bound to window, don't create note if start wasn't triggered */
}
$(window).off("mousemove");
if (Danbooru.Note.TranslationMode.Drag.dragging) {
$('#note-preview').css({display:'none'});
Danbooru.Note.TranslationMode.create_note(e, Danbooru.Note.TranslationMode.Drag.x, Danbooru.Note.TranslationMode.Drag.y, Danbooru.Note.TranslationMode.Drag.w-1, Danbooru.Note.TranslationMode.Drag.h-1);
Danbooru.Note.TranslationMode.Drag.dragging = false; /* border of the note is pixel-perfect on the preview border */
} else { /* no dragging -> toggle display of notes */
Danbooru.Note.Box.toggle_all();
}
Danbooru.Note.TranslationMode.Drag.dragStartX = 0;
Danbooru.Note.TranslationMode.Drag.dragStartY = 0;
}
}
},
id: "x",
dragging: false,
editing: false,
timeouts: [],
pending: {},
add: function(container, id, x, y, w, h, original_body, sanitized_body) {
var $note_box = Danbooru.Note.Box.create(id);
var $note_body = Danbooru.Note.Body.create(id);
$note_box.data('x', x);
$note_box.data('y', y);
$note_box.data('width', w);
$note_box.data('height', h);
container.appendChild($note_box[0]);
container.appendChild($note_body[0]);
$note_body.data("original-body", original_body);
Danbooru.Note.Box.scale($note_box);
Danbooru.Note.Body.display_text($note_body, sanitized_body);
if (Danbooru.Note.embed) {
Danbooru.Note.Body.display_text($note_box.children("div.note-box-inner-border"), sanitized_body);
}
},
create: function(x, y, w, h) {
var $note_box = Danbooru.Note.Box.create(Danbooru.Note.id);
var $note_body = Danbooru.Note.Body.create(Danbooru.Note.id);
$note_box.css({
top: y,
left: x,
width: w,
height: h
});
Danbooru.Note.Box.update_data_attributes($note_box);
$note_box.find(".note-box-inner-border").addClass("unsaved");
$note_body.html("<em>Click to edit</em>");
$("#note-container").append($note_box);
$("#note-container").append($note_body);
Danbooru.Note.Box.resize_inner_border($note_box);
Danbooru.Note.id += "x";
},
clear_timeouts: function() {
$.each(Danbooru.Note.timeouts, function(i, v) {
v.clear();
});
Danbooru.Note.timeouts = [];
},
load_all: function() {
var fragment = document.createDocumentFragment();
$.each($("#notes article"), function(i, article) {
var $article = $(article);
Danbooru.Note.add(
fragment,
$article.data("id"),
$article.data("x"),
$article.data("y"),
$article.data("width"),
$article.data("height"),
$article.data("body"),
$article.html()
);
});
$("#note-container").append(fragment);
if (Danbooru.Note.embed) {
$.each($(".note-box"), function(i, note_box) {
Danbooru.Note.Box.resize_inner_border($(note_box));
});
}
},
initialize_all: function() {
if ($("#c-posts #a-show #image").length == 0 || $("video#image").length) {
return;
}
Danbooru.Note.embed = (Danbooru.meta("post-has-embedded-notes") === "true");
Danbooru.Note.load_all();
this.initialize_shortcuts();
this.initialize_highlight();
$(window).on("hashchange", this.initialize_highlight);
},
initialize_shortcuts: function() {
if ($("#note-locked-notice").length == 0) {
$("#translate").click(Danbooru.Note.TranslationMode.toggle);
Danbooru.keydown("n", "translation_mode", Danbooru.Note.TranslationMode.toggle);
}
$("#image").click(Danbooru.Note.Box.toggle_all);
},
initialize_highlight: function() {
var matches = window.location.hash.match(/^#note-(\d+)$/);
if (matches) {
var $note_box = Danbooru.Note.Box.find(matches[1]);
Danbooru.Note.Box.show_highlighted($note_box);
}
},
}
$(function() {
Danbooru.Note.initialize_all();
});

View File

@@ -1,25 +0,0 @@
(function() {
Danbooru.Paginator = {};
Danbooru.Paginator.next_page = function() {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
}
Danbooru.Paginator.prev_page = function() {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
}
}
})();
$(function() {
if ($(".paginator").length) {
Danbooru.keydown("d right", "next_page", Danbooru.Paginator.next_page);
Danbooru.keydown("a left", "prev_page", Danbooru.Paginator.prev_page);
}
});

View File

@@ -1,63 +0,0 @@
(function() {
Danbooru.Pool = {};
Danbooru.Pool.initialize_all = function() {
if ($("#c-pools").length) {
this.initialize_shortcuts();
}
if ($("#c-posts").length && $("#a-show").length) {
this.initialize_add_to_pool_link();
}
if ($("#c-pool-orders,#c-favorite-group-orders").length) {
this.initialize_simple_edit();
}
}
Danbooru.Pool.initialize_add_to_pool_link = function() {
$("#add-to-pool-dialog").dialog({autoOpen: false});
$("#pool").click(function(e) {
e.preventDefault();
$("#add-to-pool-dialog").dialog("open");
});
$("#recent-pools li").click(function(e) {
e.preventDefault();
$("#pool_name").val($(this).attr("data-value"));
});
}
Danbooru.Pool.initialize_shortcuts = function() {
if ($("#c-pools #a-show").length) {
Danbooru.keydown("e", "edit", function(e) {
$("#pool-edit a")[0].click();
});
Danbooru.keydown("shift+d", "delete", function(e) {
$("#pool-delete a")[0].click();
});
}
};
Danbooru.Pool.initialize_simple_edit = function() {
$("#sortable").sortable({
placeholder: "ui-state-placeholder"
});
$("#sortable").disableSelection();
$("#ordering-form").submit(function(e) {
$.ajax({
type: "put",
url: e.target.action,
data: $("#sortable").sortable("serialize") + "&" + $(e.target).serialize()
});
e.preventDefault();
});
}
})();
$(document).ready(function() {
Danbooru.Pool.initialize_all();
});

View File

@@ -1,42 +0,0 @@
(function() {
Danbooru.PostAppeal = {};
Danbooru.PostAppeal.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
this.initialize_appeal();
this.hide_or_show_appeal_link();
}
}
Danbooru.PostAppeal.hide_or_show_appeal_link = function() {
if ((Danbooru.meta("post-is-flagged") === "false") && (Danbooru.meta("post-is-deleted") === "false")) {
$("#appeal").hide();
}
}
Danbooru.PostAppeal.initialize_appeal = function() {
$("#appeal-dialog").dialog({
autoOpen: false,
width: 700,
modal: true,
buttons: {
"Submit": function() {
$("#appeal-dialog form").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$("#appeal").click(function(e) {
e.preventDefault();
$("#appeal-dialog").dialog("open");
});
}
})();
$(document).ready(function() {
Danbooru.PostAppeal.initialize_all();
});

View File

@@ -1,46 +0,0 @@
(function() {
Danbooru.PostFlag = {};
Danbooru.PostFlag.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
this.initialize_flag();
this.hide_or_show_flag_link();
}
}
Danbooru.PostFlag.hide_or_show_flag_link = function() {
if (Danbooru.meta("post-is-deleted") === "true") {
$("#flag").hide();
}
}
Danbooru.PostFlag.initialize_flag = function() {
$("#flag-dialog").dialog({
autoOpen: false,
width: 700,
modal: true,
buttons: {
"Submit": function() {
$("#flag-dialog form").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#flag-dialog form').submit(function() {
$('#flag-dialog').dialog('close');
});
$("#flag").click(function(e) {
e.preventDefault();
$("#flag-dialog").dialog("open");
});
}
})();
$(function() {
Danbooru.PostFlag.initialize_all();
});

View File

@@ -1,186 +0,0 @@
(function() {
Danbooru.PostModeMenu = {};
Danbooru.PostModeMenu.initialize = function() {
if ($("#c-posts").length || $("#c-favorites").length || $("#c-pools").length) {
this.initialize_selector();
this.initialize_preview_link();
this.initialize_edit_form();
this.initialize_tag_script_field();
this.initialize_shortcuts();
Danbooru.PostModeMenu.change();
}
}
Danbooru.PostModeMenu.initialize_shortcuts = function() {
Danbooru.keydown("1 2 3 4 5 6 7 8 9 0", "change_tag_script", Danbooru.PostModeMenu.change_tag_script);
}
Danbooru.PostModeMenu.show_notice = function(i) {
Danbooru.notice("Switched to tag script #" + i + ". To switch tag scripts, use the number keys.");
}
Danbooru.PostModeMenu.change_tag_script = function(e) {
if ($("#mode-box select").val() === "tag-script") {
var old_tag_script_id = Danbooru.Cookie.get("current_tag_script_id") || "1";
var old_tag_script = $("#tag-script-field").val();
var new_tag_script_id = String.fromCharCode(e.which);
var new_tag_script = Danbooru.Cookie.get("tag-script-" + new_tag_script_id);
$("#tag-script-field").val(new_tag_script);
Danbooru.Cookie.put("current_tag_script_id", new_tag_script_id);
if (old_tag_script_id != new_tag_script_id) {
Danbooru.PostModeMenu.show_notice(new_tag_script_id);
}
e.preventDefault();
}
}
Danbooru.PostModeMenu.initialize_selector = function() {
if (Danbooru.Cookie.get("mode") === "") {
Danbooru.Cookie.put("mode", "view");
$("#mode-box select").val("view");
} else {
$("#mode-box select").val(Danbooru.Cookie.get("mode"));
}
$("#mode-box select").change(function(e) {
Danbooru.PostModeMenu.change();
$("#tag-script-field:visible").focus().select();
});
}
Danbooru.PostModeMenu.initialize_preview_link = function() {
$(".post-preview a").click(Danbooru.PostModeMenu.click);
}
Danbooru.PostModeMenu.initialize_edit_form = function() {
$("#quick-edit-div").hide();
$("#quick-edit-form input[value=Cancel]").click(function(e) {
Danbooru.PostModeMenu.close_edit_form();
e.preventDefault();
});
$("#quick-edit-form").submit(function(e) {
$.ajax({
type: "put",
url: $("#quick-edit-form").attr("action"),
data: {
post: {
tag_string: $("#post_tag_string").val()
}
},
complete: function() {
$.rails.enableFormElements($("#quick-edit-form"));
},
success: function(data) {
Danbooru.Post.update_data(data);
$("#post_" + data.id).effect("shake", {distance: 5, times: 1}, 100);
Danbooru.notice("Post #" + data.id + " updated");
Danbooru.PostModeMenu.close_edit_form();
}
});
e.preventDefault();
});
}
Danbooru.PostModeMenu.close_edit_form = function() {
$("#quick-edit-div").slideUp("fast");
if (Danbooru.meta("enable-auto-complete") === "true") {
$("#post_tag_string").data("uiAutocomplete").close();
}
}
Danbooru.PostModeMenu.initialize_tag_script_field = function() {
$("#tag-script-field").blur(function(e) {
var script = $(this).val();
if (script) {
var current_script_id = Danbooru.Cookie.get("current_tag_script_id");
Danbooru.Cookie.put("tag-script-" + current_script_id, script);
} else {
$("#mode-box select").val("view");
Danbooru.PostModeMenu.change();
}
});
}
Danbooru.PostModeMenu.change = function() {
$("#quick-edit-div").slideUp("fast");
var s = $("#mode-box select").val();
if (s === undefined) {
return;
}
var $body = $(document.body);
$body.removeClass();
$body.addClass("mode-" + s);
Danbooru.Cookie.put("mode", s, 1);
if (s === "tag-script") {
var current_script_id = Danbooru.Cookie.get("current_tag_script_id");
if (!current_script_id) {
current_script_id = "1";
Danbooru.Cookie.put("current_tag_script_id", current_script_id);
}
var script = Danbooru.Cookie.get("tag-script-" + current_script_id);
$("#tag-script-field").val(script).show();
Danbooru.PostModeMenu.show_notice(current_script_id);
} else {
$("#tag-script-field").hide();
}
}
Danbooru.PostModeMenu.open_edit = function(post_id) {
var $post = $("#post_" + post_id);
$("#quick-edit-div").slideDown("fast");
$("#quick-edit-form").attr("action", "/posts/" + post_id + ".json");
$("#post_tag_string").val($post.data("tags") + " ").focus().selectEnd();
/* Set height of tag edit box to fit content. */
$("#post_tag_string").height(80); // min height: 80px.
var padding = $("#post_tag_string").innerHeight() - $("#post_tag_string").height();
var height = $("#post_tag_string").prop("scrollHeight") - padding;
$("#post_tag_string").height(height);
}
Danbooru.PostModeMenu.click = function(e) {
var s = $("#mode-box select").val();
var post_id = $(e.target).closest("article").data("id");
if (s === "add-fav") {
Danbooru.Favorite.create(post_id);
} else if (s === "remove-fav") {
Danbooru.Favorite.destroy(post_id);
} else if (s === "edit") {
Danbooru.PostModeMenu.open_edit(post_id);
} else if (s === 'vote-down') {
Danbooru.Post.vote("down", post_id);
} else if (s === 'vote-up') {
Danbooru.Post.vote("up", post_id);
} else if (s === 'lock-rating') {
Danbooru.Post.update(post_id, {"post[is_rating_locked]": "1"});
} else if (s === 'lock-note') {
Danbooru.Post.update(post_id, {"post[is_note_locked]": "1"});
} else if (s === 'approve') {
Danbooru.Post.approve(post_id);
} else if (s === 'ban') {
Danbooru.Post.ban(post_id);
} else if (s === "tag-script") {
var current_script_id = Danbooru.Cookie.get("current_tag_script_id");
var tag_script = Danbooru.Cookie.get("tag-script-" + current_script_id);
Danbooru.TagScript.run(post_id, tag_script);
} else {
return;
}
e.preventDefault();
}
})();
$(function() {
Danbooru.PostModeMenu.initialize();
});

View File

@@ -1,29 +0,0 @@
(function() {
Danbooru.PostModeration = {};
Danbooru.PostModeration.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
this.hide_or_show_approve_and_disapprove_links();
this.hide_or_show_delete_and_undelete_links();
}
}
Danbooru.PostModeration.hide_or_show_approve_and_disapprove_links = function() {
if (Danbooru.meta("post-is-approvable") !== "true") {
$("#approve").hide();
$("#disapprove").hide();
}
}
Danbooru.PostModeration.hide_or_show_delete_and_undelete_links = function() {
if (Danbooru.meta("post-is-deleted") === "true") {
$("#delete").hide();
} else {
$("#undelete").hide();
}
}
})();
$(document).ready(function() {
Danbooru.PostModeration.initialize_all();
});

View File

@@ -1,36 +0,0 @@
(function() {
Danbooru.PostPopular = {};
Danbooru.PostPopular.nav_prev = function(e) {
if ($("#popular-nav-links").length) {
var href = $("#popular-nav-links a[rel=prev]").attr("href");
if (href) {
location.href = href;
}
}
e.preventDefault();
}
Danbooru.PostPopular.nav_next = function(e) {
if ($("#popular-nav-links").length) {
var href = $("#popular-nav-links a[rel=next]").attr("href");
if (href) {
location.href = href;
}
}
e.preventDefault();
}
Danbooru.PostPopular.initialize_all = function() {
if ($("#c-explore-posts").length) {
Danbooru.keydown("a left", "prev_page", Danbooru.PostPopular.nav_prev);
Danbooru.keydown("d right", "next_page", Danbooru.PostPopular.nav_next);
}
}
})();
$(document).ready(function() {
Danbooru.PostPopular.initialize_all();
});

View File

@@ -1,129 +0,0 @@
Danbooru.PostTooltip = {};
Danbooru.PostTooltip.render_tooltip = function (event, qtip) {
var post_id = $(event.target).parents("[data-id]").data("id");
$.get("/posts/" + post_id, { variant: "tooltip" }).then(function (html) {
qtip.set("content.text", html);
qtip.elements.tooltip.removeClass("post-tooltip-loading");
// Hide the tooltip if the user stopped hovering before the ajax request completed.
if (Danbooru.PostTooltip.lostFocus) {
qtip.hide();
}
});
};
// Hide the tooltip the first time it is shown, while we wait on the ajax call to complete.
Danbooru.PostTooltip.on_show = function (event, qtip) {
if (!qtip.cache.hasBeenShown) {
qtip.elements.tooltip.addClass("post-tooltip-loading");
qtip.cache.hasBeenShown = true;
}
};
Danbooru.PostTooltip.POST_SELECTOR = "*:not(.ui-sortable-handle) > .post-preview img";
// http://qtip2.com/options
Danbooru.PostTooltip.QTIP_OPTIONS = {
style: "qtip-light post-tooltip",
content: Danbooru.PostTooltip.render_tooltip,
overwrite: false,
position: {
viewport: true,
my: "bottom left",
at: "top left",
effect: false,
adjust: {
y: -2,
method: "shift",
},
/* Position tooltip beneath mouse.
my: "top left",
at: "bottom left",
target: "mouse",
viewport: true,
adjust: {
mouse: false,
y: 25,
method: "shift",
},
*/
},
show: {
solo: true,
delay: 750,
effect: false,
ready: true,
event: "mouseenter",
},
hide: {
delay: 250,
fixed: true,
effect: false,
event: "unfocus click mouseleave",
},
events: {
show: Danbooru.PostTooltip.on_show,
},
};
Danbooru.PostTooltip.initialize = function () {
$(document).on("mouseenter", Danbooru.PostTooltip.POST_SELECTOR, function (event) {
if (Danbooru.PostTooltip.disabled()) {
$(this).qtip("disable");
} else {
$(this).qtip(Danbooru.PostTooltip.QTIP_OPTIONS, event);
}
Danbooru.PostTooltip.lostFocus = false;
});
$(document).on("mouseleave", Danbooru.PostTooltip.POST_SELECTOR, function (event) {
Danbooru.PostTooltip.lostFocus = true;
});
$(document).on("click", ".post-tooltip-disable", Danbooru.PostTooltip.on_disable_tooltips);
// Hide tooltips when pressing keys or clicking thumbnails.
$(document).on("keydown", Danbooru.PostTooltip.hide);
$(document).on("click", Danbooru.PostTooltip.POST_SELECTOR, Danbooru.PostTooltip.hide);
// Disable tooltips on touch devices. https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent
Danbooru.PostTooltip.isTouching = false;
$(document).on("touchstart", function (event) { Danbooru.PostTooltip.isTouching = true; });
$(document).on("touchend", function (event) { Danbooru.PostTooltip.isTouching = false; });
};
Danbooru.PostTooltip.hide = function (event) {
// Hide on any key except control (user may be control-clicking link inside tooltip).
if (event.type === "keydown" && event.ctrlKey === true) {
return;
}
$(".post-tooltip:visible").qtip("hide");
};
Danbooru.PostTooltip.disabled = function (event) {
return Danbooru.PostTooltip.isTouching || Danbooru.meta("disable-post-tooltips") === "true";
};
Danbooru.PostTooltip.on_disable_tooltips = function (event) {
event.preventDefault();
$(event.target).parents(".qtip").qtip("hide");
if (Danbooru.meta("current-user-id") === "") {
Danbooru.notice('<a href="/session/new">Login</a> to disable tooltips permanently');
return;
}
$.ajax("/users/" + Danbooru.meta("current-user-id") + ".json", {
method: "PUT",
data: { "user[disable_post_tooltips]": "true" },
}).then(function() {
Danbooru.notice("Tooltips disabled; check your account settings to re-enable.");
location.reload();
});
};
$(document).ready(Danbooru.PostTooltip.initialize);

View File

@@ -1,680 +0,0 @@
(function() {
Danbooru.Post = {};
Danbooru.Post.pending_update_count = 0;
Danbooru.Post.initialize_all = function() {
if ($("#c-posts").length) {
this.initialize_shortcuts();
this.initialize_saved_searches();
}
if ($("#c-posts").length && $("#a-index").length) {
this.initialize_excerpt();
this.initialize_gestures();
}
if ($("#c-posts").length && $("#a-show").length) {
this.initialize_links();
this.initialize_post_relationship_previews();
this.initialize_favlist();
this.initialize_post_sections();
this.initialize_post_image_resize_links();
this.initialize_post_image_resize_to_window_link();
this.initialize_similar();
this.initialize_replace_image_dialog();
this.initialize_gestures();
if ((Danbooru.meta("always-resize-images") === "true") || (Danbooru.meta("viewport") && (window.screen.width <= 660))) {
$("#image-resize-to-window-link").click();
}
}
if ($("#image").length) {
this.initialize_edit_dialog();
}
}
Danbooru.Post.initialize_gestures = function() {
if (Danbooru.meta("disable-mobile-gestures") === "true") {
return;
}
var $body = $("body");
if ($body.data("hammer")) {
return;
}
if (!Danbooru.test_max_width(660)) {
return;
}
$("#image-container").css({overflow: "visible"});
var hasPrev = $("#a-show").length || $(".paginator a[rel~=prev]").length;
var hasNext = $("#a-index").length && $(".paginator a[rel~=next]").length;
$body.hammer({touchAction: 'pan-y', recognizers: [[Hammer.Swipe, { threshold: 20, velocity: 0.4, direction: Hammer.DIRECTION_HORIZONTAL }]], inputClass: Hammer.TouchInput});
if (hasPrev) {
$body.hammer().on("swiperight", function(e) {
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.2s", "opacity": "0", "transform": "translateX(150%)"});
$.timeout(200).done(function() {Danbooru.Post.swipe_prev(e)});
});
}
if (hasNext) {
$body.hammer().on("swipeleft", function(e) {
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.2s", "opacity": "0", "transform": "translateX(-150%)"});
$.timeout(200).done(function() {Danbooru.Post.swipe_next(e)});
});
}
}
Danbooru.Post.initialize_edit_dialog = function(e) {
$("#open-edit-dialog").button().show().click(function(e) {
$(window).scrollTop($("#image").offset().top);
Danbooru.Post.open_edit_dialog();
e.preventDefault();
});
$("#toggle-related-tags-link").click(function(e) {
Danbooru.RelatedTag.toggle();
e.preventDefault();
});
}
Danbooru.Post.open_edit_dialog = function() {
var $tag_string = $("#post_tag_string,#upload_tag_string");
$("div.input").has($tag_string).prevAll().hide();
$("#open-edit-dialog").hide();
$("#toggle-related-tags-link").show().click();
var dialog = $("<div/>").attr("id", "edit-dialog");
$("#form").appendTo(dialog);
dialog.dialog({
title: "Edit tags",
width: $(window).width() * 0.6,
position: {
my: "right",
at: "right-20",
of: window
},
drag: function(e, ui) {
if (Danbooru.meta("enable-auto-complete") === "true") {
$tag_string.data("uiAutocomplete").close();
}
},
close: Danbooru.Post.close_edit_dialog
});
dialog.dialog("widget").draggable("option", "containment", "none");
var pin_button = $("<button/>").button({icons: {primary: "ui-icon-pin-w"}, label: "pin", text: false});
pin_button.css({width: "20px", height: "20px", position: "absolute", right: "28.4px"});
dialog.parent().children(".ui-dialog-titlebar").append(pin_button);
pin_button.click(function(e) {
var dialog_widget = $('.ui-dialog:has(#edit-dialog)');
var pos = dialog_widget.offset();
if (dialog_widget.css("position") === "absolute") {
pos.left -= $(window).scrollLeft();
pos.top -= $(window).scrollTop();
dialog_widget.offset(pos).css({position:"fixed"});
dialog.dialog("option", "resize", function() { dialog_widget.css({position:"fixed"}); });
pin_button.button("option", "icons", {primary: "ui-icon-pin-s"});
} else {
pos.left += $(window).scrollLeft();
pos.top += $(window).scrollTop();
dialog_widget.offset(pos).css({position:"absolute"});
dialog.dialog("option", "resize", function() {});
pin_button.button("option", "icons", {primary: "ui-icon-pin-w"});
}
});
dialog.parent().mouseout(function(e) {
dialog.parent().css({"opacity": 0.6, "transition": "opacity .2s ease"});
})
.mouseover(function(e) {
dialog.parent().css({"opacity": 1});
});
$tag_string.css({"resize": "none", "width": "100%"});
$tag_string.focus().selectEnd().height($tag_string[0].scrollHeight);
}
Danbooru.Post.close_edit_dialog = function(e, ui) {
$("#form").appendTo($("#c-posts #edit,#c-uploads #a-new"));
$("#edit-dialog").remove();
Danbooru.RelatedTag.show();
$("#toggle-related-tags-link").hide();
var $tag_string = $("#post_tag_string,#upload_tag_string");
$("div.input").has($tag_string).prevAll().show();
$("#open-edit-dialog").show();
$tag_string.css({"resize": "", "width": ""});
}
Danbooru.Post.initialize_similar = function() {
$("#similar-button").click(function(e) {
$.get("/iqdb_queries", {"url": $("#post_source").val()}).done(function(html) {$("#iqdb-similar").html(html).show()});
e.preventDefault();
});
}
Danbooru.Post.swipe_prev = function(e) {
if ($("#a-show").length) {
window.history.back();
} if ($(".paginator a[rel~=prev]").length) {
location.href = $("a[rel~=prev]").attr("href");
}
e.preventDefault();
}
Danbooru.Post.nav_prev = function(e) {
if ($("#search-seq-nav").length) {
var href = $("#search-seq-nav a[rel~=prev]").attr("href");
if (href) {
location.href = href;
}
} else if ($(".paginator a[rel~=prev]").length) {
location.href = $("a[rel~=prev]").attr("href");
} else {
var href = $("#pool-nav a.active[rel~=prev], #favgroup-nav a.active[rel~=prev]").attr("href");
if (href) {
location.href = href;
}
}
e.preventDefault();
}
Danbooru.Post.nav_next = function(e) {
if ($("#search-seq-nav").length) {
var href = $("#search-seq-nav a[rel~=next]").attr("href");
location.href = href;
} else if ($(".paginator a[rel~=next]").length) {
location.href = $(".paginator a[rel~=next]").attr("href");
} else {
var href = $("#pool-nav a.active[rel~=next], #favgroup-nav a.active[rel~=next]").attr("href");
if (href) {
location.href = href;
}
}
e.preventDefault();
}
Danbooru.Post.swipe_next = function(e) {
if ($(".paginator a[rel~=next ]").length) {
location.href = $(".paginator a[rel~=next]").attr("href");
}
e.preventDefault();
}
Danbooru.Post.initialize_shortcuts = function() {
if ($("#a-show").length) {
Danbooru.keydown("e", "edit", function(e) {
$("#post-edit-link").trigger("click");
$("#post_tag_string").focus();
e.preventDefault();
});
if (Danbooru.meta("current-user-can-approve-posts") === "true") {
Danbooru.keydown("shift+o", "approve", function(e) {
$(".approve-link").click();
});
}
Danbooru.keydown("a", "prev_page", Danbooru.Post.nav_prev);
Danbooru.keydown("d", "next_page", Danbooru.Post.nav_next);
Danbooru.keydown("f", "favorite", Danbooru.Post.favorite);
Danbooru.keydown("shift+f", "unfavorite", Danbooru.Post.unfavorite);
}
}
Danbooru.Post.initialize_links = function() {
$("#copy-notes").click(function(e) {
var current_post_id = $("meta[name=post-id]").attr("content");
var other_post_id = parseInt(prompt("Enter the ID of the post to copy all notes to:"), 10);
if (other_post_id !== null) {
$.ajax("/posts/" + current_post_id + "/copy_notes", {
type: "PUT",
data: {
other_post_id: other_post_id
},
success: function(data) {
Danbooru.notice("Successfully copied notes to <a href='" + other_post_id + "'>post #" + other_post_id + "</a>");
},
error: function(data) {
if (data.status === 404) {
Danbooru.error("Error: Invalid destination post");
} else if (data.responseJSON && data.responseJSON.reason) {
Danbooru.error("Error: " + data.responseJSON.reason);
} else {
Danbooru.error("There was an error copying notes to <a href='" + other_post_id + "'>post #" + other_post_id + "</a>");
}
}
});
}
e.preventDefault();
});
$(".unvote-post-link").hide();
}
Danbooru.Post.initialize_post_relationship_previews = function() {
var current_post_id = $("meta[name=post-id]").attr("content");
$("[id=post_" + current_post_id + "]").addClass("current-post");
if (Danbooru.Cookie.get("show-relationship-previews") === "0") {
this.toggle_relationship_preview($("#has-children-relationship-preview"), $("#has-children-relationship-preview-link"));
this.toggle_relationship_preview($("#has-parent-relationship-preview"), $("#has-parent-relationship-preview-link"));
}
$("#has-children-relationship-preview-link").click(function(e) {
Danbooru.Post.toggle_relationship_preview($("#has-children-relationship-preview"), $(this));
e.preventDefault();
});
$("#has-parent-relationship-preview-link").click(function(e) {
Danbooru.Post.toggle_relationship_preview($("#has-parent-relationship-preview"), $(this));
e.preventDefault();
});
}
Danbooru.Post.toggle_relationship_preview = function(preview, preview_link) {
preview.toggle();
if (preview.is(":visible")) {
preview_link.html("&laquo; hide");
Danbooru.Cookie.put("show-relationship-previews", "1");
}
else {
preview_link.html("show &raquo;");
Danbooru.Cookie.put("show-relationship-previews", "0");
}
}
Danbooru.Post.initialize_favlist = function() {
$("#favlist").hide();
$("#hide-favlist-link").hide();
var fav_count = $("#show-favlist-link").prev().text();
if (fav_count === "0") {
$("#show-favlist-link").hide();
}
$("#show-favlist-link").click(function(e) {
$("#favlist").show();
$(this).hide();
$("#hide-favlist-link").show();
e.preventDefault();
});
$("#hide-favlist-link").click(function(e) {
$("#favlist").hide();
$(this).hide();
$("#show-favlist-link").show();
e.preventDefault();
});
}
Danbooru.Post.expand_image = function(e) {
if (Danbooru.test_max_width(660)) {
// just do the default behavior
return;
}
var $link = $(e.target);
var $image = $("#image");
var $notice = $("#image-resize-notice");
$image.attr("src", $link.attr("href"));
$image.css("opacity", "0.25");
$image.width($image.data("original-width"));
$image.height($image.data("original-height"));
$image.on("load", function() {
$image.css("opacity", "1");
$notice.hide();
});
$notice.children().eq(0).hide();
$notice.children().eq(1).show(); // Loading message
Danbooru.Note.Box.scale_all();
$image.data("scale-factor", 1);
e.preventDefault();
}
Danbooru.Post.initialize_post_image_resize_links = function() {
$("#image-resize-link").click(Danbooru.Post.expand_image);
if ($("#image-resize-notice").length) {
Danbooru.keydown("v", "resize", function(e) {
if ($("#image-resize-notice").is(":visible")) {
$("#image-resize-link").click();
} else {
var $image = $("#image");
var $notice = $("#image-resize-notice");
$image.attr("src", $("#image-container").data("large-file-url"));
$image.css("opacity", "0.25");
$image.width($image.data("large-width"));
$image.height($image.data("large-height"));
$notice.children().eq(0).show();
$notice.children().eq(1).hide(); // Loading message
$image.on("load", function() {
$image.css("opacity", "1");
$notice.show();
});
Danbooru.Note.Box.scale_all();
$image.data("scale-factor", 1);
e.preventDefault();
}
});
}
}
Danbooru.Post.resize_image_to_window = function($img) {
if (($img.data("scale-factor") === 1) || ($img.data("scale-factor") === undefined)) {
if ($(window).width() > 660) {
var sidebar_width = $("#sidebar").width() || 0;
var client_width = $(window).width() - sidebar_width - 75;
} else {
var client_width = $(window).width() - 2;
}
var client_height = $(window).height();
if ($img.width() > client_width) {
var ratio = client_width / $img.data("original-width");
$img.data("scale-factor", ratio);
$img.css("width", $img.data("original-width") * ratio);
$img.css("height", $img.data("original-height") * ratio);
Danbooru.Post.resize_ugoira_controls();
}
} else {
$img.data("scale-factor", 1);
$img.width($img.data("original-width"));
$img.height($img.data("original-height"));
Danbooru.Post.resize_ugoira_controls();
}
Danbooru.Note.Box.scale_all();
}
Danbooru.Post.initialize_post_image_resize_to_window_link = function() {
$("#image-resize-to-window-link").click(function(e) {
Danbooru.Post.resize_image_to_window($("#image"));
e.preventDefault();
});
}
Danbooru.Post.initialize_excerpt = function() {
$("#excerpt").hide();
$("#show-posts-link").click(function(e) {
$("#show-posts-link").parent("li").addClass("active");
$("#show-excerpt-link").parent("li").removeClass("active");
$("#posts").show();
$("#excerpt").hide();
e.preventDefault();
});
$("#show-excerpt-link").click(function(e) {
if ($(this).parent("li").hasClass("active")) {
return;
}
$("#show-posts-link").parent("li").removeClass("active");
$("#show-excerpt-link").parent("li").addClass("active");
$("#posts").hide();
$("#excerpt").show();
e.preventDefault();
});
if (!$(".post-preview").length && /Nobody here but us chickens/.test($("#posts").html())) {
$("#show-excerpt-link").click();
}
}
Danbooru.Post.initialize_post_sections = function() {
$("#post-sections li a").click(function(e) {
if (e.target.hash === "#comments") {
$("#comments").show();
$("#edit").hide();
$("#share").hide();
$("#recommended").hide();
} else if (e.target.hash === "#edit") {
$("#edit").show();
$("#comments").hide();
$("#share").hide();
$("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight);
$("#related-tags-button").trigger("click");
$("#find-artist-button").trigger("click");
$("#recommended").hide();
} else if (e.target.hash === "#recommended") {
$("#comments").hide();
$("#edit").hide();
$("#share").hide();
$("#recommended").show();
$.get("/recommended_posts", {context: "post", post_id: Danbooru.meta("post-id")}, function(data) {
$("#recommended").html(data);
});
} else {
$("#edit").hide();
$("#comments").hide();
$("#share").show();
addthis.init();
$("#recommended").hide();
}
$("#post-sections li").removeClass("active");
$(e.target).parent("li").addClass("active");
e.preventDefault();
});
$("#notes").hide();
$("#edit").hide();
$("#recommended").hide();
$("#post-sections li:first-child").addClass("active");
}
Danbooru.Post.resize_ugoira_controls = function() {
var $img = $("#image");
var width = Math.max($img.width(), 350);
$("#ugoira-control-panel").css("width", width);
$("#seek-slider").css("width", width - 81);
}
Danbooru.Post.notice_update = function(x) {
if (x === "inc") {
Danbooru.Post.pending_update_count += 1;
Danbooru.notice("Updating posts (" + Danbooru.Post.pending_update_count + " pending)...", true);
} else {
Danbooru.Post.pending_update_count -= 1;
if (Danbooru.Post.pending_update_count < 1) {
Danbooru.notice("Posts updated");
} else {
Danbooru.notice("Updating posts (" + Danbooru.Post.pending_update_count + " pending)...", true);
}
}
}
Danbooru.Post.update_data = function(data) {
var $post = $("#post_" + data.id);
$post.attr("data-tags", data.tag_string);
$post.data("rating", data.rating);
$post.removeClass("post-status-has-parent post-status-has-children");
if (data.parent_id) {
$post.addClass("post-status-has-parent");
}
if (data.has_visible_children) {
$post.addClass("post-status-has-children");
}
}
Danbooru.Post.vote = function(score, id) {
Danbooru.notice("Voting...");
$.post("/posts/" + id + "/votes.js", {
score: score
});
}
Danbooru.Post.update = function(post_id, params) {
Danbooru.Post.notice_update("inc");
$.ajax({
type: "PUT",
url: "/posts/" + post_id + ".json",
data: params,
success: function(data) {
Danbooru.Post.notice_update("dec");
Danbooru.Post.update_data(data);
},
error: function(data) {
Danbooru.Post.notice_update("dec");
Danbooru.error('There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
}
});
}
Danbooru.Post.ban = function(post_id) {
$.ajax({
type: "POST",
url: "/moderator/post/posts/" + post_id + "/ban.js",
data: {
commit: "Ban"
},
success: function(data) {
$("#post_" + post_id).remove();
},
error: function(data) {
Danbooru.error('There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
}
});
}
Danbooru.Post.approve = function(post_id) {
$.post(
"/moderator/post/approval.json",
{"post_id": post_id}
).fail(function(data) {
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; ");
Danbooru.error("Error: " + message);
}).done(function(data) {
var $post = $("#post_" + post_id);
if ($post.length) {
$post.data("flags", $post.data("flags").replace(/pending/, ""));
$post.removeClass("post-status-pending");
Danbooru.notice("Approved post #" + post_id);
}
});
}
Danbooru.Post.favorite = function (e) {
if ($("#add-to-favorites").is(":visible")) {
$("#add-to-favorites")[0].click();
} else {
if (Danbooru.meta("current-user-id") == "") {
Danbooru.notice("You must be logged in to favorite posts");
} else {
Danbooru.notice("You have already favorited this post");
}
}
};
Danbooru.Post.unfavorite = function (e) {
$.ajax("/favorites/" + Danbooru.meta("post-id") + ".js", {
type: "DELETE"
});
};
Danbooru.Post.initialize_saved_searches = function() {
$("#new_saved_search #saved_search_label_string").autocomplete({
search: function() {
$(this).data("ui-autocomplete").menu.bindings = $();
},
source: function(req, resp) {
Danbooru.SavedSearch.labels(req.term).then(function(labels) {
resp(labels.map(function(label) {
return {
label: label.replace(/_/g, " "),
value: label
};
}));
});
}
});
$("#save-search-dialog").dialog({
width: 500,
modal: true,
autoOpen: false,
buttons: {
"Submit": function() {
$("#save-search-dialog form").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$("#save-search").click(function(e) {
$("#save-search-dialog #saved_search_query").val($("#tags").val());
if (Danbooru.meta("disable-labeled-saved-searches") === "false") {
$("#save-search-dialog").dialog("open");
} else {
$.post(
"/saved_searches.js",
{
"saved_search": {
"query": $("#tags").val()
}
}
);
}
e.preventDefault();
});
$("#search-dropdown #wiki-search").click(function(e) {
window.location.href = "/wiki_pages?search%5Btitle%5D=" + encodeURIComponent($("#tags").val());
e.preventDefault();
});
$("#search-dropdown #artist-search").click(function(e) {
window.location.href = "/artists?search%5Bname%5D=" + encodeURIComponent($("#tags").val());
e.preventDefault();
});
}
Danbooru.Post.initialize_replace_image_dialog = function() {
$("#replace-image-dialog").dialog({
autoOpen: false,
width: 700,
modal: true,
buttons: {
"Submit": function() {
$("#replace-image-dialog form").submit();
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#replace-image-dialog form').submit(function() {
$('#replace-image-dialog').dialog('close');
});
$("#replace-image").click(function(e) {
e.preventDefault();
$("#replace-image-dialog").dialog("open");
});
};
})();
$(document).ready(function() {
Danbooru.Post.initialize_all();
});

View File

@@ -1,350 +0,0 @@
(function() {
Danbooru.RelatedTag = {};
Danbooru.RelatedTag.initialize_all = function() {
if ($("#c-posts #a-show").length || $("#c-uploads #a-new").length) {
this.initialize_buttons();
$("#artist-tags-container").hide();
$("#upload_tag_string,#post_tag_string").keyup(Danbooru.RelatedTag.update_selected);
$("body").on("click", "#artist-related-tags-column a.del", Danbooru.RelatedTag.disable_artist_url)
}
}
Danbooru.RelatedTag.initialize_buttons = function() {
this.common_bind("#related-tags-button", "");
<% TagCategory.related_button_list.each do |category| %>
Danbooru.RelatedTag.common_bind("#related-<%= category %>-button", "<%= category %>");
<% end %>
$("#find-artist-button").click(Danbooru.RelatedTag.find_artist);
}
Danbooru.RelatedTag.tags_include = function(name) {
var current = $("#upload_tag_string,#post_tag_string").val().toLowerCase().match(/\S+/g) || [];
if ($.inArray(name.toLowerCase(), current) > -1) {
return true;
} else {
return false;
}
}
Danbooru.RelatedTag.common_bind = function(button_name, category) {
$(button_name).click(function(e) {
var $dest = $("#related-tags");
$dest.empty();
Danbooru.RelatedTag.build_recent_and_frequent($dest);
$dest.append("<em>Loading...</em>");
$.get("/related_tag.json", {
"query": Danbooru.RelatedTag.current_tag(),
"category": category
}, Danbooru.RelatedTag.process_response);
$("#artist-tags-container").hide();
e.preventDefault();
});
}
Danbooru.RelatedTag.current_tag = function() {
// 1. abc def | -> def
// 2. abc def| -> def
// 3. abc de|f -> def
// 4. abc |def -> def
// 5. abc| def -> abc
// 6. ab|c def -> abc
// 7. |abc def -> abc
// 8. | abc def -> abc
var $field = $("#upload_tag_string,#post_tag_string");
var string = $field.val();
var n = string.length;
var a = $field.prop('selectionStart');
var b = $field.prop('selectionStart');
if ((a > 0) && (a < (n - 1)) && (!/\s/.test(string[a])) && (/\s/.test(string[a - 1]))) {
// 4 is the only case where we need to scan forward. in all other cases we
// can drag a backwards, and then drag b forwards.
while ((b < n) && (!/\s/.test(string[b]))) {
b++;
}
} else if (string.search(/\S/) > b) { // case 8
b = string.search(/\S/);
while ((b < n) && (!/\s/.test(string[b]))) {
b++;
}
} else {
while ((a > 0) && ((/\s/.test(string[a])) || (string[a] === undefined))) {
a--;
b--;
}
while ((a > 0) && (!/\s/.test(string[a - 1]))) {
a--;
b--;
}
while ((b < (n - 1)) && (!/\s/.test(string[b]))) {
b++;
}
}
b++;
return string.slice(a, b);
}
Danbooru.RelatedTag.process_response = function(data) {
Danbooru.RelatedTag.recent_search = data;
Danbooru.RelatedTag.build_all();
}
Danbooru.RelatedTag.update_selected = function(e) {
var current_tags = $("#upload_tag_string,#post_tag_string").val().toLowerCase().match(/\S+/g) || [];
var $all_tags = $("#related-tags a");
$all_tags.removeClass("selected");
$all_tags.each(function(i, tag) {
if (current_tags.indexOf(tag.textContent.replace(/ /g, "_")) > -1) {
$(tag).addClass("selected");
}
});
}
Danbooru.RelatedTag.build_all = function() {
if (Danbooru.RelatedTag.recent_search === null || Danbooru.RelatedTag.recent_search === undefined) {
return;
}
Danbooru.RelatedTag.show();
var query = Danbooru.RelatedTag.recent_search.query;
var related_tags = Danbooru.RelatedTag.recent_search.tags;
var wiki_page_tags = Danbooru.RelatedTag.recent_search.wiki_page_tags;
var other_wikis = Danbooru.RelatedTag.recent_search.other_wikis;
var $dest = $("#related-tags");
$dest.empty();
this.build_recent_and_frequent($dest);
$dest.append(this.build_html(query, related_tags, "general"));
this.build_translated($dest);
if (wiki_page_tags.length) {
$dest.append(Danbooru.RelatedTag.build_html("wiki:" + query, wiki_page_tags, "wiki"));
}
$.each(other_wikis, function(i,wiki) {
$dest.append(Danbooru.RelatedTag.build_html("wiki:" + wiki.title, wiki.wiki_page_tags, "otherwiki" + i.toString()));
});
if (Danbooru.RelatedTag.recent_artists) {
var tags = [];
if (Danbooru.RelatedTag.recent_artists.length === 0) {
tags.push([" none", 0]);
} else if (Danbooru.RelatedTag.recent_artists.length === 1) {
tags.push([Danbooru.RelatedTag.recent_artists[0].name, 1]);
if (Danbooru.RelatedTag.recent_artists[0].is_banned === true) {
tags.push(["BANNED_ARTIST", "banned"]);
}
$.each(Danbooru.RelatedTag.recent_artists[0].sorted_urls, function(i, url) {
var x = url.url;
if (!url.is_active) {
x = "-" + x;
}
tags.push([" " + x, 0]);
});
} else if (Danbooru.RelatedTag.recent_artists.length >= 10) {
tags.push([" none", 0]);
} else {
$.each(Danbooru.RelatedTag.recent_artists, function(i, artist) {
tags.push([artist.name, 1]);
});
}
$dest.append(Danbooru.RelatedTag.build_html("artist", tags, "artist", true));
}
}
Danbooru.RelatedTag.build_recent_and_frequent = function($dest) {
var recent_tags = Danbooru.Cookie.get("recent_tags_with_categories");
var favorite_tags = Danbooru.Cookie.get("favorite_tags_with_categories");
if (recent_tags.length) {
$dest.append(this.build_html("recent", this.other_tags(recent_tags), "recent"));
}
if (favorite_tags.length) {
$dest.append(this.build_html("frequent", this.other_tags(favorite_tags), "frequent"));
}
}
Danbooru.RelatedTag.other_tags = function(string) {
if (string && string.length) {
return $.map(string.match(/\S+ \d+/g), function(x, i) {
var submatch = x.match(/(\S+) (\d+)/);
return [[submatch[1], submatch[2]]];
});
} else {
return [];
}
}
Danbooru.RelatedTag.build_translated = function($dest) {
if (Danbooru.RelatedTag.translated_tags && Danbooru.RelatedTag.translated_tags.length) {
$dest.append(this.build_html("Translated Tags", Danbooru.RelatedTag.translated_tags, "translated"));
}
}
Danbooru.RelatedTag.build_html = function(query, related_tags, name, is_wide_column) {
if (query === null || query === "") {
return "";
}
query = query.replace(/_/g, " ");
var header = $("<em/>");
var match = query.match(/^wiki:(.+)/);
if (match) {
header.html($("<a/>").attr("href", "/wiki_pages?title=" + encodeURIComponent(match[1])).attr("target", "_blank").text(query));
} else {
header.text(query);
}
var $div = $("<div/>");
$div.attr("id", name + "-related-tags-column");
$div.addClass("tag-column");
if (is_wide_column) {
$div.addClass("wide-column");
}
var $ul = $("<ul/>");
$ul.append(
$("<li/>").append(
header
)
);
$.each(related_tags, function(i, tag) {
if (tag[0][0] !== " ") {
var $link = $("<a/>");
$link.text(tag[0].replace(/_/g, " "));
$link.addClass("tag-type-" + tag[1]);
$link.attr("href", "/posts?tags=" + encodeURIComponent(tag[0]));
$link.click(Danbooru.RelatedTag.toggle_tag);
if (Danbooru.RelatedTag.tags_include(tag[0])) {
$link.addClass("selected");
}
$ul.append(
$("<li/>").append($link)
);
} else {
var text = tag[0];
if (text.match(/^ -http/)) {
text = text.substring(1, 1000);
var desc = text.replace(/^-https?:\/\//, "");
if (desc.length > 30) {
desc = desc.substring(0, 30) + "...";
}
$ul.append(
$("<li>").append(
$("<del>").text(desc)
)
);
} else if (text.match(/^ http/)) {
text = text.substring(1, 1000);
var desc = text.replace(/^https?:\/\//, "");
if (desc.length > 30) {
desc = desc.substring(0, 30) + "...";
}
$ul.append(
$("<li>").append([
$("<a>").text(desc).attr("href", text).attr("target", "_blank"),
" ",
$("<a>").attr("href", text).addClass("del").append(
$("<i>").addClass("fas fa-minus-circle")
)
])
);
} else {
$ul.append($("<li/>").text(text));
}
}
});
$div.append($ul);
return $div;
}
Danbooru.RelatedTag.toggle_tag = function(e) {
var $field = $("#upload_tag_string,#post_tag_string");
var tag = $(e.target).html().replace(/ /g, "_").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
if (Danbooru.RelatedTag.tags_include(tag)) {
var escaped_tag = Danbooru.regexp_escape(tag);
$field.val($field.val().replace(new RegExp("(^|\\s)" + escaped_tag + "($|\\s)", "gi"), "$1$2"));
} else {
$field.val($field.val() + " " + tag);
}
$field.val($field.val().trim().replace(/ +/g, " ") + " ");
Danbooru.RelatedTag.update_selected();
if (Danbooru.RelatedTag.recent_artist && $("#artist-tags-container").css("display") === "block") {
Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
}
//The timeout is needed on Chrome since it will clobber the field attribute otherwise
setTimeout(function () { $field.prop('selectionStart', $field.val().length);}, 100);
e.preventDefault();
}
Danbooru.RelatedTag.find_artist = function(e) {
$("#artist-tags").html("<em>Loading...</em>");
var url = $("#upload_source,#post_source");
var referer_url = $("#upload_referer_url");
$.get("/artists/finder.json", {"url": url.val(), "referer_url": referer_url.val()}, Danbooru.RelatedTag.process_artist);
if (e) {
e.preventDefault();
}
}
Danbooru.RelatedTag.process_artist = function(data) {
Danbooru.RelatedTag.recent_artists = data;
Danbooru.RelatedTag.build_all();
}
Danbooru.RelatedTag.toggle = function() {
if ($("#related-tags").is(":visible")) {
Danbooru.RelatedTag.hide();
} else {
Danbooru.RelatedTag.show();
$("#related-tags-button").trigger("click");
$("#find-artist-button").trigger("click");
}
}
Danbooru.RelatedTag.show = function() {
$("#related-tags").show()
$("#toggle-related-tags-link").text("«");
$("#edit-dialog").height("auto");
}
Danbooru.RelatedTag.hide = function() {
$("#related-tags").hide();
$("#toggle-related-tags-link").text("»");
}
Danbooru.RelatedTag.disable_artist_url = function(e) {
var url = e.currentTarget.href;
$.each(Danbooru.RelatedTag.recent_artists[0].sorted_urls, function(k, v) {
if (v["normalized_url"] === url || v["url"] === url) {
if (!confirm("This will mark the URL as inactive. Continue?")) {
return;
}
$.ajax("/artist_urls/" + v["id"], {
method: "PUT",
data: {
artist_url: {
is_active: false
}
}
}).done(Danbooru.RelatedTag.find_artist);
}
});
return false;
}
})();
$(function() {
Danbooru.RelatedTag.initialize_all();
});

View File

@@ -1,7 +0,0 @@
$(function() {
$("#maintoggle").click(function() {
$('#nav').toggle();
$('#maintoggle-on').toggle();
$('#maintoggle-off').toggle();
});
});

View File

@@ -1,16 +0,0 @@
Danbooru.SavedSearch = {};
Danbooru.SavedSearch.initialize_all = function() {
if ($("#c-saved-searches").length) {
Danbooru.sorttable($("#c-saved-searches table"));
}
}
Danbooru.SavedSearch.labels = function(term) {
return $.getJSON("/saved_searches/labels", {
"search[label]": term + "*",
"limit": 10
});
}
$(Danbooru.SavedSearch.initialize_all);

View File

@@ -1,57 +0,0 @@
(function() {
Danbooru.Shortcuts = {};
Danbooru.Shortcuts.initialize = function() {
Danbooru.keydown("s", "scroll_down", Danbooru.Shortcuts.nav_scroll_down);
Danbooru.keydown("w", "scroll_up", Danbooru.Shortcuts.nav_scroll_up);
Danbooru.keydown("q", "focus_search", function(e) {
$("#tags, #search_name, #search_name_matches, #query").trigger("focus").selectEnd();
e.preventDefault();
});
if ($("#image").length) { // post page or bookmarklet upload page
Danbooru.keydown("shift+e", "edit_dialog", function(e) {
if (Danbooru.meta("current-user-id") == "") { // anonymous
return;
}
if (!$("#edit-dialog").length) {
$("#edit").show();
$("#comments").hide();
$("#share").hide();
$("#post-sections li").removeClass("active");
$("#post-edit-link").parent("li").addClass("active");
$("#related-tags-container").show();
Danbooru.Post.open_edit_dialog();
}
e.preventDefault();
});
}
if ($("#c-posts #a-index, #c-favorites #a-index").length) {
Danbooru.keydown("r", "random", function(e) {
$("#random-post")[0].click();
});
}
}
Danbooru.Shortcuts.nav_scroll_down = function() {
var scroll_top = $(window).scrollTop() + ($(window).height() * 0.15);
$(window).scrollTop(scroll_top);
}
Danbooru.Shortcuts.nav_scroll_up = function() {
var scroll_top = $(window).scrollTop() - ($(window).height() * 0.15);
if (scroll_top < 0) {
scroll_top = 0;
}
$(window).scrollTop(scroll_top);
}
})();
$(document).ready(function() {
Danbooru.Shortcuts.initialize();
});

View File

@@ -1,57 +0,0 @@
(function() {
Danbooru.TagScript = {};
Danbooru.TagScript.parse = function(script) {
return script.match(/\[.+?\]|\S+/g);
}
Danbooru.TagScript.test = function(tags, predicate) {
var split_pred = predicate.match(/\S+/g);
var is_true = true;
$.each(split_pred, function(i, x) {
if (x[0] === "-") {
if ($.inArray(x.substr(1, 100), tags)) {
is_true = false;
}
} else {
if (!$.inArray(x, tags)) {
is_true = false;
}
}
});
return is_true;
}
Danbooru.TagScript.process = function(tags, command) {
if (command.match(/^\[if/)) {
var match = command.match(/\[if\s+(.+?)\s*,\s*(.+?)\]/);
if (Danbooru.TagScript.test(tags, match[1])) {
return Danbooru.TagScript.process(tags, match[2]);
} else {
return tags;
}
} else if (command === "[reset]") {
return [];
} else if (command[0] === "-" && !command.match(/^(?:-pool|-parent|-fav|-favgroup):/i)) {
return Danbooru.reject(tags, function(x) {return x === command.substr(1, 100)});
} else {
tags.push(command);
return tags;
}
}
Danbooru.TagScript.run = function(post_id, tag_script) {
var commands = Danbooru.TagScript.parse(tag_script);
var $post = $("#post_" + post_id);
var old_tags = $post.data("tags");
$.each(commands, function(i, x) {
var array = String($post.data("tags")).match(/\S+/g);
$post.data("tags", Danbooru.TagScript.process(array, x).join(" "));
});
Danbooru.Post.update(post_id, {"post[old_tag_string]": old_tags, "post[tag_string]": $post.data("tags")});
}
})();

View File

@@ -1,203 +0,0 @@
(function() {
Danbooru.Upload = {};
Danbooru.Upload.initialize_all = function() {
if ($("#c-uploads,#c-posts").length) {
this.initialize_enter_on_tags();
this.initialize_info_manual();
}
if ($("#c-uploads").length) {
if ($("#image").prop("complete")) {
this.initialize_image();
} else {
$("#image").on("load error", this.initialize_image);
}
this.initialize_info_bookmarklet();
this.initialize_similar();
this.initialize_shortcuts();
this.initialize_submit();
$("#related-tags-button").trigger("click");
$("#toggle-artist-commentary").click(function(e) {
Danbooru.Upload.toggle_commentary();
e.preventDefault();
});
}
if ($("#iqdb-similar").length) {
this.initialize_iqdb_source();
}
}
Danbooru.Upload.initialize_submit = function() {
$("#form").submit(function(e) {
var error_messages = [];
if (($("#upload_file").val() === "") && ($("#upload_source").val() === "") && $("#upload_md5_confirmation").val() === "") {
error_messages.push("Must choose file or specify source");
}
if (!$("#upload_rating_s").prop("checked") && !$("#upload_rating_q").prop("checked") && !$("#upload_rating_e").prop("checked") &&
($("#upload_tag_string").val().search(/\brating:[sqe]/i) < 0)) {
error_messages.push("Must specify a rating");
}
if (error_messages.length === 0) {
$("#submit-button").prop("disabled","true");
$("#submit-button").prop("value","Submitting...");
$("#client-errors").hide();
} else {
$("#client-errors").html("<strong>Error</strong>: " + error_messages.join(", "));
$("#client-errors").show();
e.preventDefault();
}
});
}
Danbooru.Upload.initialize_shortcuts = function() {
Danbooru.keydown("e", "edit", function(e) {
$("#upload_tag_string").focus();
e.preventDefault();
});
};
Danbooru.Upload.initialize_iqdb_source = function() {
if (/^https?:\/\//.test($("#normalized_url").val())) {
$.get("/iqdb_queries", {"url": $("#normalized_url").val()}).done(function(html) {$("#iqdb-similar").html(html)});
}
}
Danbooru.Upload.initialize_enter_on_tags = function() {
var $textarea = $("#upload_tag_string, #post_tag_string");
var $submit = $textarea.parents("form").find('input[type="submit"]');
$textarea.on("keydown.danbooru.submit", null, "return", function(e) {
$submit.click();
e.preventDefault();
});
}
Danbooru.Upload.initialize_similar = function() {
$("#similar-button").click(function(e) {
$.get("/iqdb_queries", {"url": $("#upload_source").val()}).done(function(html) {$("#iqdb-similar").html(html).show()});
e.preventDefault();
});
}
Danbooru.Upload.initialize_info_bookmarklet = function() {
$("#upload_source").change(function (e) {
$("#fetch-data-manual").click();
});
$("#fetch-data-manual").click();
}
Danbooru.Upload.initialize_info_manual = function() {
$("#fetch-data-manual").click(function(e) {
var source = $("#upload_source,#post_source").val();
var referer = $("#upload_referer_url").val();
if (/^https?:\/\//.test(source)) {
$("#source-info span#loading-data").show();
Danbooru.Upload.fetch_source_data(source, referer);
}
e.preventDefault();
});
}
Danbooru.Upload.fetch_source_data = function(url, referer_url) {
return $.getJSON("/source.json", { url: url, ref: referer_url })
.then(Danbooru.Upload.fill_source_info)
.catch(function(data) {
$("#source-info span#loading-data").html("Error: " + data.responseJSON["message"])
});
}
Danbooru.Upload.fill_source_info = function(data) {
$("#source-tags").empty();
$.each(data.tags, function(i, v) {
$("<a>").attr("href", v[1]).text(v[0]).appendTo("#source-tags");
});
$("#source-artist-profile").attr("href", data.profile_url).text(data.artist_name);
Danbooru.RelatedTag.process_artist(data.artists);
Danbooru.RelatedTag.translated_tags = data.translated_tags;
Danbooru.RelatedTag.build_all();
if (data.artists.length === 0) {
var new_artist_params = $.param({
artist: {
name: data.unique_id,
other_names: data.artist_name,
url_string: $.uniqueSort([data.profile_url, data.normalized_for_artist_finder_url]).join("\n")
}
});
var link = $("<a>").attr("href", "/artists/new?" + new_artist_params).text("Create new artist");
$("#source-danbooru-artists").html(link);
} else {
var artistLinks = data.artists.map(function (artist) {
return $('<a class="tag-type-1">').attr("href", "/artists/" + artist.id).text(artist.name);
});
$("#source-danbooru-artists").html(artistLinks)
}
if (data.image_urls.length > 1) {
$("#gallery-warning").show();
} else {
$("#gallery-warning").hide();
}
$("#upload_artist_commentary_title").val(data.artist_commentary.dtext_title);
$("#upload_artist_commentary_desc").val(data.artist_commentary.dtext_description);
Danbooru.Upload.toggle_commentary();
$("#source-info span#loading-data").hide();
$("#source-info ul").show();
}
Danbooru.Upload.update_scale = function() {
var $image = $("#image");
var ratio = $image.data("scale-factor");
if (ratio < 1) {
$("#scale").html("Scaled " + parseInt(100 * ratio) + "% (original: " + $image.data("original-width") + "x" + $image.data("original-height") + ")");
} else {
$("#scale").html("Original: " + $image.data("original-width") + "x" + $image.data("original-height"));
}
}
Danbooru.Upload.initialize_image = function() {
var $image = $("#image");
if (!$image.length) {
return;
}
var width = $image.width();
var height = $image.height();
if (!width || !height) {
// try again later
$.timeout(100).done(function() {Danbooru.Upload.initialize_image()});
return;
}
$image.data("original-width", width);
$image.data("original-height", height);
Danbooru.Post.resize_image_to_window($image);
Danbooru.Post.initialize_post_image_resize_to_window_link();
Danbooru.Upload.update_scale();
$("#image-resize-to-window-link").click(Danbooru.Upload.update_scale);
}
Danbooru.Upload.toggle_commentary = function() {
if ($(".artist-commentary").is(":visible")) {
$("#toggle-artist-commentary").text("show »");
} else {
$("#toggle-artist-commentary").text("« hide");
}
$(".artist-commentary").slideToggle();
};
})();
$(function() {
Danbooru.Upload.initialize_all();
});

View File

@@ -1,170 +0,0 @@
(function() {
Danbooru.meta = function(key) {
return $("meta[name=" + key + "]").attr("content");
}
Danbooru.test_max_width = function(width) {
if (!window.matchMedia) {
return false;
}
var mq = window.matchMedia('(max-width: ' + width + 'px)');
return mq.matches;
}
Danbooru.scrolling = false;
Danbooru.scroll_to = function(element) {
if (Danbooru.scrolling) {
return;
} else {
Danbooru.scrolling = true;
}
var top = null;
if (typeof(element) === "number") {
top = element;
} else {
top = element.offset().top - 10;
}
$('html, body').animate({scrollTop: top}, 300, "linear", function() {Danbooru.scrolling = false;});
}
Danbooru.notice_timeout_id = undefined;
Danbooru.notice = function(msg, permanent) {
$('#notice').addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
if (Danbooru.notice_timeout_id !== undefined) {
clearTimeout(Danbooru.notice_timeout_id)
}
if (!permanent) {
Danbooru.notice_timeout_id = setTimeout(function() {
$("#close-notice-link").click();
Danbooru.notice_timeout_id = undefined;
}, 6000);
}
}
Danbooru.error = function(msg) {
$('#notice').removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
if (Danbooru.notice_timeout_id !== undefined) {
clearTimeout(Danbooru.notice_timeout_id)
}
}
Danbooru.keydown = function(keys, namespace, handler) {
if (Danbooru.meta("enable-js-navigation") === "true") {
$(document).on("keydown" + ".danbooru." + namespace, null, keys, handler);
}
};
Danbooru.is_subset = function(array, subarray) {
var all = true;
$.each(subarray, function(i, val) {
if ($.inArray(val, array) === -1) {
all = false;
}
});
return all;
}
Danbooru.intersect = function(a, b) {
a = a.slice(0).sort();
b = b.slice(0).sort();
var result = [];
while (a.length > 0 && b.length > 0)
{
if (a[0] < b[0]) {
a.shift();
} else if (a[0] > b[0]) {
b.shift();
} else {
result.push(a.shift());
b.shift();
}
}
return result;
}
Danbooru.without = function(array, element) {
var temp = [];
$.each(array, function(i, v) {
if (v !== element) {
temp.push(v);
}
});
return temp;
}
Danbooru.reject = function(array, f) {
var filtered = [];
$.each(array, function(i, x) {
if (!f(x)) {
filtered.push(x);
}
});
return filtered;
}
Danbooru.regexp_escape = function(string) {
return string.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
}
Danbooru.get_url_parameter = function(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
Danbooru.sorttable = function(table) {
table.stupidtable();
table.bind("aftertablesort", function(event, data) {
$("#c-saved-searches table tbody tr").removeClass("even odd");
$("#c-saved-searches table tbody tr:even").addClass("even");
$("#c-saved-searches table tbody tr:odd").addClass("odd");
});
};
String.prototype.hash = function() {
var hash = 5381, i = this.length;
while(i)
hash = (hash * 33) ^ this.charCodeAt(--i)
return hash >>> 0;
}
$.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
$.fn.selectEnd = function(){
if (this.length) {
this.selectRange(this.val().length, this.val().length);
}
return this;
}
})();

View File

@@ -1,25 +0,0 @@
(function() {
Danbooru.WikiPage = {};
Danbooru.WikiPage.initialize_all = function() {
if ($("#c-wiki-pages,#c-wiki-page-versions").length) {
this.initialize_shortcuts();
}
}
Danbooru.WikiPage.initialize_shortcuts = function() {
if ($("#a-show").length) {
Danbooru.keydown("e", "edit", function(e) {
$("#wiki-page-edit a")[0].click();
});
Danbooru.keydown("shift+d", "delete", function(e) {
$("#wiki-page-delete a")[0].click();
});
}
}
})();
$(document).ready(function() {
Danbooru.WikiPage.initialize_all();
});

View File

@@ -1,10 +0,0 @@
@import "jquery.dropdown.scss";
@import "jquery.qtip.scss";
@import "common/*";
// @import wildcards don't work with .erb files. Put .erb files in a separate
// directory and load them explicitly to work around this.
// https://github.com/rails/sass-rails/issues/185
@import "specific/*";
@import "specific/erb/mod_queue";
@import "common/erb/tags";

View File

@@ -1,90 +0,0 @@
$menu_color: #F5F5FF;
$link_color: hsl(213, 100%, 50%);
$link_hover_color: lighten($link_color, 25%);
$link_dark_color: darken($link_color, 25%);
$highlight_color: lighten($link_color, 45%);
$h1_size: 2em;
$h2_size: 1.5em;
$h3_size: 1.16667em;
$h4_size: 1em;
$dtext_h1_size: 2em;
$dtext_h2_size: 1.8em;
$dtext_h3_size: 1.6em;
$dtext_h4_size: 1.4em;
$dtext_h5_size: 1.2em;
$dtext_h6_size: 1em;
$h1_padding: 0.8em 0 0.25em 0;
$h2_padding: 0.8em 0 0.25em 0;
$h3_padding: 0.8em 0 0.25em 0;
$h4_padding: 0.8em 0 0.25em 0;
$baseline: 1em;
$basefont: 100%;
$base_font_family: Verdana, Helvetica, sans-serif;
$preview_has_children_color: #0F0;
$preview_has_parent_color: #CC0;
$preview_deleted_color: #000;
$preview_pending_color: #00F;
$preview_flagged_color: #F00;
$preview_sample_warning_color: hsl(0, 100%, 90%); // light red
$preview_quality_warning_color: hsl(50, 100%, 90%); // light yellow
$note_highlight_color: $preview_pending_color;
$error_color: hsl(0, 100%, 95%); // light red
$success_color: hsl(120, 100%, 95%); // light green
@mixin border-radius($val) {
-moz-border-radius: $val;
-webkit-border-radius: $val;
-ms-border-radius: $val;
-o-border-radius: $val;
border-radius: $val;
}
@mixin box-shadow($val) {
-moz-box-shadow: $val;
-webkit-box-shadow: $val;
-ms-box-shadow: $val;
-o-box-shadow: $val;
box-shadow: $val;
}
@mixin text-shadow($val) {
-moz-text-shadow: $val;
-webkit-text-shadow: $val;
-ms-text-shadow: $val;
-o-text-shadow: $val;
text-shadow: $val;
}
@mixin inline-block {
display: -moz-inline-box;
-moz-box-orient: vertical;
display: inline-block;
vertical-align: baseline;
zoom: 1;
*display: inline;
*vertical-align: auto;
}
@mixin animated-icon {
content: "";
position: absolute;
width: 20px;
height: 20px;
color: white;
background-color: rgba(0,0,0,0.5);
margin: 2px;
text-align: center;
}
@mixin sound-icon {
content: "";
position: absolute;
width: 20px;
height: 20px;
color: white;
background-color: rgba(0,0,0,0.5);
margin: 2px;
text-align: center;
}

View File

@@ -1,171 +0,0 @@
// Source: https://github.com/FrogBot/sassy_bootstrap/blob/master/lib/_reset.sass
@import "000_vars.scss";
// Reset.sass
// Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an
// adapted version here that cuts out some of the reset HTML elements we will
// never need here (i.e., dfn, samp, etc).
// ERIC MEYER RESET
// ----------------
html, body {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
/* font-weight: normal;*/
/* font-style: normal;*/
font-size: 100%;
line-height: 1.25em;
font-family: inherit;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
ol, ul {
list-style: none;
}
q:before, q:after, blockquote:before, blockquote:after {
content: "";
}
// Normalize.css
// Pulling in select resets form the normalize.css project
// --------------------------------------------------
// Display in IE6-9 and FF3
// -------------------------
// Source: http://github.com/necolas/normalize.css
html {
overflow-y: scroll;
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
// Focus states
a:focus {
outline: thin dotted;
}
// Hover & Active
a:hover,
a:active {
outline: 0;
}
// Display in IE6-9 and FF3
// -------------------------
// Source: http://github.com/necolas/normalize.css
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
display: block;
}
// Prevents sub and sup affecting line-height in all browsers
// -------------------------
// Source: http://github.com/necolas/normalize.css
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
// Img border in a's and image quality
// -------------------------
// Source: http://github.com/necolas/normalize.css
img {
border: 0;
-ms-interpolation-mode: bicubic;
}
// Forms
// -------------------------
// Source: http://github.com/necolas/normalize.css
// Font size in all browsers, margin changes, misc consistency
button,
input,
select,
textarea {
font-size: 100%;
margin: 0;
vertical-align: middle;
}
button,
input {
line-height: normal;
// FF3/4 have !important on line-height in UA stylesheet
*overflow: visible;
// Inner spacing ie IE6/7
}
button::-moz-focus-inner,
input::-moz-focus-inner {
// Inner padding and border oddities in FF3/4
border: 0;
padding: 0;
}
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer;
// Cursors on all buttons applied consistently
-webkit-appearance: button;
// Style clickable inputs in iOS
}
input[type="search"] {
// Appearance in Safari/Chrome
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
// Inner-padding issues in Chrome OSX, Safari 5
}
textarea {
overflow: auto;
// Remove vertical scrollbar in IE6-9
vertical-align: top;
// Readability and alignment cross-browser
}

View File

@@ -1,136 +0,0 @@
@import "000_vars.scss";
body {
background-color: #FFF;
font-family: $base_font_family;
padding: 0;
margin: 0;
font-size: 87.5%;
line-height: 1.25em;
}
article, section {
display: block;
}
abbr[title=required] {
display: none;
}
blockquote {
margin: 0 0 1em 0;
padding: 1em 1em 0.2em;
border: 1px solid #666;
background: #EEE;
}
code {
font-family: monospace;
font-size: 1.2em;
}
dd {
margin-bottom: 1em;
}
dt {
font-weight: bold;
}
em {
font-style: italic;
}
h1, h2, h3, h4, h5, h6 {
font-family: Tahoma, Verdana, Helvetica, sans-serif;
font-weight: bold;
line-height: 1.5em;
}
h1 {
font-size: $h1_size;
}
h2 {
font-size: $h2_size;
}
h3, h4, h5, h6 {
font-weight: bold;
font-size: $h3_size;
}
fieldset {
margin-bottom: 1em;
}
header {
margin: 0 0 1em 0;
padding: 0;
display: block;
}
img {
border: none;
vertical-align: middle;
}
img.wait {
margin-left: 5px;
}
legend {
font-size: $h2_size;
font-weight: bold;
margin-bottom: 0.5em;
}
menu {
margin: 0;
padding: 0;
ul {
margin: 0;
padding: 0;
}
li {
margin: 0;
padding: 0 0.2em;
list-style-type: none;
display: inline;
}
}
p {
margin-bottom: 1em;
}
section {
display: block;
}
strong {
font-weight: bold;
}
table tfoot {
margin-top: 2em;
}
.hint {
color: #666;
font-style: italic;
max-width: 70%;
}
.tn {
font-size: 0.8em;
color: gray;
}
p.info {
color: #AAA;
font-style: italic;
font-size: 80%;
}

View File

@@ -1,38 +0,0 @@
@import "000_vars.scss";
a:link {
color: $link_color;
text-decoration: none;
}
a:visited {
color: $link_color;
text-decoration: none;
}
a:hover {
color: $link_hover_color;
text-decoration: none;
}
a:active {
color: $link_color;
text-decoration: none;
}
a.active {
font-weight: bold;
}
a.login {
font-weight: bold;
color: #e00;
}
a.forum-updated {
font-style: italic;
}
a.wiki-link {
margin-right: 0.3em;
}

View File

@@ -1,19 +0,0 @@
.ui-autocomplete {
font-size: 0.9em;
.ui-state-active {
border: none;
margin: 0 -1px;
background-color: #F0F0F0;
border-left: 1px solid #C5C5C5;
border-right: 1px solid #C5C5C5;
}
.ui-menu-item a {
padding: 1px .2em;
}
.autocomplete-arrow {
color: black;
}
}

View File

@@ -1,21 +0,0 @@
.diff-list {
ins, ins a {
color: green;
text-decoration: none;
margin-right: 0.5em;
}
ins.obsolete, ins.obsolete a {
color: darkGreen;
}
del, del a {
color: red;
text-decoration: line-through;
margin-right: 0.5em;
}
del.obsolete, del.obsolete a {
color: darkRed;
}
}

View File

@@ -1,95 +0,0 @@
@import "000_vars.scss";
div.prose {
line-height: 1.4em;
h1, h2, h3 {
line-height: 1em;
}
h1 {
font-size: $dtext_h1_size;
padding: $h1_padding;
}
h2 {
font-size: $dtext_h2_size;
padding: $h2_padding;
}
h3 {
font-size: $dtext_h3_size;
padding: $h3_padding;
}
h4 {
font-size: $dtext_h4_size;
padding: $h4_padding;
}
h5 {
font-size: $dtext_h5_size;
padding: $h4_padding;
}
h6 {
font-size: $dtext_h6_size;
padding: $h4_padding;
}
ul {
margin-left: 1em;
margin-bottom: 1em;
ul {
margin-bottom: 0;
}
}
li {
list-style-type: disc;
}
pre {
font-family: monospace;
font-size: 1.2em;
margin: 0.5em 0;
padding: 0.5em 1em;
background: #EEE;
white-space: pre-wrap;
}
code {
font-family: monospace;
background: #EEE;
}
div.expandable {
margin-bottom: 1em;
border: 1px inset #666;
}
div.expandable-header {
padding: 0.4em;
span {
margin-right: 0.5em;
font-weight: bold;
}
}
div.expandable-content {
padding: 0.4em;
border-top: 1px solid #666;
> :last-child {
margin-bottom: 0;
}
}
}
div.dtext-preview {
ul {
margin-left: 1em;
}
}

View File

@@ -1,33 +0,0 @@
<% TagCategory.css_mapping.each do |category,cssmap| %>
.category-<%= category %> a, a.tag-type-<%= category %>, .ui-state-active a.tag-type-<%= category %> {
color: <%= cssmap["color"] %>;
&:hover {
color: <%= cssmap["hover"] %>;
}
}
<% end %>
.category-banned a, a.tag-type-banned, .ui-state-active a.tag-type-banned {
color: black;
background-color: red;
}
.inline-tag-list {
ul {
display: inline;
li {
display: inline;
margin-right: 0.5em;
}
}
}
.split-inline-tag-list {
@extend .inline-tag-list;
ul {
display: block;
}
}

View File

@@ -1,43 +0,0 @@
@import "000_vars.scss";
span.error {
display: block;
font-weight: bold;
color: red;
}
span.link {
color: $link_color;
cursor: pointer;
}
span.wait {
color: #CCC;
}
span.count {
color: #CCC;
margin-left: 0.5em;
}
span.edit-options {
}
kbd.key {
background: #333;
border: 1px solid #333;
padding: 1px 6px;
color: white;
/* width: 1em;*/
text-align: center;
@include inline-block;
@include border-radius(3px);
}
span.inactive {
color: #AAA;
}
td a.last-page {
color: #666;
}

View File

@@ -1,64 +0,0 @@
.ui-widget {
font-family: $base_font_family;
input, select, textarea, button {
font-family: $base_font_family;
}
}
div.ui-dialog {
height: auto! important;
overflow: visible;
font-size: 1em;
z-index: 999 !important;
box-shadow: 2px 2px 1px grey;
ul {
margin-left: 1em;
margin-bottom: 1em;
}
}
.ui-state-highlight {
border: 1px solid #FCEEC1;
background: #FDF5D9;
color: #363636;
}
.ui-state-error {
border: 1px solid #FBC7C6;
background: #FDDFDE;
}
.ui-button {
margin: 0;
padding: 0.25em 1em;
background-color: #f6f6f6;
border: 1px solid #c5c5c5;
&.sub {
font-size: 90%;
}
&.tiny {
font-size: 90%;
padding: 0.25em 0.5em;
}
&.gradient {
background: linear-gradient(#f6f6f6, #e5e5e5);
}
}
.ui-button:hover {
box-shadow: 1px 1px grey;
transform: translateY(-1px);
&.gradient {
background: linear-gradient(#fefefe, #f0f0f0);
}
}
.ui-front {
z-index: 1000;
}

View File

@@ -1,114 +0,0 @@
@import "000_vars.scss";
div#search {
margin-bottom: 1em;
}
div#search-box button {
-webkit-appearance: button;
border: 1px solid $link_color;
background-color: $link_color;
color: #FFF;
&:hover, &:focus {
border: 1px solid $link_hover_color;
background-color: $link_hover_color;
}
}
div#page {
overflow: visible;
margin: 0 20px;
padding: 0 10px;
div#upgrade-account-notice, div#sign-up-notice, div#tos-notice, div#ban-notice, div#dmail-notice, div#mod-notice {
margin: 1em 0;
padding: 1em;
text-align: center;
position: relative;
h1 {
font-size: $h2_size;
font-weight: bold;
}
p {
margin: 0;
}
}
aside#sidebar {
width: 15em;
float: left;
h1 {
font-size: $h3_size;
}
ul {
list-style-type: none;
}
input[type=text] {
/* ensure expanded search box renders above post thumbnails. */
z-index: 1;
position: relative;
}
button[type=submit] {
padding: 2px 6px;
background: #EEE;
border-left: none;
}
}
aside#sidebar > section {
margin-bottom: 1em;
}
aside#sidebar > section#blacklist-box ul {
margin-left: 1em;
li {
list-style-type: disc;
}
a {
color: $link_color;
cursor: pointer;
}
span {
color: #AAA;
}
}
section#content {
overflow: visible;
margin-left: 15em;
padding-left: 1em;
}
}
footer#page-footer {
clear: both;
width: 100%;
margin-top: 1em;
text-align: center;
padding: 1em 0 1em;
border-top: 1px solid #EEE;
}
div.clearfix {
clear: both;
}
div#more-links {
z-index: 5000;
position: absolute;
background: white;
border: 1px solid #999;
width: 8em;
line-height: 1.3em;
padding: 0.2em 0.6em;
@include box-shadow(2px 2px 2px #ccc);
}

View File

@@ -1,24 +0,0 @@
div#news-updates {
padding: 5px;
background: #EEE;
border-bottom: 2px solid #666;
overflow: hidden;
font-size: 0.8em;
ul {
float: left;
margin: 0;
padding: 0;
}
li {
list-style-type: none;
float: left;
margin: 0 2em 0 0;
padding: 0;
}
a#close-news-ticker-link {
float: right;
}
}

View File

@@ -1,28 +0,0 @@
div.error-messages {
margin: 1em 0;
padding: 1em;
h1 {
font-size: 1em;
color: #A00;
}
}
div#notice {
padding: 0.25em;
position: fixed;
top: 0.5em;
left: 25%;
width: 50%;
z-index: 100;
&:not(.ui-state-error) {
background-color: #FFFBBF;
border: 1px solid #CCC999;
}
}
a#close-notice-link {
position: absolute;
right: 1em;
}

View File

@@ -1,45 +0,0 @@
@import "000_vars.scss";
#maintoggle {
display: none;
}
header#top {
h1 {
font-size: 2.5em;
margin: 5px 30px 0 30px;
}
menu {
margin-top: -2px;
background: $menu_color;
padding: 6px 20px;
form {
display: inline-block;
input {
width: 9.5em;
}
}
li {
margin: 0;
padding: 0;
}
li a {
padding: 6px 10px;
}
}
menu.main {
margin-top: 0;
background: none;
li.current a {
background: $menu_color;
font-weight: bold;
}
}
}

View File

@@ -1,35 +0,0 @@
@import "000_vars.scss";
div.paginator {
display: block;
padding: 2em 0 1em 0;
text-align: center;
clear: both;
li {
a {
margin: 0 0.25em;
padding: 0.25em 0.75em;
}
&.more {
color: grey;
}
a.arrow:hover {
background: white;
color: $link_color;
}
a:hover {
background: $link_color;
color: white;
}
span {
margin: 0 0.25em;
padding: 0.25em 0.75em;
font-weight: bold;
}
}
}

View File

@@ -1,92 +0,0 @@
form.simple_form {
margin: 0 0 1em 0;
div.input.boolean {
label {
display: inline;
vertical-align: middle;
margin-left: 0.5em;
input {
margin-right: 0.25em;
}
}
}
div.input {
margin-bottom: 1em;
input[type=text], input[type=file], input[type=password], input[type=email] {
max-width: 20em;
}
span.hint {
display: block;
font-size: 70%;
}
textarea {
width: 70%;
font-size: 1.2em;
}
label {
display: block;
font-weight: bold;
line-height: 1.5em;
}
fieldset {
border: none;
display: inline;
margin: 0;
padding: 0;
label {
font-weight: normal;
width: auto;
margin-right: 2em;
display: inline;
}
}
}
}
form.inline-form {
display: table;
> div.input {
display: table-row;
line-height: 2em;
label {
text-align: right;
}
label, input {
display: table-cell;
padding-right: 1em;
white-space: nowrap;
}
}
}
form.one-line-form {
> input, > div.input {
display: inline;
label {
display: inline;
margin-right: 1em;
}
}
}
div.ui-dialog {
div.input {
input[type="text"] {
width: 100%;
max-width: 100%;
}
}
}

View File

@@ -1,16 +0,0 @@
.spoiler {
color: black;
background: black;
}
.spoiler a {
color: black;
}
.spoiler:hover {
color: white;
}
.spoiler:hover a{
color: white;
}

View File

@@ -1,85 +0,0 @@
@import "000_vars.scss";
table.striped {
p {
margin: 0;
}
td, th {
padding: 4px 6px;
}
tbody {
tr {
border-bottom: 1px solid #CCC;
&:hover {
background-color: $highlight_color;
}
}
}
.number, .links {
text-align: right;
}
thead {
tr {
border-bottom: 2px solid #666;
}
th {
font-weight: bold;
text-align: left;
color: #333;
}
}
tr.even {
background-color: #FAFAFA;
}
}
/*
* A table where one column expands to fill the screen, while the
* other columns shrink to fit their contents.
*/
table.autofit {
td, th, .col-fit {
white-space: nowrap;
padding-right: 2em;
}
.col-expand {
white-space: normal;
width: 100%;
}
.col-normal {
white-space: normal;
}
}
table.search {
tr {
height: 2em;
}
th {
text-align: right;
padding-right: 1em;
vertical-align: top;
}
td {
vertical-align: top;
}
}
table.aligned-vertical {
@extend table.search;
tr {
height: 1.75em;
}
}

View File

@@ -1,27 +0,0 @@
a.user-admin.with-style {
color: red;
}
a.user-moderator.with-style {
color: orange;
}
a.user-contributor.with-style {
color: purple;
}
a.user-builder.with-style {
color: #6633FF;
}
a.user-platinum.with-style {
color: gray;
}
a.user-gold.with-style {
color: #0000FF;
}
a.user-member.with-style {
color: auto;
}

View File

@@ -1,5 +0,0 @@
#c-admin-dashboards {
.section {
margin-bottom: 2em;
}
}

View File

@@ -1,11 +0,0 @@
@import "../common/020_base.scss";
#c-maintenance-user-api-keys {
#api-key {
@extend code;
}
.button_to {
display: inline-block;
}
}

View File

@@ -1,46 +0,0 @@
@import "../common/000_vars.scss";
div#c-artists, div#excerpt {
span.new-artist {
font-weight: bold;
color: #A00;
}
div#a-banned {
}
ul ul {
margin-left: 1em;
}
div#a-show {
p.legend {
margin-bottom: 2em;
font-size: 0.8em;
font-style: italic;
}
}
div#a-edit, div#a-new {
textarea {
height: 10em;
&#artist_other_names_comma {
height: 3em;
}
}
.hint {
display: block;
}
}
div.recent-posts {
margin-top: 1em;
h1 {
font-size: $h2_size;
margin: 0;
}
}
}

View File

@@ -1,19 +0,0 @@
@import "../common/000_vars.scss";
#c-bans #a-index {
tr[data-expired="true"] {
background-color: $success_color !important;
&:hover {
background-color: darken($success_color, 5%) !important;
}
}
tr[data-expired="false"] {
background-color: $error_color !important;
&:hover {
background-color: darken($error_color, 5%) !important;
}
}
}

View File

@@ -1,9 +0,0 @@
#c-bulk-update-requests {
s.approved {
color: green;
}
s.failed {
color: red;
}
}

View File

@@ -1,140 +0,0 @@
@import "../common/000_vars.scss";
div.comments-for-post {
div.notices {
margin: 1em 0;
}
div.list-of-comments {
article.comment {
margin-bottom: 2em;
word-wrap: break-word;
padding: 5px;
&[data-is-sticky="true"] {
background: $menu_color;
}
div.author {
width: 12em;
float: left;
overflow: hidden;
margin-right: 1em;
h1 {
display: block;
font-size: $h3_size;
}
}
div.content {
margin-left: 13em;
min-width: 17em;
menu {
li {
margin-right: 1em;
}
}
}
}
article.comment.below-threshold:not([data-is-sticky="true"]) {
opacity: 0.3;
}
article.comment.below-threshold:hover {
opacity: 1.0;
}
}
}
div#c-posts {
div.comments-for-post {
float: left;
}
}
div#c-comments {
div#a-index, div#a-show {
div.header {
span.info {
margin-right: 1.5em;
}
strong, time {
margin-right: 0.3em;
}
div.notices {
margin: 1em 0;
}
}
div.preview {
float: left;
width: 154px;
height: 154px;
margin-right: 30px;
overflow: hidden;
text-align: center;
}
div.post-preview {
&[data-tags~=animated], &[data-file-ext=swf], &[data-file-ext=webm], &[data-file-ext=zip], &[data-file-ext=mp4] {
div.preview {
position: relative;
&:before {
@include animated-icon;
}
}
}
&[data-has-sound=true] {
div.preview {
position: relative;
&:before {
@include sound-icon;
}
}
}
}
div.post {
margin-bottom: 4em;
div.comments-for-post {
margin-left: 184px;
min-width: 30em;
div.list-of-comments {
float: left;
width: 100%;
}
}
}
div.comments-for-post {
div.post {
article.comment {
margin-left: 184px;
}
}
}
div.post.blacklisted.blacklisted-active {
display: none;
}
}
}
form.edit_comment div.input.boolean {
display: inline-block;
label {
font-weight: normal;
vertical-align: initial;
}
}

View File

@@ -1,18 +0,0 @@
@import "../common/000_vars.scss";
div#c-dmails {
tr.read-false {
font-weight: bold;
}
div#preview {
margin: 1em 0;
border: 1px solid #CCC;
padding: 1em;
width: 40em;
h1 {
font-size: $h2_size;
}
}
}

View File

@@ -1,41 +0,0 @@
#filedropzone {
border: 4px dashed #DDD;
padding: 0;
min-height: 100px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
.placeholder {
font-style: italic;
color: #333;
height: 100%;
}
&.error {
border-color: darken(#f2dede, 30%);
background-color: #f2dede;
}
&.success {
border-color: darken(#dff0d8, 30%);
background-color: #dff0d8;
}
}
.dz-preview {
margin-bottom: 1em;
}
.dz-progress {
height: 20px;
width: 300px;
border: 1px solid #CCC;
.dz-upload {
background-color: #F5F5FF;
display: block;
height: 20px;
}
}

View File

@@ -1,60 +0,0 @@
@import "../../common/000_vars.scss";
div#c-moderator-post-queues {
div.post {
margin-bottom: 4em;
overflow: hidden;
&.post-pos-score {
background: rgb(230, 255, 230);
}
&.post-neg-score {
background: rgb(255, 230, 230);
}
aside {
float: left;
width: 220px;
text-align: right;
padding-right: 20px;
}
section {
float: left;
width: 800px;
}
<% Danbooru.config.modqueue_quality_warning_tags.each do |tag| %>
&[data-tags~="<%= tag %>"] {
background-color: $preview_quality_warning_color;
}
<% end %>
<% Danbooru.config.modqueue_sample_warning_tags.each do |tag| %>
&[data-tags~="<%= tag %>"] {
background-color: $preview_sample_warning_color;
}
<% end %>
&[data-tags~=animated], &[data-file-ext=swf], &[data-file-ext=webm], &[data-file-ext=zip], &[data-file-ext=mp4] {
aside:before {
@include animated-icon;
}
}
&[data-has-sound=true] {
aside:before {
@include sound-icon;
}
}
}
div#moderation-guideline {
width: 900px;
h1 {
font-size: $h2_size;
}
}
}

View File

@@ -1,27 +0,0 @@
@import "../common/000_vars.scss";
div#c-explore-posts {
header {
text-align: center;
h1 {
font-size: 3em;
}
p.byline {
font-size: 1.2em;
font-style: italic;
}
}
div.posts {
padding: 1em;
margin-bottom: 2em;
}
div#a-intro {
width: 870px;
margin: 0 auto;
text-align: center;
}
}

View File

@@ -1,5 +0,0 @@
#c-favorite-groups #a-edit {
textarea {
height: 10em;
}
}

View File

@@ -1,7 +0,0 @@
@import "../common/000_vars.scss";
div#c-favorites {
section#content > h1 {
font-size: $h3_size;
}
}

View File

@@ -1,98 +0,0 @@
div.list-of-forum-posts {
article {
border: 1px solid #AAA;
margin: 1em 0em;
word-wrap: break-word;
box-shadow: 1px 1px 2px #AAA;
a.voted {
font-weight: bold;
}
span.desc {
color: grey;
}
&:target {
background-color: #FFC;
}
.vote-score-up {
color: green;
}
.vote-score-meh {
color: goldenrod;
}
.vote-score-down {
color: red;
}
div.author {
padding: 1em 1em 0 1em;
width: 12em;
float: left;
time {
font-style: italic;
}
}
div.content {
padding: 1em;
margin-left: 14em;
menu {
margin-top: 0.5em;
ul.votes {
margin: 0.5em 0;
}
li {
margin-right: 1em;
}
}
}
}
}
div#c-forum-topics {
div.single-forum-post {
}
div#a-show {
}
span.info {
color: #AAA;
}
span.new {
font-size: 80%;
color: red;
margin-right: 0.5em;
}
span.locked-topic {
color: gray;
}
span.level-topic {
color: #f66;
font-weight: bold;
}
tr.forum-topic-row td:last-child {
white-space: nowrap;
}
}
#c-forum-posts #a-index {
tr[data-topic-is-deleted="true"] .forum-post-topic-title::after,
tr[data-is-deleted="true"] .forum-post-excerpt::after {
content: " (deleted)";
color: gray;
}
}

View File

@@ -1,17 +0,0 @@
div#c-iqdb-queries {
div#a-check {
article.post-preview {
height: 180px;
width: 180px;
border: lightgrey solid 1px;
img {
margin-top: 10px;
}
}
#filedropzone {
margin: 1em 0;
}
}
}

View File

@@ -1,21 +0,0 @@
@import "../common/000_vars.scss";
div#c-static {
div#a-keyboard-shortcuts {
overflow: visible;
section {
min-width: 20%;
float: left;
margin-bottom: 1em;
h1 {
font-size: $h3_size;
}
li {
margin-bottom: 0.5em;
}
}
}
}

View File

@@ -1,5 +0,0 @@
div#c-maintenance-user-login-reminders {
div#a-new {
width: 50em;
}
}

View File

@@ -1,5 +0,0 @@
#c-meta-searches {
section {
margin-bottom: 2em;
}
}

View File

@@ -1,42 +0,0 @@
div#c-moderator-dashboards {
div#col1 {
width: 45%;
float: left;
padding-right: 5%;
}
div#col2 {
width: 45%;
float: left;
}
div.activity {
margin-bottom: 1em;
}
div#ip-addr-search {
margin-bottom: 2em;
.hint {
display: block;
}
}
div#activity-search {
margin-bottom: 2em;
}
table {
width: 100%;
}
caption {
font-size: 1.1em;
font-weight: bold;
text-align: left;
}
th {
text-align: left;
}
}

View File

@@ -1,7 +0,0 @@
div#c-news-updates {
div#a-edit, div#a-new {
.hint {
display: block;
}
}
}

View File

@@ -1,112 +0,0 @@
div#note-container {
position: absolute;
z-index: 50;
div.note-body {
position: absolute;
border: 1px solid black;
background: #FFE;
min-width: 140px;
min-height: 1em;
line-height: normal;
cursor: pointer;
padding: 4px;
z-index: 150;
overflow: auto;
h1, h2, h3, h4, h5, h6, a, span, div, blockquote, br, p, ul, li, ol, em, strong, small, big, b, i, font, u, s, code, center {
line-height: normal;
}
> :last-child {
margin-bottom: 0;
}
b, strong {
font-weight: bold;
}
i, em {
font-style: italic;
}
small {
font-size: 0.8em;
}
ruby {
rt {
font-size: 0.8em;
}
}
ul {
margin-left: 1em;
margin-bottom: 1em;
ul {
margin-bottom: 0;
}
li {
list-style-type: disc;
+ br {
display: none;
}
}
}
}
div.note-box {
position: absolute;
border: 1px solid white;
min-width: 5px;
min-height: 5px;
width: 100px;
height: 100px;
cursor: move;
background: transparent;
line-height: normal;
div.note-box-inner-border {
border: 1px solid black;
background: #FFE;
}
div.note-box-inner-border.unsaved {
border: 1px solid red;
}
&.embedded {
div.bg {
height: 100%;
text-align: center;
display: table-cell;
vertical-align: middle;
}
div.note-box-inner-border {
text-align: center;
display: table-cell;
vertical-align: middle;
}
}
&.note-box-highlighted {
outline: 2px solid $note_highlight_color;
}
}
}
div#note-preview {
position: absolute;
border: 1px solid red;
opacity: 0.6;
display: none;
background: white;
}
div.note-edit-dialog {
font-size: 0.8em;
}

View File

@@ -1,92 +0,0 @@
@import "../common/000_vars.scss";
a.pool-category-series, .pool-category-series a {
color: #A0A;
&:hover {
color: #B6B;
}
}
a.pool-category-collection, .pool-category-collection a {
color: $link_color;
&:hover {
color: $link_hover_color;
}
}
div#add-to-pool-dialog {
font-size: 0.8em;
form {
margin-bottom: 1em;
}
li {
margin-left: 1em;
cursor: pointer;
}
h1 {
font-size: $h3_size;
}
.hint {
display: block;
}
}
div#c-pools {
h1 {
font-size: $h2_size;
}
textarea {
height: 10em;
}
div#a-show {
div#description {
margin-bottom: 1em;
}
}
}
div#c-pool-orders, div#c-favorite-group-orders {
h1 {
font-size: $h2_size;
}
div#a-edit {
ul.ui-sortable {
list-style-type: none;
li {
cursor: pointer;
margin-right: 20px;
margin-bottom: 20px;
min-width: 150px;
min-height: 150px;
padding: 10px;
@include inline-block;
}
li.ui-state-default {
background: none;
}
li.ui-state-placeholder {
background: none;
}
}
}
}
ul.inline-pool-list {
display: inline;
li {
display: inline;
}
}

View File

@@ -1,5 +0,0 @@
div#c-post-appeals {
li {
list-style-type: disc;
}
}

View File

@@ -1,11 +0,0 @@
div#c-post-events {
#a-index {
tr.resolved-true {
background: #DDD;
}
tr.resolved-false {
background: #FFF;
}
}
}

View File

@@ -1,13 +0,0 @@
div#c-post-flags {
li {
list-style-type: disc;
}
tr.resolved-true {
background: #DDD !important;
}
tr.resolved-false {
background: #FFF !important;
}
}

View File

@@ -1,71 +0,0 @@
body.mode-view {
background-color: #FFF;
}
body.mode-edit {
background-color: #5C5;
}
body.mode-tag-script {
background-color: #D6D;
}
body.mode-add-fav {
background-color: #FFA;
}
body.mode-remove-fav {
background-color: #FFA;
}
body.mode-rating-s {
background-color: #6F6;
}
body.mode-rating-q {
background-color: #AAA;
}
body.mode-rating-e {
background-color: #F66;
}
body.mode-vote-up {
background-color: #AFA;
}
body.mode-vote-down {
background-color: #FAA;
}
body.mode-lock-rating {
background-color: #AA3;
}
body.mode-lock-note {
background-color: #3AA;
}
body.mode-approve {
background-color: #48C;
}
body.mode-unapprove {
background-color: #F66;
}
body.mode-add-to-pool {
background-color: #26A;
}
body.mode-translation {
background-color: #5CD;
}
body.mode-ban {
background-color: #F33;
}
#page, #top, #page-footer {
background-color: white;
}

View File

@@ -1,115 +0,0 @@
$tooltip-line-height: 16px;
$tooltip-body-height: $tooltip-line-height * 6; // 6 lines high.
$tooltip-width: 164px * 3 - 10; // 3 thumbnails wide.
@mixin thin-scrollbar {
&::-webkit-scrollbar {
width: 5px;
height: 5px;
}
&::-webkit-scrollbar-button {
width: 0px;
height: 0px;
}
&::-webkit-scrollbar-thumb {
background: #999999;
border: 0px none #FFFFFF;
border-radius: 0px;
}
&::-webkit-scrollbar-thumb:hover {
background: #AAAAAA;
}
&::-webkit-scrollbar-thumb:active {
background: #AAAAAA;
}
&::-webkit-scrollbar-track {
background: #EEEEEE;
border: 0px none #ffffff;
border-radius: 0px;
}
&::-webkit-scrollbar-track:hover {
background: #EEEEEE;
}
&::-webkit-scrollbar-track:active {
background: #EEEEEE;
}
&::-webkit-scrollbar-corner {
background: transparent;
}
}
.post-tooltip {
max-width: $tooltip-width;
min-width: $tooltip-width;
box-sizing: border-box;
font-size: 11px;
line-height: $tooltip-line-height;
border-color: #767676;
.qtip-content {
padding: 0;
> * {
padding: 2px 6px;
}
.post-tooltip-body {
@include thin-scrollbar;
max-height: $tooltip-body-height;
overflow-y: auto;
li {
margin-right: 0;
}
}
.post-tooltip-header {
background-color: $menu_color;
display: flex;
white-space: nowrap;
overflow: hidden;
.post-tooltip-header-left {
flex: 1;
}
.post-tooltip-header-right {
flex: 1;
text-align: right;
}
.fa-xs {
vertical-align: baseline;
}
.post-tooltip-disable {
margin-left: 0.5em;
}
}
.post-tooltip-info {
margin-left: 0.5em;
color: #555;
font-size: 10px;
}
}
&:not(:hover) {
a, span {
color: #777 !important;
}
}
&.post-tooltip-loading {
visibility: hidden;
}
}

View File

@@ -1,9 +0,0 @@
@import "../common/000_vars.scss";
div#c-post-versions {
div#a-index {
tr.hilite {
background: $highlight_color;
}
}
}

View File

@@ -1,550 +0,0 @@
@import "../common/000_vars.scss";
article.post-preview {
height: 154px;
width: 154px;
margin: 0 10px 10px 0;
overflow: hidden;
text-align: center;
@include inline-block;
position: relative;
a {
@include inline-block;
}
&.pooled {
height: 214px;
}
.desc {
font-size: 80%;
}
img {
margin: auto;
}
&[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before {
@include animated-icon;
}
&[data-has-sound=true]:before {
@include sound-icon;
}
}
#iqdb-similar {
overflow: hidden;
.post-preview {
height: auto;
margin-bottom: 0;
}
p {
margin-bottom: 0;
}
}
#saved-searches-nav {
margin-top: 1em;
}
a.blacklisted-active {
text-decoration: line-through;
}
.post-preview.blacklisted-active, #image-container.blacklisted-active {
display: none;
}
#excerpt p.links {
margin-top: 1em;
}
#image-container p.desc {
font-size: 80%;
color: grey;
font-style: italic;
}
#open-edit-dialog {
padding: 0;
}
#edit-dialog textarea {
margin-bottom: 0.25em;
}
.post-preview {
img {
border: 2px solid transparent;
}
&.post-status-has-children img {
border-color: $preview_has_children_color;
}
&.post-status-has-parent img {
border-color: $preview_has_parent_color;
}
&.post-status-has-children.post-status-has-parent img {
border-color: $preview_has_children_color $preview_has_parent_color $preview_has_parent_color $preview_has_children_color;
}
&.post-status-deleted img {
border-color: $preview_deleted_color;
}
&.post-status-has-children.post-status-deleted img {
border-color: $preview_has_children_color $preview_deleted_color $preview_deleted_color $preview_has_children_color;
}
&.post-status-has-parent.post-status-deleted img {
border-color: $preview_has_parent_color $preview_deleted_color $preview_deleted_color $preview_has_parent_color;
}
&.post-status-has-children.post-status-has-parent.post-status-deleted img {
border-color: $preview_has_children_color $preview_deleted_color $preview_deleted_color $preview_has_parent_color;
}
/* Pending and flagged posts have blue borders (except in the modqueue). */
&.post-status-pending:not(.mod-queue-preview) img,
&.post-status-flagged:not(.mod-queue-preview) img {
border-color: $preview_pending_color;
}
&.post-status-has-children.post-status-pending:not(.mod-queue-preview) img,
&.post-status-has-children.post-status-flagged:not(.mod-queue-preview) img {
border-color: $preview_has_children_color $preview_pending_color $preview_pending_color $preview_has_children_color;
}
&.post-status-has-parent.post-status-pending:not(.mod-queue-preview) img,
&.post-status-has-parent.post-status-flagged:not(.mod-queue-preview) img {
border-color: $preview_has_parent_color $preview_pending_color $preview_pending_color $preview_has_parent_color;
}
&.post-status-has-children.post-status-has-parent.post-status-pending:not(.mod-queue-preview) img,
&.post-status-has-children.post-status-has-parent.post-status-flagged:not(.mod-queue-preview) img {
border-color: $preview_has_children_color $preview_pending_color $preview_pending_color $preview_has_parent_color;
}
}
/* Flagged posts have red borders for approvers. */
body[data-user-can-approve-posts="true"] .post-preview {
&.post-status-flagged img {
border-color: $preview_flagged_color;
}
&.post-status-has-children.post-status-flagged img {
border-color: $preview_has_children_color $preview_flagged_color $preview_flagged_color $preview_has_children_color;
}
&.post-status-has-parent.post-status-flagged img {
border-color: $preview_has_parent_color $preview_flagged_color $preview_flagged_color $preview_has_parent_color;
}
&.post-status-has-children.post-status-has-parent.post-status-flagged img {
border-color: $preview_has_children_color $preview_flagged_color $preview_flagged_color $preview_has_parent_color;
}
}
.post-preview.current-post {
background-color: rgba(0,0,0,0.1);
}
#has-parent-relationship-preview, #has-children-relationship-preview {
overflow-x: auto;
white-space: nowrap;
article.post-preview {
width: auto;
border: none;
margin: 0;
padding: 5px 5px 10px;
}
}
.post-count {
color: #CCC;
margin-left: 0.2em;
}
.low-post-count {
color: red;
}
div#c-posts {
.fav-buttons {
font-size: 14pt;
text-align: center;
margin: 0.5em 0;
input[type=submit] {
padding: 0.2em 0.75em;
}
}
#ugoira-controls {
div#seek-slider {
margin-top: 0.5em;
float: right;
overflow: visible;
background: #EEE;
.ui-progressbar-value {
background: white;
}
}
#save-video-link {
margin: 0.5em 0;
}
button {
margin-top: 0.3em;
}
#ugoira-load-progress {
display: inline;
margin-left: 17px;
}
}
.outer-recent-searches {
overflow: hidden;
}
div.notice {
font-size: 0.8em;
padding: 0.5em;
margin-bottom: 0.5em;
overflow: hidden;
ul {
margin-left: 1em;
}
p {
margin: 0;
}
.resolved {
margin-left: 0.5em;
font-weight: bold;
}
&.notice-parent {
border-color: #C0FCC0;
background: #D8FCD9;
}
&.notice-child {
border-color: #FCFCC0;
background: #FBFCD8;
}
&.notice-pending {
border-color: #C0C0FC;
background: #D8D8FC;
}
&.notice-flagged {
border-color: #FCC0C0;
background: #FCD9D8;
}
&.notice-deleted {
border-color: #FF8C8C;
background: #FFA7A5;
}
&.notice-appealed {
border-color: #C0ECFC;
background: #D8F2FC;
}
&.notice-resized {
border-color: #E4C0FC;
background: #EED8FC;
}
}
div.nav-notice {
padding: 0.5em;
margin: 1em 0;
background: #EEE;
border: 1px solid #AAA;
position: relative;
p {
margin: 0;
text-align: center;
}
}
aside#sidebar #tag-list h2 {
font-size: $h4_size;
}
aside#sidebar > section > ul {
margin-bottom: 1em;
}
aside#sidebar > section > ul li {
list-style-type: none;
}
aside#sidebar > section > ul ul li {
margin-left: 1em;
}
div#a-index {
menu#post-sections {
margin-bottom: 0.5em;
font-size: $h3_size;
li {
padding: 0 1em 0.5em 0;
&.active {
font-weight: bold;
}
}
}
}
div#a-show {
.active {
font-weight: bold;
}
.recommended-posts {
margin-top: 1em;
}
#add-fav-button, #remove-fav-button {
margin-top: 1em;
}
menu#post-sections {
margin: 0;
font-size: $h3_size;
li {
padding: 0 1em 0 0;
}
div.share a {
margin: 0;
}
}
div.notices {
margin: 1em 0;
}
section {
margin-top: 1em;
}
span.quick-mod {
float: right;
}
.pool-name, .search-name {
word-wrap: break-word;
}
textarea {
margin-bottom: 0.25em;
}
#favlist {
margin-left: 1em;
word-wrap: break-word;
}
#search-seq-nav + #pool-nav, #search-seq-nav + #favgroup-nav, #pool-nav + #favgroup-nav {
margin-top: 0.5em;
}
#pool-nav, #search-seq-nav, #favgroup-nav {
li {
position: relative;
text-align: center;
padding: 0 5.5em;
.prev {
position: absolute;
left: 2em;
top: 0;
}
.next {
position: absolute;
right: 2em;
top: 0;
}
.first {
position: absolute;
left: 0.5em;
top: 0;
}
.last {
position: absolute;
right: 0.5em;
top: 0;
}
&:hover {
background: rgb(250, 250, 250);
}
}
}
span.close-button {
position: absolute;
top: 5px;
right: 5px;
cursor: pointer;
}
div.comments-for-post {
width:100%
}
#artist-commentary {
border: 1px solid #CCC;
border-radius: 8px;
background-color: #F8F8F8;
margin-top: 1em;
padding: 0.5em;
#original-artist-commentary, #translated-artist-commentary {
max-height: 20em;
overflow-y: auto;
}
.disabled {
color: gray;
}
}
}
div#quick-edit-div {
textarea {
width: 70%;
height: 4em;
display: block;
}
}
}
div#c-post-versions, div#c-artist-versions {
div#a-index {
a {
word-wrap: break-word
}
}
}
div#c-posts, div#c-uploads {
/* Fetch source data box */
div#source-info {
border-radius: 4px;
margin: 1em 0;
padding: 1em;
border: 1px solid #666;
p {
margin: 0;
}
> ul {
display: none;
.source-tags {
a {
margin-right: 1em;
}
}
}
}
}
div#c-explore-posts {
a.desc {
font-weight: bold;
margin: 0 0.5em;
}
#popular-nav-links {
text-align: center;
}
.period {
margin: 0 5em;
&:first-child {
margin-left: 0;
}
}
}
.inline-blacklist {
#blacklist-box {
margin-bottom: 1em;
}
#blacklist-list {
display: inline;
}
#blacklist-list li {
display: inline;
margin-right: 1em;
a {
color: $link_color;
cursor: pointer;
}
span.count {
color: #AAA;
margin-left: 0;
}
}
}
div#unapprove-dialog {
p {
margin-bottom: 1em;
}
}
textarea[data-autocomplete="tag-edit"] {
font-family: monospace;
}
#add-commentary-dialog {
input {
width: 70%;
}
input[type=checkbox] {
width: auto;
}
textarea {
font-size: 1em;
width: 100%;
}
}

View File

@@ -1,52 +0,0 @@
@import "../common/000_vars.scss";
div#related-tags-container {
padding-right: 2em;
h1 {
font-size: $h3_size;
}
}
div.related-tags {
width: 100%;
margin-bottom: 1em;
padding: 1em;
background: #EEE;
overflow: auto;
border-radius: 4px;
div.tag-column {
max-width: 15em;
margin-right: 2em;
float: left;
ul {
margin: 0;
li {
em {
font-weight: bold;
}
svg {
margin-top: 2px;
cursor: pointer;
}
a {
min-width: 3em;
}
a.selected {
background-color: $link_color;
color: white;
}
}
}
}
div.wide-column {
max-width: 45em;
}
}

View File

@@ -1,25 +0,0 @@
#c-reports {
#a-similar-users {
div.box {
h2, h3 {
color: #333;
}
margin-bottom: 2em;
}
span.accuracy {
color: #666;
}
/* clearfix hacks */
div.box:before, div.box:after {
content: "";
display: table;
}
div.box:after {
clear: both;
}
}
}

View File

@@ -1,7 +0,0 @@
#c-saved-searches {
#a-index {
table {
margin-bottom: 2em;
}
}
}

View File

@@ -1,11 +0,0 @@
@import "../common/000_vars.scss";
div#c-sessions {
div#a-new {
label#remember-label {
display: inline;
font-weight: normal;
font-style: italic;
}
}
}

View File

@@ -1,25 +0,0 @@
@import "../common/000_vars.scss";
div#c-static {
div#a-site-map {
width: 80em;
h1 {
display: none;
}
section {
width: 20em;
float: left;
h1 {
display: block;
font-size: $h3_size;
}
ul {
margin-bottom: 1.5em;
}
}
}
}

View File

@@ -1,13 +0,0 @@
div#c-tags {
div#a-index table.striped {
td:nth-child(1), th:nth-child(1) {
width: 5em;
text-align: right;
}
td:nth-child(2), th:nth-child(2) {
padding-left: 1em;
width: 40em;
}
}
}

View File

@@ -1,26 +0,0 @@
@import "../common/000_vars.scss";
div#c-static div#a-terms-of-service {
width: 40em;
h1 {
font-size: $h2_size;
}
p {
margin-bottom: 1em;
}
ul {
margin-left: 1em;
margin-bottom: 1em;
}
li {
list-style-type: disc;
}
section {
margin-bottom: 2em;
}
}

View File

@@ -1,68 +0,0 @@
div#c-uploads {
div#a-new {
.artist-commentary {
margin-top: 1em;
margin-left: 1em;
}
div#upload-guide-notice {
margin-bottom: 2em;
}
ul#links {
margin-bottom: 1em;
}
label[for="upload_as_pending"] {
display: inline;
}
fieldset.ratings {
label {
display: inline;
}
}
textarea {
margin-bottom: 0.25em;
}
.hint {
display: block;
}
div.field_with_errors {
display: inline;
}
}
div#a-index {
.info {
margin-right: 1.5em;
}
}
div.upload-preview {
display: inline-block;
> a {
width: 154px;
height: 154px;
margin: 0 10px 10px 0;
display: inline-block;
img {
margin: auto;
border: 2px solid transparent;
max-width: 154px;
max-height: 154px;
}
}
.caption-top {
font-size: 0.8em;
margin-bottom: 0;
}
}
}

View File

@@ -1,10 +0,0 @@
div#c-maintenance-user-deletions {
ul {
margin-left: 1em;
margin-bottom: 1em;
}
li {
list-style-type: disc;
}
}

View File

@@ -1,17 +0,0 @@
div#c-user-feedbacks, div#c-moderator-dashboards div#col2 {
.feedback-category-positive {
background: #DDFFDD !important;
}
.feedback-category-negative {
background: #FFDDDD !important;
}
.feedback-category-neutral {
background: #FFFFFF !important;
}
blockquote {
padding: 0.5em;
}
}

View File

@@ -1,25 +0,0 @@
#c-user-name-change-requests {
.feedback-category-positive {
background: #DDFFDD !important;
}
.feedback-category-negative {
background: #FFDDDD !important;
}
li {
margin-bottom: 1em;
}
form {
margin-bottom: 2em;
}
p {
margin: 0;
}
section {
margin-bottom: 1em;
}
}

View File

@@ -1,56 +0,0 @@
div#c-user-upgrades {
div#a-new {
max-width: 40em;
font-size: 1.2em;
form.stripe {
display: inline;
}
div.section {
margin-bottom: 2em;
}
div#feature-comparison {
overflow: hidden;
margin-bottom: 1em;
table {
width: 100%;
colgroup {
width: 10em;
}
colgroup#basic {
}
colgroup#gold {
background-color: #FFF380;
}
colgroup#platinum {
background-color: #eee;
}
td, th {
text-align: center;
vertical-align: top;
padding: 0.5em 0;
}
tbody {
tr:hover {
background-color: #FEF;
}
}
p.cost-footnote {
font-size: 80%;
color: gray;
margin: 0;
}
}
}
}
}

View File

@@ -1,89 +0,0 @@
@import "../common/000_vars.scss";
div#c-users {
div#a-show {
div.box {
h2, h3 {
color: #333;
}
margin-bottom: 2em;
}
/* clearfix hacks */
div.box:before, div.box:after {
content: "";
display: table;
}
div.box:after {
clear: both;
}
table.user-statistics {
tr {
height: 1.75em;
}
th {
width: 15%;
text-align: right;
padding-right: 1em;
vertical-align: top;
}
td {
width: 85%;
vertical-align: top;
}
p {
margin-bottom: 0.5em;
}
}
}
div#a-edit {
h1 {
margin: 0.5em 0;
}
h2 {
margin: 0.5em 0;
}
div.input {
margin-bottom: 2em;
}
div.input span.hint {
display: block;
max-width: 70%;
}
.active {
color: black;
}
}
div#a-new {
max-width: 60em;
p {
font-size: 1.2em;
margin-bottom: 1em;
line-height: 1.4em;
}
footer.nav-links {
font-size: 1.4545em;
font-weight: bold;
text-align: center;
display: block;
}
div#p2 ul {
margin-bottom: 2em;
}
}
}

View File

@@ -1,25 +0,0 @@
div#c-wiki-page-versions {
#a-diff {
del {
background: #FCC;
text-decoration: none;
}
ins {
background: #CFC;
text-decoration: none;
}
}
#a-index {
table {
margin-bottom: 1em;
}
}
#a-show {
span.version {
color: #AAA;
}
}
}

View File

@@ -1,19 +0,0 @@
div#c-wiki-pages {
form span.hint {
display: block;
}
#a-new {
div.notice {
font-size: 0.8em;
padding: 1em;
margin: 1em 0;
}
}
}
.wiki-other-name {
background-color: #EEE;
padding: 3px;
border-radius: 3px;
}

View File

@@ -1,283 +0,0 @@
@import "../common/000_vars.scss";
#desktop-version-link {
display: none;
}
#searchbox-redirect-link {
display: none;
}
@media screen and (max-width: 660px) {
#desktop-version-link {
display: inline;
}
#searchbox-redirect-link {
display: inline;
}
#saved-searches-nav {
display: none;
}
div#page aside#sidebar {
padding: 5px;
input#tags {
width: 80%;
}
button[type=submit] {
font-size: 1.4em;
background-color: #EEE;
height: 42px;
padding: 2px 10px;
}
}
div#page {
padding: 0 0.25vw;
> div /* div#c-$controller */ {
> div /* div#a-$action */ {
display: flex;
flex-direction: column;
/* Move #sidebar below #content. */
> aside#sidebar {
font-size: 1.5em;
float: none;
width: auto;
order: 2;
}
}
}
}
#maintoggle {
display: block;
font-weight: bold;
position: absolute;
top: 3vw;
right: 4vw;
font-size: 2em;
&.toggler-active {
background-color: lighten($link_color, 25%);
color: #000;
}
}
/* Make the quick search box in the navbar full width. */
header#top menu form input {
width: auto;
}
h1 {
display: none;
}
form {
input[type=text] {
vertical-align: top;
font-size: 24pt;
border: 1px solid #c5c5c5;
}
textarea {
vertical-align: top;
border: 1px solid #c5c5c5;
}
input[type=submit] {
font-size: 160%;
}
input[type=submit].tiny {
font-size: 120%;
vertical-align: top;
}
}
div#page section#content {
margin: 0;
padding: 0;
}
#comments h2 {
display: none;
}
div.paginator {
font-size: 24pt;
font-weight: bold;
text-align: center;
width: 100%;
padding: 0;
margin: 0;
margin-top: 1em;
li {
display: inline-block;
margin: 0 0.25em;
a, span {
margin: 0;
padding: 0;
border: none;
}
&.current-page {
text-align: center;
}
&.arrow:last-child {
text-align: right;
}
&.numbered-page, &.more {
display: none;
}
}
}
#posts #posts-container {
width: 100%;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
}
article.post-preview {
float: none;
margin: 0;
text-align: center;
vertical-align: middle;
display: inline-block;
a {
margin: 0 auto;
}
img {
width: 33.3vw;
border: none !important;
}
&[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before {
@include animated-icon;
}
&[data-has-sound=true]:before {
@include sound-icon;
}
}
.user-disable-cropped-false {
article.post-preview {
width: 33.3%;
height: 33.3vw;
overflow: hidden;
}
img {
width: 33.3vw;
height: 33.3vw;
&.has-cropped-false {
object-fit: cover;
}
}
}
img#image {
margin-top: 5px;
}
#image-container {
overflow: scroll;
}
div#options {
margin-top: 10px;
font-size: 24pt;
font-weight: bold;
}
div#tags {
margin-top: 30px;
li {
margin: 10px 0;
}
a.search-tag {
font-size: 24pt;
font-weight: bold;
}
}
div#page {
div.comments-for-post div.list-of-comments article.comment div.content {
clear: both;
margin: 0;
}
}
#nav {
font-size: 2em;
line-height: 2em;
display: none;
}
header#top menu.main {
background-color: lighten($link_color, 25%);
padding: 5px 10px;
}
h1 {
display: block;
font-size: 2em;
margin: 1em 0 0 0;
}
h2 {
font-size: 0.825em;
margin: 1em 0 0 0;
}
header {
text-align: center;
line-height: 2em;
h1 {
display: inline; //Needed for menu button
}
}
div#page {
margin: 0;
}
}
@media screen and (max-width: 440px) {
input#expand-search {
display: none;
}
body {
width: 100%;
}
#post-sections {
font-size: 1em;
}
div article.post-preview {
overflow: visible;
}
}
#tos-notice {
display: none;
}