Files
firefly-iii/public/v1/js/ff/search/index.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-07-15 17:19:12 +02:00
/*
* index.js
* Copyright (c) 2019 thegrumpydictator@gmail.com
2017-07-15 17:19:12 +02:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2017-10-21 08:40:00 +02:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2017-10-21 08:40:00 +02:00
*
* This program is distributed in the hope that it will be useful,
2017-10-21 08:40:00 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2017-10-21 08:40:00 +02:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2017-07-15 17:19:12 +02:00
*/
2017-12-29 09:05:35 +01:00
/** global: searchQuery,searchUri,token */
2017-07-15 17:19:12 +02:00
$(function () {
"use strict";
startSearch(searchQuery);
});
function startSearch(query) {
2017-12-20 20:07:57 +01:00
$.post(searchUri, {query: query, _token: token}).done(presentSearchResults).fail(searchFailure);
2017-07-15 17:19:12 +02:00
}
function searchFailure() {
$('.result_row').hide();
$('.error_row').show();
}
function presentSearchResults(data) {
$('.search_ongoing').hide();
$('.search_box').find('.overlay').remove();
$('.search_results').html(data.html).show();
2017-10-26 19:57:41 +02:00
updateListButtons();
2017-07-15 17:19:12 +02:00
}