mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Gui: Add dropdown filters for Categories and Type (#11603)
cleaned up the on load to clear previous filters when the modal was closed
This commit is contained in:
@@ -4,8 +4,8 @@ var indexers = [];
|
|||||||
var configuredIndexers = [];
|
var configuredIndexers = [];
|
||||||
var unconfiguredIndexers = [];
|
var unconfiguredIndexers = [];
|
||||||
|
|
||||||
$.fn.inView = function() {
|
$.fn.inView = function () {
|
||||||
if(!this.length) return false;
|
if (!this.length) return false;
|
||||||
var rect = this.get(0).getBoundingClientRect();
|
var rect = this.get(0).getBoundingClientRect();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -23,17 +23,19 @@ $.fn.focusWithoutScrolling = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.ajaxSetup({ cache: false });
|
$.ajaxSetup({
|
||||||
|
cache: false
|
||||||
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('if_eq', function(a, b, opts) {
|
Handlebars.registerHelper('if_eq', function (a, b, opts) {
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return opts.fn(this);
|
return opts.fn(this);
|
||||||
else
|
else
|
||||||
return opts.inverse(this);
|
return opts.inverse(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('if_in', function(elem, list, opts) {
|
Handlebars.registerHelper('if_in', function (elem, list, opts) {
|
||||||
if(list.indexOf(elem) > -1) {
|
if (list.indexOf(elem) > -1) {
|
||||||
return opts.fn(this);
|
return opts.fn(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ function openSearchIfNecessary() {
|
|||||||
Object.assign({
|
Object.assign({
|
||||||
[item.split('=')[0]]: (item.split('=').length < 2 ?
|
[item.split('=')[0]]: (item.split('=').length < 2 ?
|
||||||
undefined :
|
undefined :
|
||||||
decodeURIComponent(item.split('=')[1].replace(/\+/g,'%20')))
|
decodeURIComponent(item.split('=')[1].replace(/\+/g, '%20')))
|
||||||
}, prev), {});
|
}, prev), {});
|
||||||
if ("search" in hashArgs) {
|
if ("search" in hashArgs) {
|
||||||
showSearch(hashArgs.tracker, hashArgs.search, hashArgs.category);
|
showSearch(hashArgs.tracker, hashArgs.search, hashArgs.category);
|
||||||
@@ -147,20 +149,17 @@ function reloadIndexers() {
|
|||||||
|
|
||||||
if (item.type == "public") {
|
if (item.type == "public") {
|
||||||
item.type_label = "success";
|
item.type_label = "success";
|
||||||
}
|
} else if (item.type == "private") {
|
||||||
else if (item.type == "private") {
|
|
||||||
item.type_label = "danger";
|
item.type_label = "danger";
|
||||||
}
|
} else if (item.type == "semi-private") {
|
||||||
else if (item.type == "semi-private") {
|
|
||||||
item.type_label = "warning";
|
item.type_label = "warning";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
item.type_label = "default";
|
item.type_label = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
var main_cats_list = item.caps.filter(function(c) {
|
var main_cats_list = item.caps.filter(function (c) {
|
||||||
return c.ID < 100000;
|
return c.ID < 100000;
|
||||||
}).map(function(c) {
|
}).map(function (c) {
|
||||||
return c.Name.split("/")[0];
|
return c.Name.split("/")[0];
|
||||||
});
|
});
|
||||||
item.mains_cats = $.unique(main_cats_list).join(", ");
|
item.mains_cats = $.unique(main_cats_list).join(", ");
|
||||||
@@ -180,21 +179,27 @@ function reloadIndexers() {
|
|||||||
|
|
||||||
function displayConfiguredIndexersList(indexers) {
|
function displayConfiguredIndexersList(indexers) {
|
||||||
var indexersTemplate = Handlebars.compile($("#configured-indexer-table").html());
|
var indexersTemplate = Handlebars.compile($("#configured-indexer-table").html());
|
||||||
var indexersTable = $(indexersTemplate({ indexers: indexers, total_configured_indexers: indexers.length }));
|
var indexersTable = $(indexersTemplate({
|
||||||
|
indexers: indexers,
|
||||||
|
total_configured_indexers: indexers.length
|
||||||
|
}));
|
||||||
prepareTestButtons(indexersTable);
|
prepareTestButtons(indexersTable);
|
||||||
prepareSearchButtons(indexersTable);
|
prepareSearchButtons(indexersTable);
|
||||||
prepareSetupButtons(indexersTable);
|
prepareSetupButtons(indexersTable);
|
||||||
prepareDeleteButtons(indexersTable);
|
prepareDeleteButtons(indexersTable);
|
||||||
prepareCopyButtons(indexersTable);
|
prepareCopyButtons(indexersTable);
|
||||||
indexersTable.find("table").dataTable(
|
indexersTable.find("table").dataTable({
|
||||||
{
|
|
||||||
"stateSave": true,
|
"stateSave": true,
|
||||||
"stateDuration": 0,
|
"stateDuration": 0,
|
||||||
"pageLength": -1,
|
"pageLength": -1,
|
||||||
"lengthMenu": [[10, 20, 50, 100, 250, 500, -1], [10, 20, 50, 100, 250, 500, "All"]],
|
"lengthMenu": [
|
||||||
"order": [[0, "asc"]],
|
[10, 20, 50, 100, 250, 500, -1],
|
||||||
"columnDefs": [
|
[10, 20, 50, 100, 250, 500, "All"]
|
||||||
{
|
],
|
||||||
|
"order": [
|
||||||
|
[0, "asc"]
|
||||||
|
],
|
||||||
|
"columnDefs": [{
|
||||||
"targets": 0,
|
"targets": 0,
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"searchable": true,
|
"searchable": true,
|
||||||
@@ -218,7 +223,10 @@ function displayUnconfiguredIndexersList() {
|
|||||||
var UnconfiguredIndexersDialog = $($("#select-indexer").html());
|
var UnconfiguredIndexersDialog = $($("#select-indexer").html());
|
||||||
|
|
||||||
var indexersTemplate = Handlebars.compile($("#unconfigured-indexer-table").html());
|
var indexersTemplate = Handlebars.compile($("#unconfigured-indexer-table").html());
|
||||||
var indexersTable = $(indexersTemplate({ indexers: unconfiguredIndexers, total_unconfigured_indexers: unconfiguredIndexers.length }));
|
var indexersTable = $(indexersTemplate({
|
||||||
|
indexers: unconfiguredIndexers,
|
||||||
|
total_unconfigured_indexers: unconfiguredIndexers.length
|
||||||
|
}));
|
||||||
indexersTable.find('.indexer-setup').each(function (i, btn) {
|
indexersTable.find('.indexer-setup').each(function (i, btn) {
|
||||||
var indexer = unconfiguredIndexers[i];
|
var indexer = unconfiguredIndexers[i];
|
||||||
$(btn).click(function () {
|
$(btn).click(function () {
|
||||||
@@ -247,7 +255,7 @@ function displayUnconfiguredIndexersList() {
|
|||||||
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
||||||
}
|
}
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
if(data.responseJSON.error !== undefined) {
|
if (data.responseJSON.error !== undefined) {
|
||||||
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - indexerId.length - "] ".length - " (Config)".length; // keep url <= 2k #5104
|
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - indexerId.length - "] ".length - " (Config)".length; // keep url <= 2k #5104
|
||||||
var githubrepo = "Jackett/Jackett";
|
var githubrepo = "Jackett/Jackett";
|
||||||
var githubtext = "this indexer";
|
var githubtext = "this indexer";
|
||||||
@@ -264,25 +272,36 @@ function displayUnconfiguredIndexersList() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
indexersTable.find("table").DataTable(
|
indexersTable.find("table").DataTable({
|
||||||
{
|
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
this.api().columns().every(function () {
|
var currentTable = this;
|
||||||
|
this.api().columns().every(function (index, i, j) {
|
||||||
var column = this;
|
var column = this;
|
||||||
var headerText = column.header().innerText;
|
var headerText = column.header().innerText;
|
||||||
|
|
||||||
if (headerText == 'Language') {
|
if (headerText == 'Type') {
|
||||||
var select = $('<select><option value="">Show all</option></select>')
|
var select = createDropDownHtml(column, true);
|
||||||
.appendTo($(column.footer()).empty())
|
|
||||||
.on('change', function () {
|
|
||||||
var val = $.fn.dataTable.util.escapeRegex(
|
|
||||||
$(this).val()
|
|
||||||
);
|
|
||||||
|
|
||||||
column
|
var columnData = currentTable.api().columns(index + 1).data();
|
||||||
.search(val ? '^' + val + '$' : '', true, false)
|
var distinctValues = [...new Set(columnData[0])];
|
||||||
.draw();
|
distinctValues.forEach(function (distinctVal) {
|
||||||
|
select.append('<option value="' + distinctVal + '">' + distinctVal.replace(/^\w/, (c) => c.toUpperCase()) + '</option>')
|
||||||
});
|
});
|
||||||
|
} else if (headerText == 'Categories') {
|
||||||
|
var select = createDropDownHtml(column, false);
|
||||||
|
|
||||||
|
var columnData = [];
|
||||||
|
column.data().unique().each(function (d, j) {
|
||||||
|
d.split(',').forEach(function (val) {
|
||||||
|
columnData.push(val.trim());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
var distinctValues = [...new Set(columnData)];
|
||||||
|
distinctValues.sort().forEach(function (distinctVal) {
|
||||||
|
select.append('<option value="' + distinctVal + '">' + distinctVal + '</option>')
|
||||||
|
});
|
||||||
|
} else if (headerText == 'Language') {
|
||||||
|
var select = createDropDownHtml(column, true);
|
||||||
|
|
||||||
column.data().unique().sort().each(function (d, j) {
|
column.data().unique().sort().each(function (d, j) {
|
||||||
select.append('<option value="' + d + '">' + d + '</option>')
|
select.append('<option value="' + d + '">' + d + '</option>')
|
||||||
@@ -300,10 +319,14 @@ function displayUnconfiguredIndexersList() {
|
|||||||
},
|
},
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
"pageLength": -1,
|
"pageLength": -1,
|
||||||
"lengthMenu": [[10, 20, 50, 100, 250, 500, -1], [10, 20, 50, 100, 250, 500, "All"]],
|
"lengthMenu": [
|
||||||
"order": [[0, "asc"]],
|
[10, 20, 50, 100, 250, 500, -1],
|
||||||
"columnDefs": [
|
[10, 20, 50, 100, 250, 500, "All"]
|
||||||
{
|
],
|
||||||
|
"order": [
|
||||||
|
[0, "asc"]
|
||||||
|
],
|
||||||
|
"columnDefs": [{
|
||||||
"name": "name",
|
"name": "name",
|
||||||
"targets": 0,
|
"targets": 0,
|
||||||
"visible": true,
|
"visible": true,
|
||||||
@@ -342,7 +365,7 @@ function displayUnconfiguredIndexersList() {
|
|||||||
"name": "buttons",
|
"name": "buttons",
|
||||||
"targets": 5,
|
"targets": 5,
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"searchable" : false,
|
"searchable": false,
|
||||||
"orderable": false
|
"orderable": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -351,7 +374,7 @@ function displayUnconfiguredIndexersList() {
|
|||||||
var undefindexers = UnconfiguredIndexersDialog.find('#unconfigured-indexers');
|
var undefindexers = UnconfiguredIndexersDialog.find('#unconfigured-indexers');
|
||||||
undefindexers.append(indexersTable);
|
undefindexers.append(indexersTable);
|
||||||
|
|
||||||
UnconfiguredIndexersDialog.on('shown.bs.modal', function() {
|
UnconfiguredIndexersDialog.on('shown.bs.modal', function () {
|
||||||
$(this).find('div.dataTables_filter input').focusWithoutScrolling();
|
$(this).find('div.dataTables_filter input').focusWithoutScrolling();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -364,6 +387,28 @@ function displayUnconfiguredIndexersList() {
|
|||||||
UnconfiguredIndexersDialog.modal("show");
|
UnconfiguredIndexersDialog.modal("show");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createDropDownHtml(column, exactMatch) {
|
||||||
|
var select = $('<select><option value="">Show all</option></select>')
|
||||||
|
.appendTo($(column.footer()).empty())
|
||||||
|
.on('change', function () {
|
||||||
|
var val = $.fn.dataTable.util.escapeRegex(
|
||||||
|
$(this).val()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (exactMatch) {
|
||||||
|
column
|
||||||
|
.search(val ? '^' + val + '$' : '', true, false)
|
||||||
|
.draw();
|
||||||
|
} else {
|
||||||
|
column
|
||||||
|
.search(val ? val : '', true, false)
|
||||||
|
.draw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return select;
|
||||||
|
}
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
function copyToClipboard(text) {
|
||||||
// create hidden text element, if it doesn't already exist
|
// create hidden text element, if it doesn't already exist
|
||||||
var targetId = "_hiddenCopyText_";
|
var targetId = "_hiddenCopyText_";
|
||||||
@@ -437,7 +482,7 @@ function prepareSearchButtons(element) {
|
|||||||
element.find('.indexer-button-search').each(function (i, btn) {
|
element.find('.indexer-button-search').each(function (i, btn) {
|
||||||
var $btn = $(btn);
|
var $btn = $(btn);
|
||||||
var id = $btn.data("id");
|
var id = $btn.data("id");
|
||||||
$btn.click(function() {
|
$btn.click(function () {
|
||||||
window.location.hash = "search&tracker=" + id;
|
window.location.hash = "search&tracker=" + id;
|
||||||
showSearch(id);
|
showSearch(id);
|
||||||
});
|
});
|
||||||
@@ -453,9 +498,8 @@ function prepareSetupButtons(element) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTestState(id, state, message, parent)
|
function updateTestState(id, state, message, parent) {
|
||||||
{
|
var btn = parent.find(".indexer-button-test[data-id=" + id + "]");
|
||||||
var btn = parent.find(".indexer-button-test[data-id=" +id + "]");
|
|
||||||
|
|
||||||
var sortmsg = message;
|
var sortmsg = message;
|
||||||
if (!sortmsg || state == "success")
|
if (!sortmsg || state == "success")
|
||||||
@@ -468,7 +512,9 @@ function updateTestState(id, state, message, parent)
|
|||||||
if (message) {
|
if (message) {
|
||||||
btn.tooltip("hide");
|
btn.tooltip("hide");
|
||||||
btn.attr("title", message);
|
btn.attr("title", message);
|
||||||
btn.data('bs.tooltip', false).tooltip({ title: message });
|
btn.data('bs.tooltip', false).tooltip({
|
||||||
|
title: message
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
var icon = btn.find("span");
|
var icon = btn.find("span");
|
||||||
@@ -481,7 +527,10 @@ function updateTestState(id, state, message, parent)
|
|||||||
} else if (state == "inprogres") {
|
} else if (state == "inprogres") {
|
||||||
icon.addClass("glyphicon-refresh test-inprogres spinner");
|
icon.addClass("glyphicon-refresh test-inprogres spinner");
|
||||||
}
|
}
|
||||||
var dt = $.fn.dataTable.tables({ visible: true, api: true}).rows().invalidate('dom');
|
var dt = $.fn.dataTable.tables({
|
||||||
|
visible: true,
|
||||||
|
api: true
|
||||||
|
}).rows().invalidate('dom');
|
||||||
if (state != "inprogres")
|
if (state != "inprogres")
|
||||||
dt.draw();
|
dt.draw();
|
||||||
}
|
}
|
||||||
@@ -504,7 +553,7 @@ function testIndexer(id, notifyResult) {
|
|||||||
}
|
}
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
updateTestState(id, "error", data.error, indexers);
|
updateTestState(id, "error", data.error, indexers);
|
||||||
if(data.responseJSON.error !== undefined && notifyResult) {
|
if (data.responseJSON.error !== undefined && notifyResult) {
|
||||||
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - id.length - "] ".length - " (Test)".length; // keep url <= 2k #5104
|
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - id.length - "] ".length - " (Test)".length; // keep url <= 2k #5104
|
||||||
var githubrepo = "Jackett/Jackett";
|
var githubrepo = "Jackett/Jackett";
|
||||||
var githubtext = "this indexer";
|
var githubtext = "this indexer";
|
||||||
@@ -568,13 +617,20 @@ function populateConfigItems(configForm, config) {
|
|||||||
|
|
||||||
function newConfigModal(title, config, caps, link, alternativesitelinks, description) {
|
function newConfigModal(title, config, caps, link, alternativesitelinks, description) {
|
||||||
var configTemplate = Handlebars.compile($("#jackett-config-setup-modal").html());
|
var configTemplate = Handlebars.compile($("#jackett-config-setup-modal").html());
|
||||||
var configForm = $(configTemplate({ title: title, caps: caps, link: link, description: description }));
|
var configForm = $(configTemplate({
|
||||||
|
title: title,
|
||||||
|
caps: caps,
|
||||||
|
link: link,
|
||||||
|
description: description
|
||||||
|
}));
|
||||||
$("#modals").append(configForm);
|
$("#modals").append(configForm);
|
||||||
populateConfigItems(configForm, config);
|
populateConfigItems(configForm, config);
|
||||||
|
|
||||||
if (alternativesitelinks.length >= 1) {
|
if (alternativesitelinks.length >= 1) {
|
||||||
var AlternativeSiteLinksTemplate = Handlebars.compile($("#setup-item-alternativesitelinks").html());
|
var AlternativeSiteLinksTemplate = Handlebars.compile($("#setup-item-alternativesitelinks").html());
|
||||||
var template = $(AlternativeSiteLinksTemplate({ "alternativesitelinks": alternativesitelinks }));
|
var template = $(AlternativeSiteLinksTemplate({
|
||||||
|
"alternativesitelinks": alternativesitelinks
|
||||||
|
}));
|
||||||
configForm.find("div[data-id='sitelink']").after(template);
|
configForm.find("div[data-id='sitelink']").after(template);
|
||||||
template.find("a.alternativesitelink").click(function (a) {
|
template.find("a.alternativesitelink").click(function (a) {
|
||||||
$("div[data-id='sitelink'] input").val(this.href);
|
$("div[data-id='sitelink'] input").val(this.href);
|
||||||
@@ -591,7 +647,9 @@ function getConfigModalJson(configForm) {
|
|||||||
$el = $(el);
|
$el = $(el);
|
||||||
var type = $el.data("type");
|
var type = $el.data("type");
|
||||||
var id = $el.data("id");
|
var id = $el.data("id");
|
||||||
var itemEntry = { id: id };
|
var itemEntry = {
|
||||||
|
id: id
|
||||||
|
};
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "hiddendata":
|
case "hiddendata":
|
||||||
itemEntry.value = $el.find(".setup-item-hiddendata input").val();
|
itemEntry.value = $el.find(".setup-item-hiddendata input").val();
|
||||||
@@ -641,7 +699,7 @@ function populateSetupForm(indexerId, name, config, caps, link, alternativesitel
|
|||||||
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
doNotify("Configuration failed: " + data.error, "danger", "glyphicon glyphicon-alert");
|
||||||
}
|
}
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
if(data.responseJSON.error !== undefined) {
|
if (data.responseJSON.error !== undefined) {
|
||||||
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - indexerId.length - "] ".length - " (Config)".length; // keep url <= 2k #5104
|
var indexEnd = 2048 - "https://github.com/Jackett/Jackett/issues/new?title=[".length - indexerId.length - "] ".length - " (Config)".length; // keep url <= 2k #5104
|
||||||
doNotify("An error occurred while updating this indexer<br /><b>" + data.responseJSON.error.substring(0, indexEnd) + "</b><br /><i><a href=\"https://github.com/Jackett/Jackett/issues/new?title=[" + indexerId + "] " + data.responseJSON.error.substring(0, indexEnd) + " (Config)\" target=\"_blank\">Click here to open an issue on GitHub for this indexer.</a><i>", "danger", "glyphicon glyphicon-alert", false);
|
doNotify("An error occurred while updating this indexer<br /><b>" + data.responseJSON.error.substring(0, indexEnd) + "</b><br /><i><a href=\"https://github.com/Jackett/Jackett/issues/new?title=[" + indexerId + "] " + data.responseJSON.error.substring(0, indexEnd) + " (Config)\" target=\"_blank\">Click here to open an issue on GitHub for this indexer.</a><i>", "danger", "glyphicon glyphicon-alert", false);
|
||||||
} else {
|
} else {
|
||||||
@@ -696,8 +754,7 @@ function clearNotifications() {
|
|||||||
$('[data-notify="container"]').remove();
|
$('[data-notify="container"]').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateReleasesRow(row)
|
function updateReleasesRow(row) {
|
||||||
{
|
|
||||||
var labels = $(row).find("span.release-labels");
|
var labels = $(row).find("span.release-labels");
|
||||||
var TitleLink = $(row).find("td.Title > a");
|
var TitleLink = $(row).find("td.Title > a");
|
||||||
var IMDBId = $(row).data("imdb");
|
var IMDBId = $(row).data("imdb");
|
||||||
@@ -764,7 +821,7 @@ function showSearch(selectedIndexer, query, category) {
|
|||||||
releaseDialog.on('hidden.bs.modal', function (e) {
|
releaseDialog.on('hidden.bs.modal', function (e) {
|
||||||
$('#indexers div.dataTables_filter input').focusWithoutScrolling();
|
$('#indexers div.dataTables_filter input').focusWithoutScrolling();
|
||||||
window.location.hash = '';
|
window.location.hash = '';
|
||||||
}) ;
|
});
|
||||||
|
|
||||||
var setCategories = function (trackers, items) {
|
var setCategories = function (trackers, items) {
|
||||||
var cats = {};
|
var cats = {};
|
||||||
@@ -781,7 +838,10 @@ function showSearch(selectedIndexer, query, category) {
|
|||||||
var selected = select.val();
|
var selected = select.val();
|
||||||
var options = []
|
var options = []
|
||||||
$.each(cats, function (ID, Name) {
|
$.each(cats, function (ID, Name) {
|
||||||
options.push({ label: ID + ' (' + Name + ')', value: ID });
|
options.push({
|
||||||
|
label: ID + ' (' + Name + ')',
|
||||||
|
value: ID
|
||||||
|
});
|
||||||
});
|
});
|
||||||
select.multiselect('dataprovider', options);
|
select.multiselect('dataprovider', options);
|
||||||
select.val(selected).multiselect("refresh");
|
select.val(selected).multiselect("refresh");
|
||||||
@@ -790,7 +850,9 @@ function showSearch(selectedIndexer, query, category) {
|
|||||||
$('#searchTracker').change(jQuery.proxy(function () {
|
$('#searchTracker').change(jQuery.proxy(function () {
|
||||||
var trackerIds = $('#searchTracker').val();
|
var trackerIds = $('#searchTracker').val();
|
||||||
setCategories(trackerIds, this.items);
|
setCategories(trackerIds, this.items);
|
||||||
}, { items: configuredIndexers }));
|
}, {
|
||||||
|
items: configuredIndexers
|
||||||
|
}));
|
||||||
|
|
||||||
var queryField = document.getElementById("searchquery");
|
var queryField = document.getElementById("searchquery");
|
||||||
queryField.addEventListener("keyup", function (event) {
|
queryField.addEventListener("keyup", function (event) {
|
||||||
@@ -814,7 +876,7 @@ function showSearch(selectedIndexer, query, category) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.location.hash = Object.entries({
|
window.location.hash = Object.entries({
|
||||||
search: encodeURIComponent(queryObj.Query).replace(/%20/g,'+'),
|
search: encodeURIComponent(queryObj.Query).replace(/%20/g, '+'),
|
||||||
tracker: queryObj.Tracker.join(","),
|
tracker: queryObj.Tracker.join(","),
|
||||||
category: queryObj.Category.join(",")
|
category: queryObj.Category.join(",")
|
||||||
}).map(([k, v], i) => k + '=' + v).join('&');
|
}).map(([k, v], i) => k + '=' + v).join('&');
|
||||||
@@ -905,10 +967,13 @@ $.fn.dataTable.ext.search = [
|
|||||||
function updateSearchResultTable(element, results) {
|
function updateSearchResultTable(element, results) {
|
||||||
var resultsTemplate = Handlebars.compile($("#jackett-search-results").html());
|
var resultsTemplate = Handlebars.compile($("#jackett-search-results").html());
|
||||||
element.html($(resultsTemplate(results)));
|
element.html($(resultsTemplate(results)));
|
||||||
element.find('tr.jackett-search-results-row').each(function () { updateReleasesRow(this); });
|
element.find('tr.jackett-search-results-row').each(function () {
|
||||||
var settings = { "deadfilter": true };
|
updateReleasesRow(this);
|
||||||
var datatable = element.find('table').DataTable(
|
});
|
||||||
{
|
var settings = {
|
||||||
|
"deadfilter": true
|
||||||
|
};
|
||||||
|
var datatable = element.find('table').DataTable({
|
||||||
"fnStateSaveParams": function (oSettings, sValue) {
|
"fnStateSaveParams": function (oSettings, sValue) {
|
||||||
sValue.search.search = ""; // don't save the search filter content
|
sValue.search.search = ""; // don't save the search filter content
|
||||||
sValue.deadfilter = settings.deadfilter;
|
sValue.deadfilter = settings.deadfilter;
|
||||||
@@ -924,10 +989,14 @@ function updateSearchResultTable(element, results) {
|
|||||||
"stateDuration": 0,
|
"stateDuration": 0,
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
"pageLength": 20,
|
"pageLength": 20,
|
||||||
"lengthMenu": [[10, 20, 50, 100, 250, 500, -1], [10, 20, 50, 100, 250, 500, "All"]],
|
"lengthMenu": [
|
||||||
"order": [[0, "desc"]],
|
[10, 20, 50, 100, 250, 500, -1],
|
||||||
"columnDefs": [
|
[10, 20, 50, 100, 250, 500, "All"]
|
||||||
{
|
],
|
||||||
|
"order": [
|
||||||
|
[0, "desc"]
|
||||||
|
],
|
||||||
|
"columnDefs": [{
|
||||||
"targets": 0,
|
"targets": 0,
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"searchable": false,
|
"searchable": false,
|
||||||
@@ -964,7 +1033,7 @@ function updateSearchResultTable(element, results) {
|
|||||||
newInputSearch.on("input", function () {
|
newInputSearch.on("input", function () {
|
||||||
var newKeywords = [];
|
var newKeywords = [];
|
||||||
var filterTextKeywords = $(this).val().split(" ");
|
var filterTextKeywords = $(this).val().split(" ");
|
||||||
$.each(filterTextKeywords, function(index, keyword) {
|
$.each(filterTextKeywords, function (index, keyword) {
|
||||||
if (keyword === "" || keyword === "+" || keyword === "-")
|
if (keyword === "" || keyword === "+" || keyword === "-")
|
||||||
return;
|
return;
|
||||||
var newKeyword;
|
var newKeyword;
|
||||||
@@ -985,8 +1054,7 @@ function updateSearchResultTable(element, results) {
|
|||||||
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) {
|
||||||
deadfilterlabel = $('<label><input type="checkbox" id="jackett-search-results-datatable_deadfilter_checkbox" value="1"> Show dead torrents</label>'
|
deadfilterlabel = $('<label><input type="checkbox" id="jackett-search-results-datatable_deadfilter_checkbox" value="1"> Show dead torrents</label>');
|
||||||
);
|
|
||||||
deadfilterdiv.append(deadfilterlabel);
|
deadfilterdiv.append(deadfilterlabel);
|
||||||
deadfiltercheckbox = deadfilterlabel.find("input");
|
deadfiltercheckbox = deadfilterlabel.find("input");
|
||||||
deadfiltercheckbox.on("change", function () {
|
deadfiltercheckbox.on("change", function () {
|
||||||
@@ -1049,6 +1117,7 @@ function bindUIButtons() {
|
|||||||
$("#modals").empty();
|
$("#modals").empty();
|
||||||
displayUnconfiguredIndexersList();
|
displayUnconfiguredIndexersList();
|
||||||
$('#unconfigured-indexer-datatable tfoot tr').insertAfter($('#unconfigured-indexer-datatable thead tr'));
|
$('#unconfigured-indexer-datatable tfoot tr').insertAfter($('#unconfigured-indexer-datatable thead tr'));
|
||||||
|
$('#unconfigured-indexer-datatable').DataTable().search('').columns().search('').draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#jackett-test-all").click(function () {
|
$("#jackett-test-all").click(function () {
|
||||||
@@ -1067,24 +1136,32 @@ function bindUIButtons() {
|
|||||||
item.CategoryDesc = insertWordWrap(item.CategoryDesc);
|
item.CategoryDesc = insertWordWrap(item.CategoryDesc);
|
||||||
}
|
}
|
||||||
var releaseTemplate = Handlebars.compile($("#jackett-releases").html());
|
var releaseTemplate = Handlebars.compile($("#jackett-releases").html());
|
||||||
var item = { releases: data, Title: 'Releases' };
|
var item = {
|
||||||
|
releases: data,
|
||||||
|
Title: 'Releases'
|
||||||
|
};
|
||||||
var releaseDialog = $(releaseTemplate(item));
|
var releaseDialog = $(releaseTemplate(item));
|
||||||
var table = releaseDialog.find('table');
|
var table = releaseDialog.find('table');
|
||||||
releaseDialog.find('tr.jackett-releases-row').each(function () { updateReleasesRow(this); });
|
releaseDialog.find('tr.jackett-releases-row').each(function () {
|
||||||
|
updateReleasesRow(this);
|
||||||
|
});
|
||||||
releaseDialog.on('hidden.bs.modal', function (e) {
|
releaseDialog.on('hidden.bs.modal', function (e) {
|
||||||
$('#indexers div.dataTables_filter input').focusWithoutScrolling();
|
$('#indexers div.dataTables_filter input').focusWithoutScrolling();
|
||||||
});
|
});
|
||||||
|
|
||||||
table.DataTable(
|
table.DataTable({
|
||||||
{
|
|
||||||
"stateSave": true,
|
"stateSave": true,
|
||||||
"stateDuration": 0,
|
"stateDuration": 0,
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
"pageLength": 20,
|
"pageLength": 20,
|
||||||
"lengthMenu": [[10, 20, 50, -1], [10, 20, 50, "All"]],
|
"lengthMenu": [
|
||||||
"order": [[0, "desc"]],
|
[10, 20, 50, -1],
|
||||||
"columnDefs": [
|
[10, 20, 50, "All"]
|
||||||
{
|
],
|
||||||
|
"order": [
|
||||||
|
[0, "desc"]
|
||||||
|
],
|
||||||
|
"columnDefs": [{
|
||||||
"targets": 0,
|
"targets": 0,
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"searchable": false,
|
"searchable": false,
|
||||||
@@ -1161,7 +1238,9 @@ function bindUIButtons() {
|
|||||||
$("#view-jackett-logs").click(function () {
|
$("#view-jackett-logs").click(function () {
|
||||||
api.getServerLogs(function (data) {
|
api.getServerLogs(function (data) {
|
||||||
var releaseTemplate = Handlebars.compile($("#jackett-logs").html());
|
var releaseTemplate = Handlebars.compile($("#jackett-logs").html());
|
||||||
var item = { logs: data };
|
var item = {
|
||||||
|
logs: data
|
||||||
|
};
|
||||||
var releaseDialog = $(releaseTemplate(item));
|
var releaseDialog = $(releaseTemplate(item));
|
||||||
$("#modals").append(releaseDialog);
|
$("#modals").append(releaseDialog);
|
||||||
releaseDialog.modal("show");
|
releaseDialog.modal("show");
|
||||||
@@ -1266,9 +1345,7 @@ function bindUIButtons() {
|
|||||||
function proxyWarning(input) {
|
function proxyWarning(input) {
|
||||||
if (input != null && input.toString().trim() !== "-1") { // disabled = -1
|
if (input != null && input.toString().trim() !== "-1") { // disabled = -1
|
||||||
$('#proxy-warning').show();
|
$('#proxy-warning').show();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#proxy-warning').hide();
|
$('#proxy-warning').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -698,6 +698,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=20210423"></script>
|
<script type="text/javascript" src="../custom.js?changed=20210424"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user