Add filetype: metatag.
This commit is contained in:
@@ -101,7 +101,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
var prefixes = "-|~|general:|gen:|artist:|art:|copyright:|copy:|co:|character:|char:|ch:";
|
var prefixes = "-|~|general:|gen:|artist:|art:|copyright:|copy:|co:|character:|char:|ch:";
|
||||||
var metatags = "order|-status|status|-rating|rating|-locked|locked|child|" +
|
var metatags = "order|-status|status|-rating|rating|-locked|locked|child|filetype|-filetype|" +
|
||||||
"-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-fav|fav|ordfav|" +
|
"-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-fav|fav|ordfav|" +
|
||||||
"sub|-pool|pool|ordpool|favgroup";
|
"sub|-pool|pool|ordpool|favgroup";
|
||||||
|
|
||||||
@@ -159,6 +159,8 @@
|
|||||||
case "locked":
|
case "locked":
|
||||||
case "-locked":
|
case "-locked":
|
||||||
case "child":
|
case "child":
|
||||||
|
case "filetype":
|
||||||
|
case "-filetype":
|
||||||
Danbooru.Autocomplete.static_metatag_source(term, resp, metatag);
|
Danbooru.Autocomplete.static_metatag_source(term, resp, metatag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -336,7 +338,10 @@
|
|||||||
],
|
],
|
||||||
child: [
|
child: [
|
||||||
"any", "none"
|
"any", "none"
|
||||||
]
|
],
|
||||||
|
filetype: [
|
||||||
|
"jpg", "png", "gif", "swf", "zip", "webm", "mp4"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Autocomplete.static_metatag_source = function(term, resp, metatag) {
|
Danbooru.Autocomplete.static_metatag_source = function(term, resp, metatag) {
|
||||||
|
|||||||
@@ -183,6 +183,14 @@ class PostQueryBuilder
|
|||||||
relation = relation.where("posts.is_deleted = FALSE")
|
relation = relation.where("posts.is_deleted = FALSE")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if q[:filetype]
|
||||||
|
relation = relation.where("posts.file_ext": q[:filetype])
|
||||||
|
end
|
||||||
|
|
||||||
|
if q[:filetype_neg]
|
||||||
|
relation = relation.where.not("posts.file_ext": q[:filetype_neg])
|
||||||
|
end
|
||||||
|
|
||||||
# The SourcePattern SQL function replaces Pixiv sources with "pixiv/[suffix]", where
|
# The SourcePattern SQL function replaces Pixiv sources with "pixiv/[suffix]", where
|
||||||
# [suffix] is everything past the second-to-last slash in the URL. It leaves non-Pixiv
|
# [suffix] is everything past the second-to-last slash in the URL. It leaves non-Pixiv
|
||||||
# URLs unchanged. This is to ease database load for Pixiv source searches.
|
# URLs unchanged. This is to ease database load for Pixiv source searches.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Tag < ActiveRecord::Base
|
class Tag < ActiveRecord::Base
|
||||||
COSINE_SIMILARITY_RELATED_TAG_THRESHOLD = 1000
|
COSINE_SIMILARITY_RELATED_TAG_THRESHOLD = 1000
|
||||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-favgroup|favgroup|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv|search|upvote|downvote"
|
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-favgroup|favgroup|-fav|fav|ordfav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv|search|upvote|downvote|filetype|-filetype"
|
||||||
SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm"
|
SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm"
|
||||||
attr_accessible :category, :as => [:moderator, :janitor, :gold, :platinum, :member, :anonymous, :default, :builder, :admin]
|
attr_accessible :category, :as => [:moderator, :janitor, :gold, :platinum, :member, :anonymous, :default, :builder, :admin]
|
||||||
attr_accessible :is_locked, :as => [:moderator, :admin]
|
attr_accessible :is_locked, :as => [:moderator, :admin]
|
||||||
@@ -606,6 +606,12 @@ class Tag < ActiveRecord::Base
|
|||||||
when "status"
|
when "status"
|
||||||
q[:status] = $2.downcase
|
q[:status] = $2.downcase
|
||||||
|
|
||||||
|
when "filetype"
|
||||||
|
q[:filetype] = $2.downcase
|
||||||
|
|
||||||
|
when "-filetype"
|
||||||
|
q[:filetype_neg] = $2.downcase
|
||||||
|
|
||||||
when "pixiv_id", "pixiv"
|
when "pixiv_id", "pixiv"
|
||||||
q[:pixiv_id] = parse_helper($2)
|
q[:pixiv_id] = parse_helper($2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user