diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index c8d3642a3..d9c1d6641 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -4,6 +4,7 @@
//= require jquery.timeout.js
//= require jquery-ui-autocomplete-custom.js
//= require jquery.storageapi.js
+//= require jquery.dropdown.min.js
//= require ugoira_player.js
//= require stupidtable.js
//= require rails.js
diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js
index 7736247f9..03a9fef4d 100644
--- a/app/assets/javascripts/posts.js
+++ b/app/assets/javascripts/posts.js
@@ -576,7 +576,7 @@
}
});
- $("#save-search").click(function() {
+ $("#save-search").click(function(e) {
if (Danbooru.meta("disable-labeled-saved-searches") === "false") {
$("#save-search-dialog").dialog("open");
} else {
@@ -587,6 +587,18 @@
}
);
}
+
+ 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();
});
}
})();
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index a1b69f2b0..f0939e18a 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -1,3 +1,4 @@
@import "jquery-ui-1.11.2.min.scss";
+@import "jquery.dropdown.css";
@import "common/*";
@import "specific/*";
diff --git a/app/assets/stylesheets/common/main_layout.scss b/app/assets/stylesheets/common/main_layout.scss
index 5271a919f..f8b1e478e 100644
--- a/app/assets/stylesheets/common/main_layout.scss
+++ b/app/assets/stylesheets/common/main_layout.scss
@@ -38,7 +38,7 @@ div#page {
}
input[type=text] {
- width: 10em;
+ width: 8em;
}
}
diff --git a/app/logical/popular_search_service.rb b/app/logical/popular_search_service.rb
index b61d83a48..ac7e0c88c 100644
--- a/app/logical/popular_search_service.rb
+++ b/app/logical/popular_search_service.rb
@@ -26,6 +26,6 @@ class PopularSearchService
end
end
response
- end.force_encoding("utf-8")
+ end.to_s.force_encoding("utf-8")
end
end
diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb
index ca2d694f5..d8c356858 100644
--- a/app/models/saved_search.rb
+++ b/app/models/saved_search.rb
@@ -110,6 +110,6 @@ class SavedSearch < ActiveRecord::Base
end
def label_string=(val)
- self.labels = val.scan(/\S+/).map {|x| SavedSearch.normalize_label(x)}
+ self.labels = val.to_s.scan(/\S+/).map {|x| SavedSearch.normalize_label(x)}
end
end
diff --git a/app/views/posts/partials/common/_search.html.erb b/app/views/posts/partials/common/_search.html.erb
index 18ffab1f9..943a1bc99 100644
--- a/app/views/posts/partials/common/_search.html.erb
+++ b/app/views/posts/partials/common/_search.html.erb
@@ -15,5 +15,16 @@
<% end %>
<%= hidden_field_tag "ms", "1" %>
<%= submit_tag "Go", :name => nil %>
+ <%= submit_tag "+", "data-jq-dropdown" => "#search-dropdown" %>
+
+
+
<% end %>
diff --git a/app/views/saved_searches/_interface.html.erb b/app/views/saved_searches/_interface.html.erb
index 1720a4499..28f618fbb 100644
--- a/app/views/saved_searches/_interface.html.erb
+++ b/app/views/saved_searches/_interface.html.erb
@@ -1,7 +1,3 @@
-<% if SavedSearch.enabled? && CurrentUser.show_saved_searches? %>
- <%= button_tag "Save search", :id => "save-search" %>
-<% end %>
-
<% if SavedSearch.enabled? %>
<%= form_tag(saved_searches_path, :class => "simple_form", :remote => true) do %>
diff --git a/vendor/assets/javascripts/jquery.dropdown.min.js b/vendor/assets/javascripts/jquery.dropdown.min.js
new file mode 100644
index 000000000..23694b05f
--- /dev/null
+++ b/vendor/assets/javascripts/jquery.dropdown.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery Dropdown: A simple dropdown plugin
+ *
+ * Contribute: https://github.com/claviska/jquery-dropdown
+ *
+ * @license: MIT license: http://opensource.org/licenses/MIT
+ *
+ */
+jQuery&&function($){function t(t,e){var d=t?$(this):e,n=$(d.attr("data-jq-dropdown")),a=d.hasClass("jq-dropdown-open");if(t){if($(t.target).hasClass("jq-dropdown-ignore"))return;t.preventDefault(),t.stopPropagation()}else if(d!==e.target&&$(e.target).hasClass("jq-dropdown-ignore"))return;o(),a||d.hasClass("jq-dropdown-disabled")||(d.addClass("jq-dropdown-open"),n.data("jq-dropdown-trigger",d).show(),r(),n.trigger("show",{jqDropdown:n,trigger:d}))}function o(t){var o=t?$(t.target).parents().addBack():null;if(o&&o.is(".jq-dropdown")){if(!o.is(".jq-dropdown-menu"))return;if(!o.is("A"))return}var r=jQuery.Event("hide");$(document).find(".jq-dropdown:visible").each(function(){var t=$(this);t.hide().removeData("jq-dropdown-trigger").trigger("hide",{jqDropdown:t})}),r.isDefaultPrevented()||($(document).find(".jq-dropdown:visible").each(function(){var t=$(this);t.hide().removeData("jq-dropdown-trigger").trigger("hide",{jqDropdown:t})}),$(document).find(".jq-dropdown-open").removeClass("jq-dropdown-open"))}function r(){var t=$(".jq-dropdown:visible").eq(0),o=t.data("jq-dropdown-trigger"),r=o?parseInt(o.attr("data-horizontal-offset")||0,10):null,e=o?parseInt(o.attr("data-vertical-offset")||0,10):null;0!==t.length&&o&&(t.hasClass("jq-dropdown-relative")?t.css({left:t.hasClass("jq-dropdown-anchor-right")?o.position().left-(t.outerWidth(!0)-o.outerWidth(!0))-parseInt(o.css("margin-right"),10)+r:o.position().left+parseInt(o.css("margin-left"),10)+r,top:o.position().top+o.outerHeight(!0)-parseInt(o.css("margin-top"),10)+e}):t.css({left:t.hasClass("jq-dropdown-anchor-right")?o.offset().left-(t.outerWidth()-o.outerWidth())+r:o.offset().left+r,top:o.offset().top+o.outerHeight()+e}))}$.extend($.fn,{jqDropdown:function(r,e){switch(r){case"show":return t(null,$(this)),$(this);case"hide":return o(),$(this);case"attach":return $(this).attr("data-jq-dropdown",e);case"detach":return o(),$(this).removeAttr("data-jq-dropdown");case"disable":return $(this).addClass("jq-dropdown-disabled");case"enable":return o(),$(this).removeClass("jq-dropdown-disabled")}}}),$(document).on("click.jq-dropdown","[data-jq-dropdown]",t),$(document).on("click.jq-dropdown",o),$(window).on("resize",r)}(jQuery);
\ No newline at end of file
diff --git a/vendor/assets/stylesheets/jquery.dropdown.css b/vendor/assets/stylesheets/jquery.dropdown.css
new file mode 100644
index 000000000..93b7c5594
--- /dev/null
+++ b/vendor/assets/stylesheets/jquery.dropdown.css
@@ -0,0 +1,90 @@
+/* jQuery Dropdown: A simple dropdown plugin
+ *
+ * Contribute: https://github.com/claviska/jquery-dropdown
+ *
+ * @license: MIT license: http://opensource.org/licenses/MIT
+ *
+ */
+.jq-dropdown {
+ position: absolute;
+ z-index: 1039;
+ display: none;
+}
+.jq-dropdown .jq-dropdown-menu,
+.jq-dropdown .jq-dropdown-panel {
+ min-width: 160px;
+ max-width: 360px;
+ list-style: none;
+ background: white;
+ border: solid 1px #ddd;
+ border-radius: 4px;
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+ overflow: visible;
+ padding: 4px 0;
+ margin: 0;
+}
+.jq-dropdown .jq-dropdown-panel {
+ padding: 10px;
+}
+.jq-dropdown.jq-dropdown-tip {
+ margin-top: 8px;
+}
+.jq-dropdown.jq-dropdown-tip:before {
+ position: absolute;
+ top: -6px;
+ left: 9px;
+ content: "";
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-bottom: 7px solid #ddd;
+ display: inline-block;
+}
+.jq-dropdown.jq-dropdown-tip:after {
+ position: absolute;
+ top: -5px;
+ left: 10px;
+ content: "";
+ border-left: 6px solid transparent;
+ border-right: 6px solid transparent;
+ border-bottom: 6px solid white;
+ display: inline-block;
+}
+.jq-dropdown.jq-dropdown-tip.jq-dropdown-anchor-right:before {
+ left: auto;
+ right: 9px;
+}
+.jq-dropdown.jq-dropdown-tip.jq-dropdown-anchor-right:after {
+ left: auto;
+ right: 10px;
+}
+.jq-dropdown.jq-dropdown-scroll .jq-dropdown-menu,
+.jq-dropdown.jq-dropdown-scroll .jq-dropdown-panel {
+ max-height: 180px;
+ overflow: auto;
+}
+.jq-dropdown .jq-dropdown-menu li {
+ list-style: none;
+ padding: 0 0;
+ text-indent: 0;
+ margin: 0;
+ line-height: 18px;
+}
+.jq-dropdown .jq-dropdown-menu li > a,
+.jq-dropdown .jq-dropdown-menu label {
+ display: block;
+ text-decoration: none;
+ line-height: 18px;
+ padding: 3px 15px;
+ margin: 0;
+ white-space: nowrap;
+}
+.jq-dropdown .jq-dropdown-menu li > a:hover,
+.jq-dropdown .jq-dropdown-menu label:hover {
+ cursor: pointer;
+}
+.jq-dropdown .jq-dropdown-menu .jq-dropdown-divider {
+ font-size: 1px;
+ border-top: solid 1px #e5e5e5;
+ padding: 0;
+ margin: 5px 0;
+}
\ No newline at end of file