summaryrefslogtreecommitdiffstats
path: root/search
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 15:44:41 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 15:44:41 +0100
commitd89733c85914e12c456b8425dfdfd3f69f337a19 (patch)
tree3be44e2098e78828b8df0dac56bd32c4c2118de9 /search
parent6f820b02094eaba3191124a7a17e56f302be202d (diff)
downloadnextcloud-server-d89733c85914e12c456b8425dfdfd3f69f337a19.tar.gz
nextcloud-server-d89733c85914e12c456b8425dfdfd3f69f337a19.zip
clear search results when clicking the x in type=search input field
Diffstat (limited to 'search')
-rw-r--r--search/js/search.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/search/js/search.js b/search/js/search.js
index 87b8908aa0a..10949cec0b0 100644
--- a/search/js/search.js
+++ b/search/js/search.js
@@ -30,6 +30,7 @@
* Initialize the search box
*
* @param $searchBox container element with existing markup for the #searchbox form
+ * @param $searchResults container element for results und status message
* @private
*/
initialize: function($searchBox, $searchResults) {
@@ -117,8 +118,10 @@
lastPage = page;
lastSize = size;
+ //show spinner
$searchResults.removeClass('hidden');
$status.html(t('core', 'Searching other places')+'<img class="spinner" alt="search in progress" src="'+OC.webroot+'/core/img/loading-dark.gif" />');
+
// do the actual search query
$.getJSON(OC.generateUrl('search/ajax/search.php'), {query:query, inApps:inApps, page:page, size:size }, function(results) {
lastResults = results;
@@ -260,6 +263,14 @@
event.preventDefault();
});
+ $searchBox.on('search', function (event) {
+ if($searchBox.val() === '') {
+ if(self.hasFilter(getCurrentApp())) {
+ self.getFilter(getCurrentApp())('');
+ }
+ self.hideResults();
+ }
+ });
$searchBox.keyup(function(event) {
if (event.keyCode === 13) { //enter
if(currentResult > -1) {