mirror of
https://github.com/Jackett/Jackett
synced 2025-01-19 14:10:07 +00:00
This commit is contained in:
parent
fe9671d309
commit
f8595bf59e
2 changed files with 33 additions and 5 deletions
|
@ -870,7 +870,7 @@ function showSearch(selectedIndexer, query, category) {
|
||||||
$('#jackett-search-perform').html($('#search-button-ready').html());
|
$('#jackett-search-perform').html($('#search-button-ready').html());
|
||||||
var searchResults = $('#searchResults');
|
var searchResults = $('#searchResults');
|
||||||
searchResults.empty();
|
searchResults.empty();
|
||||||
var datatable = updateSearchResultTable(searchResults, data).search('').columns().search('').draw();
|
updateSearchResultTable(searchResults, data).search('').columns().search('').draw();
|
||||||
searchResults.find('div.dataTables_filter input').focusWithoutScrolling();
|
searchResults.find('div.dataTables_filter input').focusWithoutScrolling();
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
$('#jackett-search-perform').html($('#search-button-ready').html());
|
$('#jackett-search-perform').html($('#search-button-ready').html());
|
||||||
|
@ -879,7 +879,7 @@ function showSearch(selectedIndexer, query, category) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var searchTracker = releaseDialog.find("#searchTracker");
|
var searchTracker = releaseDialog.find("#searchTracker");
|
||||||
var searchCategory = releaseDialog.find('#searchCategory')
|
var searchCategory = releaseDialog.find('#searchCategory');
|
||||||
searchCategory.multiselect({
|
searchCategory.multiselect({
|
||||||
maxHeight: 400,
|
maxHeight: 400,
|
||||||
enableFiltering: true,
|
enableFiltering: true,
|
||||||
|
@ -927,7 +927,7 @@ $.fn.dataTable.ext.search = [
|
||||||
function (settings, data, dataIndex) {
|
function (settings, data, dataIndex) {
|
||||||
if (settings.sInstance != "jackett-search-results-datatable")
|
if (settings.sInstance != "jackett-search-results-datatable")
|
||||||
return true;
|
return true;
|
||||||
var deadfiltercheckbox = $(settings.nTableWrapper).find(".dataTables_deadfilter input")
|
var deadfiltercheckbox = $(settings.nTableWrapper).find(".dataTables_deadfilter input");
|
||||||
if (!deadfiltercheckbox.length) {
|
if (!deadfiltercheckbox.length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -936,7 +936,7 @@ $.fn.dataTable.ext.search = [
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
|
|
||||||
function updateSearchResultTable(element, results) {
|
function updateSearchResultTable(element, results) {
|
||||||
var resultsTemplate = Handlebars.compile($("#jackett-search-results").html());
|
var resultsTemplate = Handlebars.compile($("#jackett-search-results").html());
|
||||||
|
@ -990,6 +990,34 @@ function updateSearchResultTable(element, results) {
|
||||||
],
|
],
|
||||||
fnPreDrawCallback: function () {
|
fnPreDrawCallback: function () {
|
||||||
var table = this;
|
var table = this;
|
||||||
|
|
||||||
|
var inputSearch = element.find("input[type=search]");
|
||||||
|
if (!inputSearch.attr("custom")) {
|
||||||
|
var newInputSearch = inputSearch.clone();
|
||||||
|
newInputSearch.attr("custom", "true");
|
||||||
|
newInputSearch.attr("data-toggle", "tooltip");
|
||||||
|
newInputSearch.attr("title", "Search query consists of several keywords.\nKeyword starting with \"-\" is considered a negative match.");
|
||||||
|
newInputSearch.on("input", function () {
|
||||||
|
var newKeywords = [];
|
||||||
|
var filterTextKeywords = $(this).val().split(" ");
|
||||||
|
$.each(filterTextKeywords, function(index, keyword) {
|
||||||
|
if (keyword === "" || keyword === "+" || keyword === "-")
|
||||||
|
return;
|
||||||
|
var newKeyword;
|
||||||
|
if (keyword.startsWith("+"))
|
||||||
|
newKeyword = $.fn.dataTable.util.escapeRegex(keyword.substring(1));
|
||||||
|
else if (keyword.startsWith("-"))
|
||||||
|
newKeyword = "^((?!" + $.fn.dataTable.util.escapeRegex(keyword.substring(1)) + ").)*$";
|
||||||
|
else
|
||||||
|
newKeyword = $.fn.dataTable.util.escapeRegex(keyword);
|
||||||
|
newKeywords.push(newKeyword);
|
||||||
|
});
|
||||||
|
var filterText = newKeywords.join(" ");
|
||||||
|
table.api().search(filterText, true, true).draw();
|
||||||
|
});
|
||||||
|
inputSearch.replaceWith(newInputSearch);
|
||||||
|
}
|
||||||
|
|
||||||
var deadfilterdiv = element.find(".dataTables_deadfilter");
|
var deadfilterdiv = element.find(".dataTables_deadfilter");
|
||||||
var deadfiltercheckbox = deadfilterdiv.find("input");
|
var deadfiltercheckbox = deadfilterdiv.find("input");
|
||||||
if (!deadfiltercheckbox.length) {
|
if (!deadfiltercheckbox.length) {
|
||||||
|
|
|
@ -691,6 +691,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
|
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
|
||||||
<script type="text/javascript" src="../custom.js?changed=20200316"></script>
|
<script type="text/javascript" src="../custom.js?changed=20200420"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue