From b1401a1be59aeeac6fdc74c6e728143e8fd1d458 Mon Sep 17 00:00:00 2001 From: Divarion-D Date: Fri, 10 Oct 2025 18:30:55 +0300 Subject: [PATCH] The search bar and its behavior have been fixed. --- src/admin/api.php | 5 ++- src/admin/archive.php | 12 +++---- src/admin/asns.php | 12 +++---- src/admin/backups.php | 11 +++--- src/admin/bouquet.php | 15 ++++---- src/admin/bouquet_order.php | 12 +++---- src/admin/bouquet_sort.php | 12 +++---- src/admin/bouquets.php | 12 +++---- src/admin/cache.php | 11 +++--- src/admin/channel_order.php | 12 +++---- src/admin/client_logs.php | 12 +++---- src/admin/code.php | 12 +++---- src/admin/codes.php | 12 +++---- src/admin/created_channel.php | 12 +++---- src/admin/created_channel_mass.php | 11 +++--- src/admin/created_channels.php | 12 +++---- src/admin/credit_logs.php | 14 ++++---- src/admin/dashboard.php | 24 +++---------- src/admin/edit_profile.php | 12 +++---- src/admin/enigma.php | 12 +++---- src/admin/enigma_mass.php | 12 +++---- src/admin/enigmas.php | 12 +++---- src/admin/epg.php | 11 +++--- src/admin/epg_view.php | 12 +++---- src/admin/epgs.php | 12 +++---- src/admin/episode.php | 14 ++++---- src/admin/episodes.php | 12 +++---- src/admin/episodes_mass.php | 12 +++---- src/admin/fingerprint.php | 12 +++---- src/admin/footer.php | 56 +++++++++++++++++++++++++----- src/admin/group.php | 11 +++--- src/admin/groups.php | 12 +++---- src/admin/header.php | 14 ++++++-- src/admin/hmac.php | 12 +++---- src/admin/hmacs.php | 10 +++--- src/admin/ip.php | 10 +++--- src/admin/ips.php | 12 +++---- src/admin/isp.php | 10 +++--- src/admin/isps.php | 10 +++--- src/admin/line.php | 12 +++---- src/admin/line_activity.php | 12 +++---- src/admin/line_ips.php | 10 +++--- src/admin/line_mass.php | 12 +++---- src/admin/lines.php | 12 +++---- src/admin/live_connections.php | 12 +++---- src/admin/login_logs.php | 10 +++--- src/admin/mag.php | 12 +++---- src/admin/mag_events.php | 12 +++---- src/admin/mag_mass.php | 12 +++---- src/admin/mags.php | 12 +++---- src/admin/mass_delete.php | 12 +++---- src/admin/movie.php | 12 +++---- src/admin/movie_mass.php | 12 +++---- src/admin/movies.php | 12 +++---- src/admin/mysql_syslog.php | 10 +++--- src/admin/ondemand.php | 12 +++---- src/admin/package.php | 14 ++++---- src/admin/packages.php | 12 +++---- src/admin/panel_logs.php | 10 +++--- src/admin/plex.php | 10 +++--- src/admin/plex_add.php | 10 +++--- src/admin/process_monitor.php | 12 +++---- src/admin/profile.php | 10 +++--- src/admin/profiles.php | 12 +++---- src/admin/provider.php | 10 +++--- src/admin/providers.php | 10 +++--- src/admin/proxies.php | 12 +++---- src/admin/proxy.php | 12 +++---- src/admin/queue.php | 12 +++---- src/admin/quick_tools.php | 12 +++---- src/admin/radio.php | 12 +++---- src/admin/radio_mass.php | 12 +++---- src/admin/radios.php | 12 +++---- src/admin/record.php | 12 +++---- src/admin/restream_logs.php | 12 +++---- src/admin/review.php | 14 ++++---- src/admin/rtmp_ip.php | 12 +++---- src/admin/rtmp_ips.php | 12 +++---- src/admin/rtmp_monitor.php | 12 +++---- src/admin/serie.php | 12 +++---- src/admin/series.php | 12 +++---- src/admin/series_mass.php | 12 +++---- src/admin/server.php | 12 +++---- src/admin/server_install.php | 12 +++---- src/admin/server_order.php | 11 +++--- src/admin/server_view.php | 12 +++---- src/admin/servers.php | 11 +++--- src/admin/settings.php | 12 +++---- src/admin/settings_plex.php | 12 +++---- src/admin/stream.php | 12 +++---- src/admin/stream_categories.php | 12 +++---- src/admin/stream_category.php | 12 +++---- src/admin/stream_errors.php | 12 +++---- src/admin/stream_mass.php | 12 +++---- src/admin/stream_rank.php | 12 +++---- src/admin/stream_review.php | 12 +++---- src/admin/stream_tools.php | 12 +++---- src/admin/stream_view.php | 12 +++---- src/admin/streams.php | 12 +++---- src/admin/theft_detection.php | 12 +++---- src/admin/ticket.php | 12 +++---- src/admin/tickets.php | 12 +++---- src/admin/user.php | 14 ++++---- src/admin/user_logs.php | 12 +++---- src/admin/user_mass.php | 12 +++---- src/admin/useragent.php | 12 +++---- src/admin/useragents.php | 12 +++---- src/admin/users.php | 12 +++---- src/admin/watch.php | 12 +++---- src/admin/watch_add.php | 14 ++++---- src/admin/watch_output.php | 12 +++---- 111 files changed, 667 insertions(+), 698 deletions(-) diff --git a/src/admin/api.php b/src/admin/api.php index 8e84ac3c..3d0fbed3 100644 --- a/src/admin/api.php +++ b/src/admin/api.php @@ -3641,8 +3641,7 @@ if (isset($_SESSION['hash'])) { $rTerm = strtolower(preg_replace('/[^[:alnum:][:space:]]/u', '', CoreUtilities::$rRequest['search'])); $rTermSP = strtolower(preg_replace('/[^[:alnum:][:space:]]/u', ' ', CoreUtilities::$rRequest['search'])); - if (empty($rTermSP)) { - } else { + if (!empty($rTermSP)) { $rItems = array(); foreach ($rTables as $rTable => $rTableInfo) { @@ -3770,7 +3769,7 @@ if (isset($_SESSION['hash'])) { } foreach (array_keys($rServerItems) as $rStreamID) { - array_multisort(array_column($rServerItem[$rStreamID], 'priority'), SORT_DESC, $rServerItem[$rStreamID]); + array_multisort(array_column($rServerItems[$rStreamID], 'priority'), SORT_DESC, $rServerItems[$rStreamID]); } if (CoreUtilities::$rSettings['redis_handler']) { diff --git a/src/admin/archive.php b/src/admin/archive.php index 60ea74d8..68d34779 100644 --- a/src/admin/archive.php +++ b/src/admin/archive.php @@ -274,13 +274,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function player(rID, rStart = null, rDuration = null) { if (rStart) { rURL = "./player?type=timeshift&id=" + rID + "&start=" + rStart + "&duration=" + rDuration; @@ -342,6 +335,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/asns.php b/src/admin/asns.php index 14080fa0..b1d3d935 100644 --- a/src/admin/asns.php +++ b/src/admin/asns.php @@ -209,13 +209,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function api(rID, rType) { $.getJSON("./api?action=asn&sub=" + rType + "&id=" + rID, function(data) { if (data.result === true) { @@ -302,6 +295,11 @@ include 'header.php'; $('#datatable-users').DataTable().search($('#asn_search_box').val()).draw(); } }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/backups.php b/src/admin/backups.php index 753546dc..db7f7c8a 100644 --- a/src/admin/backups.php +++ b/src/admin/backups.php @@ -252,12 +252,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { new jBox("Confirm", { @@ -354,6 +348,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/bouquet.php b/src/admin/bouquet.php index db7f899a..5ff747c7 100644 --- a/src/admin/bouquet.php +++ b/src/admin/bouquet.php @@ -435,13 +435,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo $_['enter_a_bouquet_name']; echo '");' . "\r\n" . ' } else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' });' . "\r\n" . ' ' . "\r\n\t\t"; ?> - + + $(document).ready(function() { + initSearch(); + }); + + diff --git a/src/admin/bouquet_order.php b/src/admin/bouquet_order.php index 7a0ec85a..8f0fe602 100644 --- a/src/admin/bouquet_order.php +++ b/src/admin/bouquet_order.php @@ -213,13 +213,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function AtoZ() { $("#sort_bouquet").append($("#sort_bouquet option").remove().sort(function(a, b) { var at = $(a).text().toUpperCase(), @@ -273,6 +266,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/bouquet_sort.php b/src/admin/bouquet_sort.php index 6f948059..146f22fa 100644 --- a/src/admin/bouquet_sort.php +++ b/src/admin/bouquet_sort.php @@ -194,13 +194,6 @@ orderListings($rChannels, $rMovies, $rRadios, $rSeries, $rListings, $rOrdered); } }); - - $(document).ready(function() { - initSearch(); - }); - - - function AtoZ(rType) { $("#sort_" + rType + "_l").append($("#sort_" + rType + "_l option").remove().sort(function(a, b) { var at = $(a).text().toUpperCase(), @@ -352,6 +345,11 @@ orderListings($rChannels, $rMovies, $rRadios, $rSeries, $rListings, $rOrdered); submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/bouquets.php b/src/admin/bouquets.php index abda6e99..01a2c269 100644 --- a/src/admin/bouquets.php +++ b/src/admin/bouquets.php @@ -203,12 +203,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/cache.php b/src/admin/cache.php index ff38e2ea..3ee522b2 100644 --- a/src/admin/cache.php +++ b/src/admin/cache.php @@ -394,12 +394,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - function checkRegex(e) { var rRegex = /^[0-9\/*,-]+$/; return rRegex.test(String.fromCharCode(e.which)); @@ -470,6 +464,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/channel_order.php b/src/admin/channel_order.php index 331fabce..f2a3fd5d 100644 --- a/src/admin/channel_order.php +++ b/src/admin/channel_order.php @@ -406,13 +406,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function AtoZ(rType) { $("#sort_" + rType + "_l").append($("#sort_" + rType + "_l option").remove().sort(function(a, b) { var at = $(a).text().toUpperCase(), @@ -559,6 +552,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/client_logs.php b/src/admin/client_logs.php index 64d20030..5967a99e 100644 --- a/src/admin/client_logs.php +++ b/src/admin/client_logs.php @@ -205,12 +205,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/code.php b/src/admin/code.php index 1581149b..b9663f44 100644 --- a/src/admin/code.php +++ b/src/admin/code.php @@ -348,13 +348,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function generateCode() { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; @@ -413,6 +406,11 @@ include 'header.php'; ?> }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/codes.php b/src/admin/codes.php index d9f7c8d3..9ef08d0e 100644 --- a/src/admin/codes.php +++ b/src/admin/codes.php @@ -204,13 +204,6 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { new jBox("Confirm", { @@ -262,6 +255,11 @@ }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/created_channel.php b/src/admin/created_channel.php index f3251e0f..c47748ca 100644 --- a/src/admin/created_channel.php +++ b/src/admin/created_channel.php @@ -698,12 +698,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0 && rSource.length > 0) {' . "\r\n" . ' if (!rRTMPPush[rServerID]) {' . "\r\n" . ' rRTMPPush[rServerID] = [];' . "\r\n" . ' }' . "\r\n" . ' rRTMPPush[rServerID].push(rSource);' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' $("#external_push").val(JSON.stringify(rRTMPPush));' . "\r\n" . ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/created_channel_mass.php b/src/admin/created_channel_mass.php index 3785a7df..a88cb497 100644 --- a/src/admin/created_channel_mass.php +++ b/src/admin/created_channel_mass.php @@ -421,12 +421,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - var rSelected = []; function getCategory() { @@ -636,6 +630,11 @@ include 'header.php'; ?> } }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/created_channels.php b/src/admin/created_channels.php index c27c5b74..0a972bca 100644 --- a/src/admin/created_channels.php +++ b/src/admin/created_channels.php @@ -255,12 +255,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {' . "\r\n" . ' $.getJSON("./table?" + $.param($("#datatable-streampage").DataTable().ajax.params()) + "&refresh=" + rStreamIDs[0].join(","), function(rTable) {' . "\r\n" . ' if (!window.rProcessing) {' . "\r\n" . ' $(rTable.data).each(function(rIndex, rItem) {' . "\r\n" . ' for (i in rUpdateColumns) {' . "\r\n" . ' var rIndex = rStreamIDs[0].indexOf($(rItem[0]).text());' . "\r\n" . ' if (rIndex >= 0) {' . "\r\n" . " if (\$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data() != rItem[rUpdateColumns[i]]) {" . "\r\n" . " \$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data(rItem[rUpdateColumns[i]]);" . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' bindHref(); refreshTooltips(false);' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' clearTimeout(window.rRefresh);' . "\r\n" . ' window.rRefresh = setTimeout(refreshInformation, 5000);' . "\r\n" . ' }' . "\r\n\t\t" . 'function api(rID, rServerID, rType, rConfirm=false) {' . "\r\n" . ' if ((window.rSelected) && (window.rSelected.length > 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this stream?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rServerID == "kill") && (!rConfirm)) {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' rServerID = -1;' . "\r\n" . ' rType = "kill";' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=stream&sub=" + rType + "&stream_id=" + rID + "&server_id=" + rServerID, function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Stream successfully started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Stream successfully stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Stream successfully restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Stream successfully deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "kill") {' . "\r\n" . ' $.toast("Connection has been killed.");' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-streams-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-sources").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-live-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-live").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-streampage tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these channels?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=cchannel&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Channels have been started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Channels have been stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Channels have been restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Channels have been deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function player(rID) {' . "\r\n\t\t\t" . '$.magnificPopup.open({' . "\r\n\t\t\t\t" . 'items: {' . "\r\n\t\t\t\t\t" . 'src: "./player?type=live&id=" + rID,' . "\r\n\t\t\t\t\t" . "type: 'iframe'" . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getCategory() {' . "\r\n\t\t\t" . 'return $("#stream_category_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getFilter() {' . "\r\n\t\t\t" . 'return $("#stream_filter").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getServer() {' . "\r\n\t\t\t" . 'return $("#stream_server_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#stream_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_filter').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_server_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_category_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().search(\$(\"#stream_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().page.len(\$('#stream_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-streampage\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t" . 'delParams(["search", "server", "filter", "category", "page", "entries"]);' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "server", "category", "filter"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n\t\t\t" . 'var rPage = getParam("page");' . "\r\n" . ' if (!rPage) { rPage = 1; }' . "\r\n" . ' var rEntries = getParam("entries");' . "\r\n" . ' if (!rEntries) { rEntries = '; @@ -293,6 +288,11 @@ include 'header.php'; ?> echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . '});' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-streampage").css("width", "100%");' . "\r\n\t\t\t" . "\$('#stream_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#stream_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#stream_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#stream_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_category_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_category_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("category", $("#stream_category_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("category");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_server_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_server_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("server", $("#stream_server_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("server");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#stream_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "if (\$('#stream_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#stream_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-streampage").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '});' . "\r\n\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/credit_logs.php b/src/admin/credit_logs.php index 61cf6003..ed881f2f 100644 --- a/src/admin/credit_logs.php +++ b/src/admin/credit_logs.php @@ -191,13 +191,8 @@ include 'header.php'; ?> } } }); - - - $(document).ready(function() { - initSearch(); - }); - - echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n\t\t\t" . "\$('#log_search').keyup(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().search(\$(this).val()).draw();" . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().page.len(\$(this).val()).draw();" . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#reseller').change(function(){" . "\r\n\t\t\t\t" . '$("#datatable-activity").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-activity").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/dashboard.php b/src/admin/dashboard.php index b56507ce..1b78b787 100644 --- a/src/admin/dashboard.php +++ b/src/admin/dashboard.php @@ -861,25 +861,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - - - - - - - - - - - - - 0) {' . "\r\n" . ' navigate("./dashboard?server_id=" + $(this).val());' . "\r\n" . ' } else {' . "\r\n" . ' navigate("./dashboard");' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' });' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/edit_profile.php b/src/admin/edit_profile.php index a2db12eb..49b58834 100644 --- a/src/admin/edit_profile.php +++ b/src/admin/edit_profile.php @@ -250,13 +250,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function generateCode() { var result = ''; var characters = 'ABCDEF0123456789'; @@ -280,6 +273,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/enigma.php b/src/admin/enigma.php index 5850ac6e..a8eb16f0 100644 --- a/src/admin/enigma.php +++ b/src/admin/enigma.php @@ -418,12 +418,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo $_['search_user']; echo "'" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t\r\n\t\t\t" . '$("#datatable-bouquets").DataTable({' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,3]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rBouquets) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n\t\t\t\t" . 'paging: false,' . "\r\n\t\t\t\t" . 'bInfo: false,' . "\r\n\t\t\t\t" . 'searching: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-bouquets").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . " if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n" . " \$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' window.rBouquets.splice(parseInt($.inArray($(ui.selected).find("td:eq(0)").text()), window.rBouquets), 1);' . "\r\n" . ' } else { ' . "\r\n" . " \$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n" . ' window.rBouquets.push(parseInt($(ui.selected).find("td:eq(0)").text()));' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#no_expire").change(function() {' . "\r\n\t\t\t\t" . 'if ($(this).prop("checked")) {' . "\r\n\t\t\t\t\t" . '$("#exp_date").prop("disabled", true);' . "\r\n\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t" . '$("#exp_date").removeAttr("disabled");' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#add_ip").click(function() {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . ' if (($("#ip_field").val()) && (isValidIP($("#ip_field").val()))) {' . "\r\n" . ' var o = new Option($("#ip_field").val(), $("#ip_field").val());' . "\r\n" . ' $("#allowed_ips").append(o);' . "\r\n" . ' $("#ip_field").val("");' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("Please enter a valid IP address.");' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#remove_ip").click(function() {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . " \$('#allowed_ips option:selected').remove();" . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#pair_id").change(function() {' . "\r\n" . ' evaluatePair();' . "\r\n" . ' });' . "\r\n" . ' $("#mac").on("input", function(e) {' . "\r\n" . ' var rRegex = /([a-f0-9]{2})([a-f0-9]{2})/i, rString = e.target.value.replace(/[^a-f0-9]/ig, "");' . "\r\n" . ' while (rRegex.test(rString)) {' . "\r\n" . " rString = rString.replace(rRegex, '\$1' + ':' + '\$2');" . "\r\n" . ' }' . "\r\n" . ' e.target.value = rString.slice(0, 17).toUpperCase();' . "\r\n" . ' });' . "\r\n" . ' evaluatePair();' . "\r\n" . ' $("#no_expire").trigger("change");' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . 'var rBouquets = [];' . "\r\n\t\t\t\t" . '$("#datatable-bouquets tr.selected").each(function() {' . "\r\n\t\t\t\t\t" . 'rBouquets.push($(this).find("td:eq(0)").text());' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#bouquets_selected").val(JSON.stringify(rBouquets));' . "\r\n\t\t\t\t" . "\$(\"#allowed_ips option\").prop('selected', true);" . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/enigma_mass.php b/src/admin/enigma_mass.php index e6ec7e06..491db49b 100644 --- a/src/admin/enigma_mass.php +++ b/src/admin/enigma_mass.php @@ -424,12 +424,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n" . ' searchDelay: 250,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n" . ' '; echo ' d.id = "enigmas",' . "\r\n" . ' '; echo "\t\t\t\t\t\t" . 'd.filter = getFilter(),' . "\r\n\t\t\t\t\t\t" . 'd.reseller = getReseller()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,5,7,8]},' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [1,3,6,9]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; @@ -438,6 +433,11 @@ include 'header.php'; echo $_['start_typing']; echo "...'," . "\r\n\t\t\t" . ' width: "100%"' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#m_message_type").trigger("change");' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . 'var rBouquets = [];' . "\r\n\t\t\t\t" . '$("#datatable-bouquets tr.selected").each(function() {' . "\r\n\t\t\t\t\t" . 'rBouquets.push($(this).find("td:eq(0)").text());' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#bouquets_selected").val(JSON.stringify(rBouquets));' . "\r\n\t\t\t\t" . '$("#devices_selected").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one device to edit.");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/enigmas.php b/src/admin/enigmas.php index 6e697afc..2ef1fa94 100644 --- a/src/admin/enigmas.php +++ b/src/admin/enigmas.php @@ -227,12 +227,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "'; echo $_['device_delete_confirm']; echo '",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "convert") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Convert",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to conver this Device to a User Line?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=enigma&sub=" + rType + "&e2_id=" + rID, function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("'; @@ -277,6 +272,11 @@ include 'header.php'; ?> echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . '});' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-users").css("width", "100%");' . "\r\n\t\t\t" . "\$('#e2_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#e2_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#e2_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#e2_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#e2_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#e2_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#e2_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#e2_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#e2_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#e2_reseller').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#e2_reseller").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("owner", $("#e2_reseller").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("owner");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "if (\$('#e2_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#e2_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-users").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/epg.php b/src/admin/epg.php index ee97a31f..c3c08d4a 100644 --- a/src/admin/epg.php +++ b/src/admin/epg.php @@ -245,12 +245,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - $(document).ready(function() { $("#datatable").DataTable({ language: { @@ -279,6 +273,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/epg_view.php b/src/admin/epg_view.php index 7bfab958..8f24ea7f 100644 --- a/src/admin/epg_view.php +++ b/src/admin/epg_view.php @@ -297,12 +297,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/epgs.php b/src/admin/epgs.php index 1887bffd..9eb99866 100644 --- a/src/admin/epgs.php +++ b/src/admin/epgs.php @@ -204,12 +204,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' order: [[ 4, "desc" ]],' . "\r\n" . ' columnDefs: [' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/episode.php b/src/admin/episode.php index 7b930ff7..659029db 100644 --- a/src/admin/episode.php +++ b/src/admin/episode.php @@ -671,13 +671,8 @@ include 'footer.php'; ?> } } }); - - - $(document).ready(function() { - initSearch(); - }); - - 0) {" . "\r\n" . " \$(\"#target_container\").val(rExtension).trigger('change');" . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $("#movie_subtitles").val("s:" + $("#server_id").val() + ":" + window.currentDirectory + rFile);' . "\r\n" . ' }' . "\r\n" . ' $.magnificPopup.close();' . "\r\n" . ' }' . "\r\n" . ' function openImage(elem) {' . "\r\n" . ' rPath = $(elem).parent().parent().find("input").val();' . "\r\n\t\t\t" . 'if (rPath) {' . "\r\n" . ' $.magnificPopup.open({' . "\r\n" . ' items: {' . "\r\n" . " src: 'resize?maxw=512&maxh=512&url=' + encodeURIComponent(rPath)," . "\r\n" . " type: 'image'" . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n\t\t\t" . '}' . "\r\n" . ' }' . "\r\n" . ' function clearSearch() {' . "\r\n" . ' $("#search").val("");' . "\r\n" . ' $("#doSearch").click();' . "\r\n" . ' }' . "\r\n" . ' $(document).ready(function() {' . "\r\n" . " \$('select').select2({width: '100%'});" . "\r\n" . ' $("#datatable").DataTable({' . "\r\n" . ' responsive: false,' . "\r\n" . ' paging: false,' . "\r\n" . ' bInfo: false,' . "\r\n" . ' searching: false,' . "\r\n" . ' scrollY: "250px",' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n" . ' columnDefs: [' . "\r\n" . ' {"className": "dt-center", "targets": [0]},' . "\r\n" . ' ],' . "\r\n" . ' "language": {' . "\r\n" . ' "emptyTable": ""' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' $("#datatable-files").DataTable({' . "\r\n" . ' responsive: false,' . "\r\n" . ' paging: false,' . "\r\n" . ' bInfo: false,' . "\r\n" . ' searching: true,' . "\r\n" . ' scrollY: "250px",' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n" . ' columnDefs: [' . "\r\n" . ' {"className": "dt-center", "targets": [0]},' . "\r\n" . ' ],' . "\r\n" . ' "language": {' . "\r\n" . ' "emptyTable": "'; echo $_['no_compatible_file']; echo '"' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' $("#doSearch").click(function() {' . "\r\n" . " \$('#datatable-files').DataTable().search(\$(\"#search\").val()).draw();" . "\r\n" . ' })' . "\r\n" . ' $("#direct_source").change(function() {' . "\r\n" . ' evaluateDirectSource();' . "\r\n" . ' });' . "\r\n" . ' $("#direct_proxy").change(function() {' . "\r\n" . ' evaluateDirectSource();' . "\r\n" . ' });' . "\r\n" . ' $("#movie_symlink").change(function() {' . "\r\n" . ' evaluateSymlink();' . "\r\n" . ' });' . "\r\n" . ' $("#stream_source").change(function() {' . "\r\n\t\t\t\t" . 'checkSymlink();' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'function evaluateDirectSource() {' . "\r\n\t\t\t\t" . '$(["movie_symlink", "read_native", "transcode_profile_id", "remove_subtitles", "movie_subtitles"]).each(function(rID, rElement) {' . "\r\n\t\t\t\t\t" . 'if ($(rElement)) {' . "\r\n\t\t\t\t\t\t" . 'if ($("#direct_source").is(":checked")) {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'setSwitch(window.rSwitches[rElement], false);' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].disable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", true);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].enable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", false);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '});' . "\r\n" . ' $(["direct_proxy"]).each(function(rID, rElement) {' . "\r\n\t\t\t\t\t" . 'if ($(rElement)) {' . "\r\n\t\t\t\t\t\t" . 'if (!$("#direct_source").is(":checked")) {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'setSwitch(window.rSwitches[rElement], false);' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].disable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", true);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].enable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", false);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t" . '}' . "\r\n" . ' function checkSymlink() {' . "\r\n" . ' if (($("#movie_symlink").is(":checked")) && (!$("#stream_source").val().startsWith("s:")) && (!$("#stream_source").val().startsWith("/"))) {' . "\r\n" . ' $.toast("Please ensure the source is a local file before symlinking.");' . "\r\n" . ' setSwitch(window.rSwitches["movie_symlink"], false);' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t\t" . 'function evaluateSymlink() {' . "\r\n" . ' if ($("#direct_source").is(":checked")) { return; }' . "\r\n" . ' checkSymlink();' . "\r\n" . ' $(["direct_source", "read_native", "remove_subtitles", "target_container", "transcode_profile_id", "movie_subtitles"]).each(function(rID, rElement) {' . "\r\n" . ' if ($(rElement)) {' . "\r\n" . ' if ($("#movie_symlink").is(":checked")) {' . "\r\n" . ' if (window.rSwitches[rElement]) {' . "\r\n" . ' setSwitch(window.rSwitches[rElement], false);' . "\r\n" . ' window.rSwitches[rElement].disable();' . "\r\n" . ' } else {' . "\r\n" . ' $("#" + rElement).prop("disabled", true);' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' if (window.rSwitches[rElement]) {' . "\r\n" . ' window.rSwitches[rElement].enable();' . "\r\n" . ' } else {' . "\r\n" . ' $("#" + rElement).prop("disabled", false);' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' $("#select_folder").click(function() {' . "\r\n" . ' $("#season_folder").val(window.currentDirectory);' . "\r\n" . ' $("#server").val($("#server_id").val());' . "\r\n" . ' rID = 1;' . "\r\n" . ' rNames = {};' . "\r\n" . ' $("#episode_add").html("");' . "\r\n" . ' $("#datatable-files").DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {' . "\r\n" . ' var data = this.data();' . "\r\n" . " rExt = data[1].split('.').pop().toLowerCase();" . "\r\n" . ' if (["mp4", "mkv", "mov", "avi", "mpg", "mpeg", "flv", "wmv", "m4v"].includes(rExt)) {' . "\r\n" . " \$(\"#episode_add\").append('
' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n\t\t"; } +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -echo ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n\t\t" . '' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' ' . "\r\n" . ' '; -if (!isset($_SETUP)): + @@ -670,8 +710,7 @@ if (!isset($_SETUP)): } function initSearch() { - $(".dropdown").unbind("click"); - $(".dropdown").click(function() { + $(".dropdown").unbind("click").click(function() { if ($(this).attr("id") == "search-mobile") { if ($("#topnav-search").hasClass("active")) { $(".quick_search").select2("close"); @@ -687,10 +726,9 @@ if (!isset($_SETUP)): } } }); - $(".quick_search").unbind("select2:opening"); - $(".quick_search").unbind("select2:closing"); - $(".quick_search").unbind("select2:selecting"); - $(".quick_search").unbind("select2:draw"); + + // Инициализация Select2 с AJAX + $(".quick_search").unbind("select2:opening select2:closing select2:selecting select2:draw"); $(".quick_search").select2({ ajax: { url: './api', @@ -723,8 +761,8 @@ if (!isset($_SETUP)): if (rMaxWidth < 600) { $("#header_stats").hide(); } - $(".app-search").width(600); } + $(".app-search").width(600); window.rSearchTop = 0; }).on("select2:closing", function(e) { $(".bigdrop .select2-results__options li").remove(); diff --git a/src/admin/group.php b/src/admin/group.php index 96a15f73..bf917a32 100644 --- a/src/admin/group.php +++ b/src/admin/group.php @@ -602,12 +602,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - function togglePackages() { $("#datatable-packages tr").each(function() { if ($(this).hasClass('selected')) { @@ -816,6 +810,11 @@ include 'footer.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/groups.php b/src/admin/groups.php index 379dec0f..16a152bf 100644 --- a/src/admin/groups.php +++ b/src/admin/groups.php @@ -224,12 +224,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' order: [[ 1, "asc" ]],' . "\r\n" . ' columnDefs: [' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/header.php b/src/admin/header.php index 058def0e..c9bbf4e9 100644 --- a/src/admin/header.php +++ b/src/admin/header.php @@ -236,10 +236,20 @@
- +
-

+

diff --git a/src/admin/hmac.php b/src/admin/hmac.php index 4ff13849..67c3db1f 100644 --- a/src/admin/hmac.php +++ b/src/admin/hmac.php @@ -216,13 +216,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function generateCode() { var result = ''; var characters = 'ABCDEF0123456789'; @@ -242,6 +235,11 @@ include 'footer.php'; ?> generateCode(); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/hmacs.php b/src/admin/hmacs.php index be2bb5a2..5419ee73 100644 --- a/src/admin/hmacs.php +++ b/src/admin/hmacs.php @@ -204,12 +204,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { @@ -262,6 +257,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/ip.php b/src/admin/ip.php index bea4b01e..6eb1b8e1 100644 --- a/src/admin/ip.php +++ b/src/admin/ip.php @@ -196,12 +196,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - $(document).ready(function() { $("form").submit(function(e) { @@ -210,6 +205,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/ips.php b/src/admin/ips.php index 1166dea8..57478d23 100644 --- a/src/admin/ips.php +++ b/src/admin/ips.php @@ -204,18 +204,18 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' order: [[ 3, "desc" ]],' . "\r\n" . ' columnDefs: [' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/isp.php b/src/admin/isp.php index eea57c52..06acb440 100644 --- a/src/admin/isp.php +++ b/src/admin/isp.php @@ -204,12 +204,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - $(document).ready(function() { $("form").submit(function(e) { @@ -218,6 +213,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/isps.php b/src/admin/isps.php index 58401d6e..c4826166 100644 --- a/src/admin/isps.php +++ b/src/admin/isps.php @@ -194,12 +194,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { @@ -253,6 +248,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/line.php b/src/admin/line.php index 78195680..7bec209b 100644 --- a/src/admin/line.php +++ b/src/admin/line.php @@ -509,12 +509,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/line_activity.php b/src/admin/line_activity.php index f3c0af8b..d5eab2a3 100644 --- a/src/admin/line_activity.php +++ b/src/admin/line_activity.php @@ -249,12 +249,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/line_ips.php b/src/admin/line_ips.php index 32b3da1b..2a0ea875 100644 --- a/src/admin/line_ips.php +++ b/src/admin/line_ips.php @@ -217,12 +217,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - $(document).ready(function() { $('select').select2({ width: '100%' @@ -258,6 +253,11 @@ include 'header.php'; rTable.search($(this).val()).draw(); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/line_mass.php b/src/admin/line_mass.php index be7bfa40..4f5a158b 100644 --- a/src/admin/line_mass.php +++ b/src/admin/line_mass.php @@ -463,16 +463,16 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n" . ' searchDelay: 250,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "lines",' . "\r\n\t\t\t\t\t\t" . 'd.filter = getFilter(),' . "\r\n\t\t\t\t\t\t" . 'd.reseller = getReseller()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,4,6,7,9,10]},' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [2,5,8,11,12]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . 'bTable = $("#datatable-bouquets").DataTable({' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,3]}' . "\r\n\t\t\t\t" . '],' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rBouquets) !== -1) {' . "\r\n\t\t\t\t\t\t" . "\$(row).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'paging: false,' . "\r\n\t\t\t\t" . 'bInfo: false,' . "\r\n\t\t\t\t" . 'searching: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#user_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#reseller_search').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#filter').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-mass").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSelected), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '$("#selected_count").html(" - " + window.rSelected.length + " selected")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-bouquets").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rBouquets.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rBouquets), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rBouquets.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'if (!$("#c_bouquets").is(":checked")) {' . "\r\n\t\t\t\t\t\t" . "\$(\"#c_bouquets\").prop('checked', true);" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . 'var rBouquets = [];' . "\r\n\t\t\t\t" . '$("#datatable-bouquets tr.selected").each(function() {' . "\r\n\t\t\t\t\t" . 'rBouquets.push($(this).find("td:eq(0)").text());' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#bouquets_selected").val(JSON.stringify(rBouquets));' . "\r\n\t\t\t\t" . '$("#users_selected").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one user to edit.");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/lines.php b/src/admin/lines.php index 14767259..396b2c3f 100644 --- a/src/admin/lines.php +++ b/src/admin/lines.php @@ -244,12 +244,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this line?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "kill") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections for this line?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=line&sub=" + rType + "&user_id=" + rID, function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("Line has been deleted.");' . "\r\n" . ' } else if (rType == "enable") {' . "\r\n" . ' $.toast("Line has been enabled.");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' $.toast("Line has been disabled.");' . "\r\n" . ' } else if (rType == "unban") {' . "\r\n" . ' $.toast("Line has been unbanned.");' . "\r\n" . ' } else if (rType == "ban") {' . "\r\n" . ' $.toast("Line has been banned.");' . "\r\n" . ' } else if (rType == "kill") {' . "\r\n" . ' $.toast("All connections for this line have been killed.");' . "\r\n" . ' }' . "\r\n" . ' $("#datatable-users").DataTable().ajax.reload(null, false);' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-users tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these lines?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=line&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "ban") {' . "\r\n" . ' $.toast("Lines have been banned.");' . "\r\n" . ' } else if (rType == "unban") {' . "\r\n" . ' $.toast("Lines have been unbanned.");' . "\r\n" . ' } else if (rType == "enable") {' . "\r\n" . ' $.toast("Lines have been enabled.");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' $.toast("Lines have been disabled.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Lines have been deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' $("#datatable-users").DataTable().ajax.reload(null, false);' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function openDownload(username, password) {' . "\r\n\t\t\t" . '$("#download_type").val("").trigger("change");' . "\r\n" . ' $("#output_type").val("").trigger("change");' . "\r\n\t\t\t" . '$("#download_button").attr("disabled", true);' . "\r\n\t\t\t" . "\$('.downloadModal').data('username', username);" . "\r\n\t\t\t" . "\$('.downloadModal').data('password', password);" . "\r\n\t\t\t" . "\$('.downloadModal').modal('show');" . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function doDownload() {' . "\r\n\t\t\t" . 'if ($("#download_url").val()) {' . "\r\n\t\t\t\t" . 'window.open($("#download_url").val());' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function copyDownload() {' . "\r\n\t\t\t" . '$("#download_url").select();' . "\r\n\t\t\t" . 'document.execCommand("copy");' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getFilter() {' . "\r\n\t\t\t" . 'return $("#user_filter").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getReseller() {' . "\r\n\t\t\t" . 'return $("#user_reseller").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#user_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#user_filter').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#user_reseller').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#user_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-users').DataTable().search(\$(\"#user_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-users').DataTable().page.len(\$('#user_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-users\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-users").DataTable().ajax.reload( null, false );' . "\r\n" . ' delParams(["search", "filter", "owner", "page", "entries"]);' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '}' . "\r\n" . ' function clearOwner() {' . "\r\n" . " \$('#user_reseller').val(\"\").trigger('change');" . "\r\n" . ' }' . "\r\n" . ' function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "filter", "owner"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-users").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n" . ' $("#output_type").change(function() {' . "\r\n" . ' $("#download_type").trigger("change");' . "\r\n" . ' });' . "\r\n" . ' $("#download_type").change(function() {' . "\r\n" . ' if ($("#download_type").val()) {' . "\r\n" . ' '; @@ -285,6 +280,11 @@ echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . '});' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n" . " \$('#user_reseller').select2({" . "\r\n\t\t\t" . ' ajax: {' . "\r\n\t\t\t\t" . "url: './api'," . "\r\n\t\t\t\t" . "dataType: 'json'," . "\r\n\t\t\t\t" . 'data: function (params) {' . "\r\n\t\t\t\t" . ' return {' . "\r\n\t\t\t\t\t" . 'search: params.term,' . "\r\n\t\t\t\t\t" . "action: 'reguserlist'," . "\r\n\t\t\t\t\t" . 'page: params.page' . "\r\n\t\t\t\t" . ' };' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processResults: function (data, params) {' . "\r\n\t\t\t\t" . ' params.page = params.page || 1;' . "\r\n\t\t\t\t" . ' return {' . "\r\n\t\t\t\t\t" . 'results: data.items,' . "\r\n\t\t\t\t\t" . 'pagination: {' . "\r\n\t\t\t\t\t\t" . 'more: (params.page * 100) < data.total_count' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . ' };' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'cache: true,' . "\r\n\t\t\t\t" . 'width: "100%"' . "\r\n\t\t\t" . ' },' . "\r\n\t\t\t" . " placeholder: 'Search for an owner...'" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-users").css("width", "100%");' . "\r\n\t\t\t" . "\$('#user_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#user_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#user_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#user_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#user_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#user_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#user_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#user_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#user_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#user_reseller').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#user_reseller").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("owner", $("#user_reseller").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("owner");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "if (\$('#user_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#user_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-users").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/live_connections.php b/src/admin/live_connections.php index 7ec97e6d..df870184 100644 --- a/src/admin/live_connections.php +++ b/src/admin/live_connections.php @@ -283,12 +283,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/login_logs.php b/src/admin/login_logs.php index 378acc51..8c104342 100644 --- a/src/admin/login_logs.php +++ b/src/admin/login_logs.php @@ -175,12 +175,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - function api(rID, rType, rConfirm = false) { if ((rType == "block") && (!rConfirm)) { @@ -244,6 +239,11 @@ window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable").DataTable().ajax.params())); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mag.php b/src/admin/mag.php index 85ead8b6..782a32a0 100644 --- a/src/admin/mag.php +++ b/src/admin/mag.php @@ -494,12 +494,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo $_['search_user']; echo "'" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t\r\n\t\t\t" . '$("#datatable-bouquets").DataTable({' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,3]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rBouquets) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n\t\t\t\t" . 'paging: false,' . "\r\n\t\t\t\t" . 'bInfo: false,' . "\r\n\t\t\t\t" . 'searching: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-bouquets").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . " if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n" . " \$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' window.rBouquets.splice(parseInt($.inArray($(ui.selected).find("td:eq(0)").text()), window.rBouquets), 1);' . "\r\n" . ' } else { ' . "\r\n" . " \$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n" . ' window.rBouquets.push(parseInt($(ui.selected).find("td:eq(0)").text()));' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#no_expire").change(function() {' . "\r\n\t\t\t\t" . 'if ($(this).prop("checked")) {' . "\r\n\t\t\t\t\t" . '$("#exp_date").prop("disabled", true);' . "\r\n\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t" . '$("#exp_date").removeAttr("disabled");' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#add_ip").click(function() {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . ' if (($("#ip_field").val()) && (isValidIP($("#ip_field").val()))) {' . "\r\n" . ' var o = new Option($("#ip_field").val(), $("#ip_field").val());' . "\r\n" . ' $("#allowed_ips").append(o);' . "\r\n" . ' $("#ip_field").val("");' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("Please enter a valid IP address.");' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#remove_ip").click(function() {' . "\r\n" . ' if (!$("#pair_id").val()) {' . "\r\n" . " \$('#allowed_ips option:selected').remove();" . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#pair_id").change(function() {' . "\r\n" . ' evaluatePair();' . "\r\n" . ' });' . "\r\n" . ' $("#mac").on("input", function(e) {' . "\r\n" . ' var rRegex = /([a-f0-9]{2})([a-f0-9]{2})/i, rString = e.target.value.replace(/[^a-f0-9]/ig, "");' . "\r\n" . ' while (rRegex.test(rString)) {' . "\r\n" . " rString = rString.replace(rRegex, '\$1' + ':' + '\$2');" . "\r\n" . ' }' . "\r\n" . ' e.target.value = rString.slice(0, 17).toUpperCase();' . "\r\n" . ' });' . "\r\n" . ' evaluatePair();' . "\r\n" . ' $("#no_expire").trigger("change");' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . 'var rBouquets = [];' . "\r\n\t\t\t\t" . '$("#datatable-bouquets tr.selected").each(function() {' . "\r\n\t\t\t\t\t" . 'rBouquets.push($(this).find("td:eq(0)").text());' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#bouquets_selected").val(JSON.stringify(rBouquets));' . "\r\n\t\t\t\t" . "\$(\"#allowed_ips option\").prop('selected', true);" . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mag_events.php b/src/admin/mag_events.php index 787b0f80..e533c198 100644 --- a/src/admin/mag_events.php +++ b/src/admin/mag_events.php @@ -173,12 +173,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "mag_events";' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,1,4]}' . "\r\n\t\t\t\t" . ']' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mag_mass.php b/src/admin/mag_mass.php index 3ff27303..ae874c5f 100644 --- a/src/admin/mag_mass.php +++ b/src/admin/mag_mass.php @@ -504,12 +504,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n" . ' searchDelay: 250,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n" . ' '; echo "\t\t\t\t\t\t" . 'd.id = "mags",' . "\r\n" . ' '; echo "\t\t\t\t\t\t" . 'd.filter = getFilter(),' . "\r\n\t\t\t\t\t\t" . 'd.reseller = getReseller()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,5,7,8]},' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [1,3,6,9]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; @@ -519,6 +514,11 @@ include 'header.php'; ?> echo "...'," . "\r\n\t\t\t" . ' width: "100%"' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#m_message_type").trigger("change");' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . 'var rBouquets = [];' . "\r\n\t\t\t\t" . '$("#datatable-bouquets tr.selected").each(function() {' . "\r\n\t\t\t\t\t" . 'rBouquets.push($(this).find("td:eq(0)").text());' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#bouquets_selected").val(JSON.stringify(rBouquets));' . "\r\n\t\t\t\t" . '$("#devices_selected").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one device to edit.");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mags.php b/src/admin/mags.php index d8cd7541..9990bc27 100644 --- a/src/admin/mags.php +++ b/src/admin/mags.php @@ -223,12 +223,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "'; echo $_['device_delete_confirm']; echo '",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "convert") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Convert",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to conver this Device to a User Line?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=mag&sub=" + rType + "&mag_id=" + rID, function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("'; @@ -285,6 +280,11 @@ include 'header.php'; echo $_['mag_toast_4']; echo '.");' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '});' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "if (\$('#mag_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#mag_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-users").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mass_delete.php b/src/admin/mass_delete.php index dd8acda5..c0bd9caf 100644 --- a/src/admin/mass_delete.php +++ b/src/admin/mass_delete.php @@ -826,12 +826,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#enigma_search').keyup(function(){" . "\r\n\t\t\t\t" . 'eTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#enigma_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'eTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#enigma_reseller_search').change(function(){" . "\r\n\t\t\t\t" . 'eTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#enigma_filter').change(function(){" . "\r\n\t\t\t\t" . 'eTable.ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-md1").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rStreams.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rStreams), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rStreams.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#datatable-md6").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rRadios.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rRadios), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rRadios.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-md2").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rMovies.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rMovies), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rMovies.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-md4").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSeries.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSeries), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSeries.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-md5").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rEpisodes.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rEpisodes), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rEpisodes.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-md3").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rLines.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rLines), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rLines.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#datatable-md7").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rUsers.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rUsers), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rUsers.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#datatable-md8").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rMAGs.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rMAGs), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rMAGs.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#datatable-md9").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rEnigmas.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rEnigmas), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rEnigmas.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/movie.php b/src/admin/movie.php index 5f6c406e..310c41f2 100644 --- a/src/admin/movie.php +++ b/src/admin/movie.php @@ -771,12 +771,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {" . "\r\n\t\t\t\t\t" . "\$(\"#target_container\").val(rExtension).trigger('change');" . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#movie_subtitles").val("s:" + $("#server_id").val() + ":" + window.currentDirectory + rFile);' . "\r\n\t\t\t" . '}' . "\r\n\t\t\t" . '$.magnificPopup.close();' . "\r\n\t\t" . '}' . "\r\n" . ' function openYouTube(elem) {' . "\r\n" . ' rPath = $(elem).parent().parent().find("input").val();' . "\r\n" . ' if (rPath) {' . "\r\n" . ' $.magnificPopup.open({' . "\r\n" . ' items: {' . "\r\n" . " src: 'http://www.youtube.com/watch?v=' + rPath," . "\r\n" . " type: 'iframe'" . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n\t\t" . 'function openImage(elem) {' . "\r\n\t\t\t" . 'rPath = $(elem).parent().parent().find("input").val();' . "\r\n\t\t\t" . 'if (rPath) {' . "\r\n" . ' $.magnificPopup.open({' . "\r\n" . ' items: {' . "\r\n" . " src: 'resize?maxw=512&maxh=512&url=' + encodeURIComponent(rPath)," . "\r\n" . " type: 'image'" . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearSearch() {' . "\r\n\t\t\t" . '$("#search").val("");' . "\r\n\t\t\t" . '$("#doSearch").click();' . "\r\n\t\t" . '}' . "\r\n" . ' function addStream(rName, rURL) {' . "\r\n" . ' $("#stream_source").val(rURL);' . "\r\n" . ' $("#stream_display_name").val(rName).trigger("change");' . "\r\n" . ' $(".bs-provider-movies-modal-center").modal("hide");' . "\r\n\t\t" . '}' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n" . ' $("#category_id").select2({' . "\r\n" . " width: '100%'," . "\r\n" . ' tags: true' . "\r\n" . ' }).on("change", function(e) {' . "\r\n" . " rData = \$('#category_id').select2('data');" . "\r\n" . ' rAdded = [];' . "\r\n" . ' for (i = 0; i < rData.length; i++) {' . "\r\n" . ' if (!rData[i].selected) {' . "\r\n" . ' rAdded.push(rData[i].text);' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' if (rAdded.length > 0) {' . "\r\n" . ' $("#category_create").show();' . "\r\n" . " \$(\"#category_new\").html(rAdded.join(', '));" . "\r\n" . ' } else {' . "\r\n" . ' $("#category_create").hide();' . "\r\n" . ' }' . "\r\n" . ' $("#category_create_list").val(JSON.stringify(rAdded));' . "\r\n" . ' });' . "\r\n" . ' $("#bouquets").select2({' . "\r\n" . " width: '100%'," . "\r\n" . ' tags: true' . "\r\n" . ' }).on("change", function(e) {' . "\r\n" . " rData = \$('#bouquets').select2('data');" . "\r\n" . ' rAdded = [];' . "\r\n" . ' for (i = 0; i < rData.length; i++) {' . "\r\n" . ' if (!rData[i].selected) {' . "\r\n" . ' rAdded.push(rData[i].text);' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' if (rAdded.length > 0) {' . "\r\n" . ' $("#bouquet_create").show();' . "\r\n" . " \$(\"#bouquet_new\").html(rAdded.join(', '));" . "\r\n" . ' } else {' . "\r\n" . ' $("#bouquet_create").hide();' . "\r\n" . ' }' . "\r\n" . ' $("#bouquet_create_list").val(JSON.stringify(rAdded));' . "\r\n" . ' });' . "\r\n\t\t\t" . '$("#datatable").DataTable({' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'paging: false,' . "\r\n\t\t\t\t" . 'bInfo: false,' . "\r\n\t\t\t\t" . 'searching: false,' . "\r\n\t\t\t\t" . 'scrollY: "250px",' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0]},' . "\r\n\t\t\t\t" . '],' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n\t\t\t\t" . '"language": {' . "\r\n\t\t\t\t\t" . '"emptyTable": ""' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-files").DataTable({' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'paging: false,' . "\r\n\t\t\t\t" . 'bInfo: false,' . "\r\n\t\t\t\t" . 'searching: true,' . "\r\n\t\t\t\t" . 'scrollY: "250px",' . "\r\n" . ' drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' },' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0]},' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"language": {' . "\r\n\t\t\t\t\t" . '"emptyTable": "'; echo $_['no_compatible_file']; echo '"' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#doSearch").click(function() {' . "\r\n\t\t\t\t" . "\$('#datatable-files').DataTable().search(\$(\"#search\").val()).draw();" . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#select_folder").click(function() {' . "\r\n\t\t\t\t" . '$("#import_folder").val("s:" + $("#server_id").val() + ":" + window.currentDirectory);' . "\r\n\t\t\t\t" . '$.magnificPopup.close();' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#changeDir").click(function() {' . "\r\n\t\t\t\t" . '$("#search").val("");' . "\r\n\t\t\t\t" . 'window.currentDirectory = $("#current_path").val();' . "\r\n\t\t\t\t" . 'if (window.currentDirectory.substr(-1) != "/") {' . "\r\n\t\t\t\t\t" . 'window.currentDirectory += "/";' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '$("#current_path").val(window.currentDirectory);' . "\r\n\t\t\t\t" . '$("#datatable").DataTable().clear();' . "\r\n\t\t\t\t" . '$("#datatable").DataTable().row.add(["", "'; @@ -834,6 +829,11 @@ include 'header.php'; echo "\t\t\t\t" . "\$(\"#server_tree_data\").val(JSON.stringify(\$('#server_tree').jstree(true).get_json('source', {flat:true})));" . "\r\n" . ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/movie_mass.php b/src/admin/movie_mass.php index 7cd01c2f..1a584086 100644 --- a/src/admin/movie_mass.php +++ b/src/admin/movie_mass.php @@ -442,12 +442,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "movie_list",' . "\r\n\t\t\t\t\t\t" . 'd.category = getCategory(),' . "\r\n\t\t\t\t\t\t" . 'd.filter = getFilter(),' . "\r\n" . ' d.server = getServer()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,1,5,6]},' . "\r\n" . ' {"orderable": false, "targets": [1,6]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . "\$(row).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; @@ -458,6 +453,11 @@ echo '")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' echo $_['select_at_least_one_movie']; echo '");' . "\r\n" . ' rSubmit = false;' . "\r\n\t\t\t\t" . '}' . "\r\n" . ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/movies.php b/src/admin/movies.php index 5abbe6e6..5be16137 100644 --- a/src/admin/movies.php +++ b/src/admin/movies.php @@ -293,12 +293,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {' . "\r\n" . ' $.getJSON("./table?" + $.param($("#datatable-streampage").DataTable().ajax.params()) + "&refresh=" + rStreamIDs[0].join(","), function(rTable) {' . "\r\n" . ' if (!window.rProcessing) {' . "\r\n" . ' $(rTable.data).each(function(rIndex, rItem) {' . "\r\n" . ' for (i in rUpdateColumns) {' . "\r\n" . ' var rIndex = rStreamIDs[0].indexOf($(rItem[0]).text());' . "\r\n" . ' if (rIndex >= 0) {' . "\r\n" . " if (\$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data() != rItem[rUpdateColumns[i]]) {" . "\r\n" . " \$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data(rItem[rUpdateColumns[i]]);" . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' bindHref(); refreshTooltips(false);' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' clearTimeout(window.rRefresh);' . "\r\n" . ' window.rRefresh = setTimeout(refreshInformation, 5000);' . "\r\n" . ' }' . "\r\n\t\t" . 'function api(rID, rServerID, rType, rConfirm=false) {' . "\r\n" . ' if ((window.rSelected) && (window.rSelected.length > 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "'; echo $_['movie_delete_confirm']; echo '",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rServerID == "kill") && (!rConfirm)) {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' rServerID = -1;' . "\r\n" . ' rType = "kill";' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=movie&sub=" + rType + "&stream_id=" + rID + "&server_id=" + rServerID, function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("'; @@ -348,6 +343,11 @@ include 'header.php'; echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . "}).on('processing.dt', function (e, settings, processing) {" . "\r\n" . ' window.rProcessing = processing;' . "\r\n" . ' });' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-streampage").css("width", "100%");' . "\r\n\t\t\t" . "\$('#movies_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#movies_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#movies_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#movies_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#movies_category_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_category_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("category", $("#movies_category_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("category");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#movies_server').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_server").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("server", $("#movies_server").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("server");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#movies_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#movies_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#movies_audio').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_audio").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("audio", $("#movies_audio").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("audio");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#movies_video').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_video").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("video", $("#movies_video").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("video");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#movies_resolution').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#movies_resolution").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("resolution", $("#movies_resolution").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("resolution");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "if (\$('#movies_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#movies_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-streampage").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/mysql_syslog.php b/src/admin/mysql_syslog.php index 90f6d73f..74f099da 100644 --- a/src/admin/mysql_syslog.php +++ b/src/admin/mysql_syslog.php @@ -171,12 +171,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - function api(rID, rType, rConfirm = false) { if ((rType == "block") && (!rConfirm)) { @@ -240,6 +235,11 @@ window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable").DataTable().ajax.params())); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/ondemand.php b/src/admin/ondemand.php index 18a7638f..7991e4e3 100644 --- a/src/admin/ondemand.php +++ b/src/admin/ondemand.php @@ -213,12 +213,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/package.php b/src/admin/package.php index 2dc7f194..e0dbb973 100644 --- a/src/admin/package.php +++ b/src/admin/package.php @@ -465,14 +465,7 @@ include 'header.php'; ?> } } }); - - - $(document).ready(function() { - initSearch(); - }); - - var rBouquets = []; var rGroups = []; @@ -660,6 +653,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/packages.php b/src/admin/packages.php index 2b5f14ed..8ec5fe83 100644 --- a/src/admin/packages.php +++ b/src/admin/packages.php @@ -214,12 +214,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' order: [[ 1, "asc" ]],' . "\r\n" . ' columnDefs: [' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/panel_logs.php b/src/admin/panel_logs.php index 29691b9f..50520ee8 100644 --- a/src/admin/panel_logs.php +++ b/src/admin/panel_logs.php @@ -173,12 +173,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function sendErrors(rConfirm = false) { if (!rConfirm) { new jBox("Confirm", { @@ -257,6 +252,11 @@ include 'header.php'; sendErrors(); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/plex.php b/src/admin/plex.php index bbcac0e9..73674f8f 100644 --- a/src/admin/plex.php +++ b/src/admin/plex.php @@ -221,12 +221,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function disableAll(rConfirm = false) { if (!rConfirm) { @@ -347,6 +342,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/plex_add.php b/src/admin/plex_add.php index a4c40d8c..4691258d 100644 --- a/src/admin/plex_add.php +++ b/src/admin/plex_add.php @@ -436,12 +436,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function evaluateDirectSource() { $(["read_native", "movie_symlink", "auto_encode", "auto_upgrade", "remove_subtitles", "target_container", "transcode_profile_id"]).each(function(rID, rElement) { @@ -504,6 +499,11 @@ include 'header.php'; return /^\d*$/.test(value); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/process_monitor.php b/src/admin/process_monitor.php index 9a84dc6c..156d2ef5 100644 --- a/src/admin/process_monitor.php +++ b/src/admin/process_monitor.php @@ -427,12 +427,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo (intval($rSettings['default_entries']) ?: 10); echo ',' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n\t\t\t" . "\$('#live_search').keyup(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().search(\$(this).val()).draw();" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#live_show_entries').change(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().page.len(\$(this).val()).draw();" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#live_filter').change(function(){" . "\r\n\t\t\t\t" . 'navigate("./process_monitor?server=" + $(this).val());' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#datatable-activity').DataTable().search(\$('#live_search').val()).draw();" . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/profile.php b/src/admin/profile.php index e0b5c0ba..26b60191 100644 --- a/src/admin/profile.php +++ b/src/admin/profile.php @@ -442,12 +442,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - $(document).ready(function() { @@ -522,6 +517,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/profiles.php b/src/admin/profiles.php index b135c2a7..705aa48e 100644 --- a/src/admin/profiles.php +++ b/src/admin/profiles.php @@ -228,12 +228,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n" . ' order: [[ 1, "asc" ]],' . "\r\n" . ' columnDefs: [' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/provider.php b/src/admin/provider.php index a4b35cdf..c6ae0a8c 100644 --- a/src/admin/provider.php +++ b/src/admin/provider.php @@ -323,12 +323,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - function copyURL(rURL) { $("#stream_url").val(rURL); @@ -383,6 +378,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/providers.php b/src/admin/providers.php index 01be4299..a639928c 100644 --- a/src/admin/providers.php +++ b/src/admin/providers.php @@ -231,12 +231,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - function api(rID, rType, rConfirm = false) { @@ -293,6 +288,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/proxies.php b/src/admin/proxies.php index 1224df87..1805db80 100644 --- a/src/admin/proxies.php +++ b/src/admin/proxies.php @@ -252,12 +252,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this proxy server?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "kill") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections to this proxy?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "disable") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Disable",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to disable this proxy?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "update") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Update",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to update this proxy? It will go offline until the update is completed.",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=proxy&sub=" + rType + "&server_id=" + rID, function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' if (rRow = findRowByID($("#datatable").DataTable(), 0, rID)) {' . "\r\n" . ' $("#datatable").DataTable().rows(rRow).remove().draw(false);' . "\r\n" . ' }' . "\r\n" . ' $.toast("Proxy successfully deleted.");' . "\r\n" . ' } else if (rType == "kill") {' . "\r\n" . ' $.toast("All proxy connections have been killed.");' . "\r\n" . ' } else if (rType == "update") {' . "\r\n" . ' $.toast("Updating proxy server...");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' reloadPage();' . "\r\n" . ' } else if (rType == "enable") {' . "\r\n" . ' reloadPage();' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if (rType == "tools") {' . "\r\n" . ' $(".bs-server-modal-center").data("id", "[" + window.rSelected.join(",") + "]");' . "\r\n" . ' $(".bs-server-modal-center").modal("show");' . "\r\n" . ' $("#reinstall_server").prop("disabled", true);' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these proxies?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "enable") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Enable",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to enable these proxies?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "disable") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Disable",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to disable these proxies?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=proxy&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Proxies have been deleted.");' . "\r\n" . ' } else if (rType == "enable") {' . "\r\n" . ' $.toast("Proxies have been enabled.");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' $.toast("Proxies have been disabled.");' . "\r\n" . ' }' . "\r\n" . ' reloadPage();' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function bindServers() {' . "\r\n" . ' $("#reinstall_server").unbind();' . "\r\n" . ' $("#reinstall_server").click(function() {' . "\r\n" . " navigate('./server_install?id=' + \$(\".bs-server-modal-center\").data(\"id\") + \"&proxy=1\");" . "\r\n" . ' });' . "\r\n" . ' $("#restart_services_ssh").unbind();' . "\r\n" . ' $("#restart_services_ssh").click(function() {' . "\r\n" . ' $(".bs-server-modal-center").modal("hide");' . "\r\n" . ' $.getJSON("./api?action=restart_services&server_id=" + $(".bs-server-modal-center").data("id"), function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' $.toast("XC_VM will be restarted shortly.");' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' $(".bs-server-modal-center").data("id", "");' . "\r\n" . ' });' . "\r\n" . ' });' . "\r\n" . ' $("#reboot_server_ssh").unbind();' . "\r\n" . ' $("#reboot_server_ssh").click(function() {' . "\r\n" . ' $(".bs-server-modal-center").modal("hide");' . "\r\n" . ' $.getJSON("./api?action=reboot_server&server_id=" + $(".bs-server-modal-center").data("id"), function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' $.toast("Server will be rebooted shortly.");' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' $(".bs-server-modal-center").data("id", "");' . "\r\n" . ' });' . "\r\n" . ' });' . "\r\n" . ' $(".btn-reboot-server").click(function() {' . "\r\n" . ' $(".bs-server-modal-center").data("id", $(this).data("id"));' . "\r\n" . ' $(".bs-server-modal-center").modal("show");' . "\r\n" . ' });' . "\r\n" . ' $("#update_server").prop("disabled", true);' . "\r\n" . ' $("#update_binaries").prop("disabled", true);' . "\r\n" . ' }' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . '$("#datatable").DataTable({' . "\r\n\t\t\t\t" . 'language: {' . "\r\n\t\t\t\t\t" . 'paginate: {' . "\r\n\t\t\t\t\t\t" . "previous: \"\"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' bindServers();' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n" . ' '; if (!hasPermissions('adv', 'edit_server')) { @@ -267,6 +262,11 @@ include 'header.php'; echo "\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/proxy.php b/src/admin/proxy.php index 3c83f72e..2e6a8145 100644 --- a/src/admin/proxy.php +++ b/src/admin/proxy.php @@ -355,13 +355,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function MoveUp() { var rSelected = $('#domain_name option:selected'); if (rSelected.length) { @@ -413,6 +406,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/queue.php b/src/admin/queue.php index 1c89d828..564fad03 100644 --- a/src/admin/queue.php +++ b/src/admin/queue.php @@ -173,16 +173,16 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "queue";' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,3,4,5]}' . "\r\n\t\t\t\t" . '],' . "\r\n" . ' order: [[ 0, "asc" ]]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/quick_tools.php b/src/admin/quick_tools.php index b861af9d..d3533fc0 100644 --- a/src/admin/quick_tools.php +++ b/src/admin/quick_tools.php @@ -659,13 +659,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $("input[type='submit']").click(function(event) { event.preventDefault(); @@ -684,6 +677,11 @@ include 'header.php'; e.preventDefault(); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/radio.php b/src/admin/radio.php index 77e06100..17ac99d7 100644 --- a/src/admin/radio.php +++ b/src/admin/radio.php @@ -508,18 +508,18 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {' . "\r\n" . ' $("#category_create").show();' . "\r\n" . " \$(\"#category_new\").html(rAdded.join(', '));" . "\r\n" . ' } else {' . "\r\n" . ' $("#category_create").hide();' . "\r\n" . ' }' . "\r\n" . ' $("#category_create_list").val(JSON.stringify(rAdded));' . "\r\n" . ' });' . "\r\n" . ' $("#bouquets").select2({' . "\r\n" . " width: '100%'," . "\r\n" . ' tags: true' . "\r\n" . ' }).on("change", function(e) {' . "\r\n" . " rData = \$('#bouquets').select2('data');" . "\r\n" . ' rAdded = [];' . "\r\n" . ' for (i = 0; i < rData.length; i++) {' . "\r\n" . ' if (!rData[i].selected) {' . "\r\n" . ' rAdded.push(rData[i].text);' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' if (rAdded.length > 0) {' . "\r\n" . ' $("#bouquet_create").show();' . "\r\n" . " \$(\"#bouquet_new\").html(rAdded.join(', '));" . "\r\n" . ' } else {' . "\r\n" . ' $("#bouquet_create").hide();' . "\r\n" . ' }' . "\r\n" . ' $("#bouquet_create_list").val(JSON.stringify(rAdded));' . "\r\n" . ' });' . "\r\n\t\t\t" . '$(".clockpicker").clockpicker();' . "\r\n\t\t\t" . "\$('#server_tree').on('redraw.jstree', function (e, data) {" . "\r\n" . ' evaluateServers();' . "\r\n" . " }).on('select_node.jstree', function (e, data) {" . "\r\n" . ' if (data.node.parent == "offline") {' . "\r\n" . " \$('#server_tree').jstree(\"move_node\", data.node.id, \"#source\", \"last\");" . "\r\n" . ' } else {' . "\r\n" . " \$('#server_tree').jstree(\"move_node\", data.node.id, \"#offline\", \"first\");" . "\r\n" . ' }' . "\r\n" . " }).jstree({ 'core' : {" . "\r\n\t\t\t\t" . "'check_callback': function (op, node, parent, position, more) {" . "\r\n\t\t\t\t\t" . 'switch (op) {' . "\r\n\t\t\t\t\t\t" . "case 'move_node':" . "\r\n\t\t\t\t\t\t\t" . 'if ((node.id == "offline") || (node.id == "source")) { return false; }' . "\r\n" . ' if (parent.id == "#") { return false; }' . "\r\n\t\t\t\t\t\t\t" . 'return true;' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . "'data' : "; echo json_encode(($rServerTree ?: array())); echo "\t\t\t" . '}, "plugins" : [ "dnd" ]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#direct_source").change(function() {' . "\r\n\t\t\t\t" . 'evaluateDirectSource();' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'function evaluateDirectSource() {' . "\r\n\t\t\t\t" . '$(["custom_ffmpeg", "probesize_ondemand", "user_agent", "http_proxy", "cookie", "headers", "days_to_restart", "time_to_restart", "on_demand", "restart_on_edit"]).each(function(rID, rElement) {' . "\r\n\t\t\t\t\t" . 'if ($(rElement)) {' . "\r\n\t\t\t\t\t\t" . 'if ($("#direct_source").is(":checked")) {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'setSwitch(window.rSwitches[rElement], false);' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].disable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", true);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t" . 'if (window.rSwitches[rElement]) {' . "\r\n\t\t\t\t\t\t\t\t" . 'window.rSwitches[rElement].enable();' . "\r\n\t\t\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t\t\t" . '$("#" + rElement).prop("disabled", false);' . "\r\n\t\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t" . '}' . "\r\n\t\t\t" . '$("#probesize_ondemand").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n\t\t\t" . '$("#delay_minutes").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n\t\t\t" . '$("#tv_archive_duration").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n\t\t\t" . 'evaluateDirectSource();' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n" . " \$(\"#server_tree_data\").val(JSON.stringify(\$('#server_tree').jstree(true).get_json('source', {flat:true})));" . "\r\n\t\t\t\t" . 'if ($("#stream_display_name").val().length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("'; echo $_['enter_a_radio_station_name']; echo '");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/radio_mass.php b/src/admin/radio_mass.php index 7efc7705..eb80224f 100644 --- a/src/admin/radio_mass.php +++ b/src/admin/radio_mass.php @@ -504,18 +504,18 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "radio_list",' . "\r\n\t\t\t\t\t\t" . 'd.category = getCategory(),' . "\r\n" . ' d.filter = getFilter(),' . "\r\n" . ' d.server = getServer()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,1,5]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . "\$(row).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo ',' . "\r\n" . ' order: [[ 0, "desc" ]]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#category_search').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#station_server_id').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#station_filter').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-mass").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSelected), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '$("#selected_count").html(" - " + window.rSelected.length + " selected")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . "\$(\"#server_tree_data\").val(JSON.stringify(\$('#server_tree').jstree(true).get_json('source', {flat:true})));" . "\r\n\t\t\t\t" . 'rPass = false;' . "\r\n" . ' rSubmit = true;' . "\r\n\t\t\t\t" . "\$.each(\$('#server_tree').jstree(true).get_json('#', {flat:true}), function(k,v) {" . "\r\n\t\t\t\t\t" . 'if (v.parent == "source") {' . "\r\n\t\t\t\t\t\t" . 'rPass = true;' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#streams").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one stream to edit.");' . "\r\n" . ' rSubmit = false;' . "\r\n\t\t\t\t" . '}' . "\r\n" . ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/radios.php b/src/admin/radios.php index b3d9ff94..79d60634 100644 --- a/src/admin/radios.php +++ b/src/admin/radios.php @@ -250,12 +250,7 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {' . "\r\n" . ' $.getJSON("./table?" + $.param($("#datatable-streampage").DataTable().ajax.params()) + "&refresh=" + rStreamIDs[0].join(","), function(rTable) {' . "\r\n" . ' if (!window.rProcessing) {' . "\r\n" . ' $(rTable.data).each(function(rIndex, rItem) {' . "\r\n" . ' for (i in rUpdateColumns) {' . "\r\n" . ' var rIndex = rStreamIDs[0].indexOf($(rItem[0]).text());' . "\r\n" . ' if (rIndex >= 0) {' . "\r\n" . " if (\$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data() != rItem[rUpdateColumns[i]]) {" . "\r\n" . " \$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data(rItem[rUpdateColumns[i]]);" . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' bindHref(); refreshTooltips(false);' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' clearTimeout(window.rRefresh);' . "\r\n" . ' window.rRefresh = setTimeout(refreshInformation, 5000);' . "\r\n" . ' }' . "\r\n\t\t" . 'function api(rID, rServerID, rType, rConfirm=false) {' . "\r\n" . ' if ((window.rSelected) && (window.rSelected.length > 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this station?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rServerID == "kill") && (!rConfirm)) {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' rServerID = -1;' . "\r\n" . ' rType = "kill";' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=stream&sub=" + rType + "&stream_id=" + rID + "&server_id=" + rServerID, function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Station successfully started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Station successfully stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Station successfully restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Station successfully deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "kill") {' . "\r\n" . ' $.toast("Connection has been killed.");' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-streams-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-sources").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-live-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-live").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-streampage tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these stations?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=radio&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Stations have been started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Stations have been stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Stations have been restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Stations have been deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getCategory() {' . "\r\n\t\t\t" . 'return $("#station_category_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getFilter() {' . "\r\n\t\t\t" . 'return $("#station_filter").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getServer() {' . "\r\n\t\t\t" . 'return $("#station_server_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#station_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#station_filter').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#station_server_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#station_category_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#station_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().search(\$(\"#station_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().page.len(\$('#station_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-streampage\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n" . ' delParams(["search", "server", "filter", "category", "page", "entries"]);' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '}' . "\r\n" . ' function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "server", "category", "filter"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n\t\t\t" . 'var rPage = getParam("page");' . "\r\n" . ' if (!rPage) { rPage = 1; }' . "\r\n" . ' var rEntries = getParam("entries");' . "\r\n" . ' if (!rEntries) { rEntries = '; @@ -295,6 +290,11 @@ echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . "}).on('processing.dt', function (e, settings, processing) {" . "\r\n" . ' window.rProcessing = processing;' . "\r\n" . ' });' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-streampage").css("width", "100%");' . "\r\n\t\t\t" . "\$('#station_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#station_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#station_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#station_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#station_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#station_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#station_category_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#station_category_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("category", $("#station_category_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("category");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#station_server_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#station_server_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("server", $("#station_server_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("server");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#station_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#station_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#station_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "if (\$('#station_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#station_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-streampage").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/record.php b/src/admin/record.php index e03f001a..d5507dbe 100644 --- a/src/admin/record.php +++ b/src/admin/record.php @@ -384,12 +384,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo ' $("#duration").inputFilter(function(value) { return /^\\d*$/.test(value); });' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/restream_logs.php b/src/admin/restream_logs.php index 0ebcf794..d06b7c93 100644 --- a/src/admin/restream_logs.php +++ b/src/admin/restream_logs.php @@ -184,16 +184,16 @@ } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "restream_logs";' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [3,4,5]},' . "\r\n" . ' {"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n" . ' order: [[ 4, "desc" ]]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable").css("width", "100%");' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/review.php b/src/admin/review.php index 9d5760ac..6638083d 100644 --- a/src/admin/review.php +++ b/src/admin/review.php @@ -833,13 +833,8 @@ include 'header.php'; } } }); - - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/rtmp_ip.php b/src/admin/rtmp_ip.php index 78d06a3c..be8c92b7 100644 --- a/src/admin/rtmp_ip.php +++ b/src/admin/rtmp_ip.php @@ -248,13 +248,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $('#password').pwstrength(); $("form").submit(function(e) { @@ -263,6 +256,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/rtmp_ips.php b/src/admin/rtmp_ips.php index 752f054d..9004bc4a 100644 --- a/src/admin/rtmp_ips.php +++ b/src/admin/rtmp_ips.php @@ -217,13 +217,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { new jBox("Confirm", { @@ -276,6 +269,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/rtmp_monitor.php b/src/admin/rtmp_monitor.php index 64532430..41cedfc2 100644 --- a/src/admin/rtmp_monitor.php +++ b/src/admin/rtmp_monitor.php @@ -321,18 +321,18 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '},' . "\r\n\t\t\t\t\t" . 'infoFiltered: ""' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'order: [[ 0, "asc" ]],' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo ',' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n\t\t\t" . "\$('#live_search').keyup(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().search(\$(this).val()).draw();" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#live_show_entries').change(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().page.len(\$(this).val()).draw();" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#live_filter').change(function(){" . "\r\n\t\t\t\t" . 'navigate("./rtmp_monitor?server=" + $(this).val());' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#datatable-activity').DataTable().search(\$('#live_search').val()).draw();" . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/serie.php b/src/admin/serie.php index 3c1d48a2..d39ca661 100644 --- a/src/admin/serie.php +++ b/src/admin/serie.php @@ -589,13 +589,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - var changeTitle = false; function selectDirectory(elem) { @@ -1025,6 +1018,11 @@ include 'header.php'; }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/series.php b/src/admin/series.php index a85b86db..107200c0 100644 --- a/src/admin/series.php +++ b/src/admin/series.php @@ -233,12 +233,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this series and all episodes?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=series&sub=" + rType + "&series_id=" + rID, function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("Series successfully deleted.");' . "\r\n" . ' }' . "\r\n" . ' $("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-streampage tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these streams?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=series&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("Streams have been deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function openImage(elem) {' . "\r\n\t\t\t" . 'rPath = $(elem).data("src");' . "\r\n\t\t\t" . 'if (rPath) {' . "\r\n" . ' $.magnificPopup.open({' . "\r\n" . ' items: {' . "\r\n" . ' src: rPath,' . "\r\n" . " type: 'image'" . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getCategory() {' . "\r\n\t\t\t" . 'return $("#series_category_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#series_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#series_category_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#series_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().search(\$(\"#series_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().page.len(\$('#series_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-streampage\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n" . ' delParams(["search", "category", "page", "entries"]);' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '}' . "\r\n" . ' function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "category"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n\t\t\t" . 'var rPage = getParam("page");' . "\r\n" . ' if (!rPage) { rPage = 1; }' . "\r\n" . ' var rEntries = getParam("entries");' . "\r\n" . ' if (!rEntries) { rEntries = '; @@ -270,6 +265,11 @@ include 'header.php'; echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . '});' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-streampage").css("width", "100%");' . "\r\n\t\t\t" . "\$('#series_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#series_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#series_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#series_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#series_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#series_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#series_category_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#series_category_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("category", $("#series_category_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("category");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "if (\$('#series_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#series_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-streampage").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/series_mass.php b/src/admin/series_mass.php index a572140c..32e9f0ab 100644 --- a/src/admin/series_mass.php +++ b/src/admin/series_mass.php @@ -334,18 +334,18 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "series_list",' . "\r\n\t\t\t\t\t\t" . 'd.category = getCategory()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,1,4,5,6,7,8]},' . "\r\n\t\t\t\t\t" . '{"orderable": false, "targets": [1,6]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . "\$(row).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo ',' . "\r\n" . ' order: [[ 0, "desc" ]]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#category_search').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#filter').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-mass").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSelected), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '$("#selected_count").html(" - " + window.rSelected.length + " selected")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . '$("#series").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one stream to edit.");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/server.php b/src/admin/server.php index 24ba9e6f..92846084 100644 --- a/src/admin/server.php +++ b/src/admin/server.php @@ -774,13 +774,6 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function MoveUp() { var rSelected = $('#domain_name option:selected'); if (rSelected.length) { @@ -873,6 +866,11 @@ include 'header.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/server_install.php b/src/admin/server_install.php index 63469a21..0e397bbc 100644 --- a/src/admin/server_install.php +++ b/src/admin/server_install.php @@ -333,12 +333,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo "\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/server_order.php b/src/admin/server_order.php index a7c93ef9..2db36a1f 100644 --- a/src/admin/server_order.php +++ b/src/admin/server_order.php @@ -220,12 +220,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - $(document).ready(function() { $("#server_items").nestable({ @@ -238,6 +232,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("#server_form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/server_view.php b/src/admin/server_view.php index c3798a78..329f64ad 100644 --- a/src/admin/server_view.php +++ b/src/admin/server_view.php @@ -504,12 +504,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - function getInstallStatus() { @@ -918,6 +913,11 @@ include 'header.php'; ?> }; (rNetworkChart = new ApexCharts(document.querySelector("#network_chart"), rNetworkOptions)).render(); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/servers.php b/src/admin/servers.php index 93eb9e14..6d454d24 100644 --- a/src/admin/servers.php +++ b/src/admin/servers.php @@ -403,12 +403,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - var rSelected = []; function updateAll(rConfirm = false) { @@ -823,6 +817,11 @@ include 'header.php'; }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/settings.php b/src/admin/settings.php index 0688754c..1efad43e 100644 --- a/src/admin/settings.php +++ b/src/admin/settings.php @@ -2426,13 +2426,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $('select').select2({ width: '100%' @@ -2676,6 +2669,11 @@ include 'footer.php'; ?> } }); }; + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/settings_plex.php b/src/admin/settings_plex.php index fbaeb500..e3edada0 100644 --- a/src/admin/settings_plex.php +++ b/src/admin/settings_plex.php @@ -387,13 +387,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $("#scan_seconds").inputFilter(function(value) { return /^\d*$/.test(value); @@ -416,6 +409,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream.php b/src/admin/stream.php index 7e94f3b0..4e6ff62c 100644 --- a/src/admin/stream.php +++ b/src/admin/stream.php @@ -1010,12 +1010,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer);' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_categories.php b/src/admin/stream_categories.php index ac427057..b2e55ddc 100644 --- a/src/admin/stream_categories.php +++ b/src/admin/stream_categories.php @@ -268,13 +268,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function deleteCategory(rID) { new jBox("Confirm", { confirmButton: "Delete", @@ -330,6 +323,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("#stream_categories_form-4")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_category.php b/src/admin/stream_category.php index 5c5fbc84..86611f80 100644 --- a/src/admin/stream_category.php +++ b/src/admin/stream_category.php @@ -282,12 +282,7 @@ include 'header.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' });' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_errors.php b/src/admin/stream_errors.php index 5fc7e1d0..3698745e 100644 --- a/src/admin/stream_errors.php +++ b/src/admin/stream_errors.php @@ -209,13 +209,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function getServer() { return $("#server").val(); } @@ -339,6 +332,11 @@ include 'header.php'; window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-activity").DataTable().ajax.params())); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_mass.php b/src/admin/stream_mass.php index aa03e8d5..9d221071 100644 --- a/src/admin/stream_mass.php +++ b/src/admin/stream_mass.php @@ -314,18 +314,18 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "stream_list",' . "\r\n\t\t\t\t\t\t" . 'd.category = getCategory(),' . "\r\n" . ' d.filter = getFilter(),' . "\r\n" . ' d.server = getServer()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,1,5]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . "\$(row).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo ',' . "\r\n" . ' order: [[ 0, "desc" ]]' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#stream_filter').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#stream_server_id').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#category_search').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-mass").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSelected), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '$("#selected_count").html(" - " + window.rSelected.length + " selected")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . "\$(\"#server_tree_data\").val(JSON.stringify(\$('#server_tree').jstree(true).get_json('source', {flat:true})));" . "\r\n\t\t\t\t" . 'rPass = false;' . "\r\n" . ' rSubmit = true;' . "\r\n\t\t\t\t" . "\$.each(\$('#server_tree').jstree(true).get_json('#', {flat:true}), function(k,v) {" . "\r\n\t\t\t\t\t" . 'if (v.parent == "source") {' . "\r\n\t\t\t\t\t\t" . 'rPass = true;' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '});' . "\r\n\t\t\t\t" . '$("#streams").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one stream to edit.");' . "\r\n" . ' rSubmit = false;' . "\r\n\t\t\t\t" . '}' . "\r\n" . ' if (rSubmit) {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n\t\t\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_rank.php b/src/admin/stream_rank.php index 2e629b2f..1a93d0f1 100644 --- a/src/admin/stream_rank.php +++ b/src/admin/stream_rank.php @@ -234,16 +234,16 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '},' . "\r\n\t\t\t\t\t" . 'infoFiltered: ""' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,3,4]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"order": [[ 0, "asc" ]],' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n" . " \$('#log_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_review.php b/src/admin/stream_review.php index 1654adef..1cc385a4 100644 --- a/src/admin/stream_review.php +++ b/src/admin/stream_review.php @@ -391,12 +391,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_tools.php b/src/admin/stream_tools.php index 61cb5a31..48b91c83 100644 --- a/src/admin/stream_tools.php +++ b/src/admin/stream_tools.php @@ -333,13 +333,6 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - - function decryptText() { var rText = $("#encrypted_text").val(); $("#decrypted_text").val(""); @@ -371,6 +364,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("#move_form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/stream_view.php b/src/admin/stream_view.php index 1f08bdc9..8c75a76b 100644 --- a/src/admin/stream_view.php +++ b/src/admin/stream_view.php @@ -724,12 +724,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - echo "\t\t\t\t" . '],' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'setTimeout(reloadStream, 5000);' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/streams.php b/src/admin/streams.php index aa451bff..0b33c669 100644 --- a/src/admin/streams.php +++ b/src/admin/streams.php @@ -457,12 +457,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - 0) {' . "\r\n" . ' $.getJSON("./table?" + $.param($("#datatable-streampage").DataTable().ajax.params()) + "&refresh=" + rStreamIDs[0].join(","), function(rTable) {' . "\r\n" . ' if (!window.rProcessing) {' . "\r\n" . ' $(rTable.data).each(function(rIndex, rItem) {' . "\r\n" . ' for (i in rUpdateColumns) {' . "\r\n" . ' var rIndex = rStreamIDs[0].indexOf($(rItem[0]).text());' . "\r\n" . ' if (rIndex >= 0) {' . "\r\n" . " if (\$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data() != rItem[rUpdateColumns[i]]) {" . "\r\n" . " \$('#datatable-streampage').DataTable().cell(rStreamIDs[1][rIndex], rUpdateColumns[i]).data(rItem[rUpdateColumns[i]]);" . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' bindHref(); refreshTooltips(false);' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }' . "\r\n" . ' clearTimeout(window.rRefresh);' . "\r\n" . ' window.rRefresh = setTimeout(refreshInformation, 5000);' . "\r\n" . ' }' . "\r\n\t\t" . 'function api(rID, rServerID, rType, rConfirm=false) {' . "\r\n" . ' if ((window.rSelected) && (window.rSelected.length > 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this stream?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rServerID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rServerID == "kill") && (!rConfirm)) {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' rServerID = -1;' . "\r\n" . ' rType = "kill";' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=stream&sub=" + rType + "&stream_id=" + rID + "&server_id=" + rServerID, function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Stream successfully started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Stream successfully stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Stream successfully restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Stream successfully deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "kill") {' . "\r\n" . ' $.toast("Connection has been killed.");' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-streams-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-sources").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' if ($(".bs-live-modal-center").is(":visible")) {' . "\r\n" . ' $("#datatable-live").DataTable().ajax.reload( null, false );' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-streampage tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these streams?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n" . ' } else if ((rType == "purge") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Kill",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to kill all connections?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=stream&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "start") {' . "\r\n" . ' $.toast("Streams have been started.");' . "\r\n" . ' } else if (rType == "stop") {' . "\r\n" . ' $.toast("Streams have been stopped.");' . "\r\n" . ' } else if (rType == "restart") {' . "\r\n" . ' $.toast("Streams have been restarted.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Streams have been deleted.");' . "\r\n" . ' refreshTable();' . "\r\n" . ' } else if (rType == "purge") {' . "\r\n" . ' $.toast("Connections have been killed.");' . "\r\n" . ' }' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function player(rID) {' . "\r\n\t\t\t" . '$.magnificPopup.open({' . "\r\n\t\t\t\t" . 'items: {' . "\r\n\t\t\t\t\t" . 'src: "./player?type=live&id=" + rID,' . "\r\n\t\t\t\t\t" . "type: 'iframe'" . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getCategory() {' . "\r\n\t\t\t" . 'return $("#stream_category_id").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getFilter() {' . "\r\n\t\t\t" . 'return $("#stream_filter").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getServer() {' . "\r\n\t\t\t" . 'return $("#stream_server_id").val();' . "\r\n\t\t" . '}' . "\r\n" . ' function getVideo() {' . "\r\n\t\t\t" . 'return $("#stream_video").val();' . "\r\n\t\t" . '}' . "\r\n" . ' function getAudio() {' . "\r\n\t\t\t" . 'return $("#stream_audio").val();' . "\r\n\t\t" . '}' . "\r\n" . ' function getResolution() {' . "\r\n\t\t\t" . 'return $("#stream_resolution").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#stream_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_filter').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_server_id').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_category_id').val(\"\").trigger('change');" . "\r\n" . " \$('#stream_audio').val(\"\").trigger('change');" . "\r\n" . " \$('#stream_video').val(\"\").trigger('change');" . "\r\n" . " \$('#stream_resolution').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#stream_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().search(\$(\"#stream_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-streampage').DataTable().page.len(\$('#stream_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-streampage\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t" . 'delParams(["search", "server", "filter", "category", "page", "entries", "video", "audio", "resolution"]);' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "server", "category", "filter", "video", "audio", "resolution"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-streampage").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n" . ' var rPage = getParam("page");' . "\r\n" . ' if (!rPage) { rPage = 1; }' . "\r\n" . ' var rEntries = getParam("entries");' . "\r\n" . ' if (!rEntries) { rEntries = '; @@ -502,6 +497,11 @@ include 'footer.php'; ?> echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . "}).on('processing.dt', function (e, settings, processing) {" . "\r\n" . ' window.rProcessing = processing;' . "\r\n" . ' });' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-streampage").css("width", "100%");' . "\r\n\t\t\t" . "\$('#stream_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#stream_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#stream_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#stream_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_category_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_category_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("category", $("#stream_category_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("category");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_server_id').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_server_id").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("server", $("#stream_server_id").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("server");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#stream_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#stream_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#stream_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . " \$('#stream_audio').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#stream_audio").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("audio", $("#stream_audio").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("audio");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#stream_video').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#stream_video").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("video", $("#stream_video").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("video");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#stream_resolution').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n" . ' if ($("#stream_resolution").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("resolution", $("#stream_resolution").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("resolution");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "if (\$('#stream_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#stream_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-streampage").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/theft_detection.php b/src/admin/theft_detection.php index 77fe7e40..86e6eab5 100644 --- a/src/admin/theft_detection.php +++ b/src/admin/theft_detection.php @@ -221,16 +221,16 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '},' . "\r\n\t\t\t\t\t" . 'infoFiltered: ""' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,2,3]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"order": [[ 2, "desc" ]],' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n" . " \$('#log_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/ticket.php b/src/admin/ticket.php index 568fd9dd..f305f993 100644 --- a/src/admin/ticket.php +++ b/src/admin/ticket.php @@ -156,13 +156,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $('select.select2').select2({ width: '100%' @@ -173,6 +166,11 @@ include 'footer.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/tickets.php b/src/admin/tickets.php index 2fb9b5c7..69f2169e 100644 --- a/src/admin/tickets.php +++ b/src/admin/tickets.php @@ -199,13 +199,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { new jBox("Confirm", { @@ -249,6 +242,11 @@ include 'footer.php'; ?> }); $("#tickets-table").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/user.php b/src/admin/user.php index c2304740..22c29f29 100644 --- a/src/admin/user.php +++ b/src/admin/user.php @@ -288,14 +288,7 @@ include 'header.php'; } } }); - - - $(document).ready(function() { - initSearch(); - }); - - - + function clearOwner() { $('#owner_id').val("").trigger('change'); } @@ -341,6 +334,11 @@ include 'header.php'; submitForm(window.rCurrentPage, new FormData($("form")[0]), window.rReferer); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/user_logs.php b/src/admin/user_logs.php index c42d1037..0399970f 100644 --- a/src/admin/user_logs.php +++ b/src/admin/user_logs.php @@ -172,18 +172,18 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '},' . "\r\n\t\t\t\t\t" . 'infoFiltered: ""' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "reg_user_logs",' . "\r\n\t\t\t\t\t\t" . 'd.range = getRange(),' . "\r\n\t\t\t\t\t\t" . 'd.reseller = getReseller(),' . "\r\n" . ' d.filter = getFilter()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [4,5,6]},' . "\r\n" . ' {"visible": false, "targets": [0]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"order": [[ 6, "desc" ]],' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . '$("#datatable-activity").css("width", "100%");' . "\r\n\t\t\t" . "\$('#log_search').keyup(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().search(\$(this).val()).draw();" . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . "\$('#datatable-activity').DataTable().page.len(\$(this).val()).draw();" . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#reseller').change(function(){" . "\r\n\t\t\t\t" . '$("#datatable-activity").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n" . " \$('#filter').change(function(){" . "\r\n\t\t\t\t" . '$("#datatable-activity").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-activity").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/user_mass.php b/src/admin/user_mass.php index 45e39a40..a7984424 100644 --- a/src/admin/user_mass.php +++ b/src/admin/user_mass.php @@ -215,16 +215,16 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n" . ' $("#datatable-mass a").removeAttr("href");' . "\r\n" . ' bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n" . ' searchDelay: 250,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "reg_users",' . "\r\n\t\t\t\t\t\t" . 'd.filter = getFilter(),' . "\r\n\t\t\t\t\t\t" . 'd.reseller = getReseller()' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,4,5,6,7]},' . "\r\n\t\t\t\t\t" . '{"visible": false, "targets": [3,8,9,10,11,12]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . '"rowCallback": function(row, data) {' . "\r\n\t\t\t\t\t" . 'if ($.inArray(data[0], window.rSelected) !== -1) {' . "\r\n\t\t\t\t\t\t" . '$(row).addClass("selected");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'pageLength: '; echo (intval($rSettings['default_entries']) ?: 10); echo "\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#user_search').keyup(function(){" . "\r\n\t\t\t\t" . 'rTable.search($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#show_entries').change(function(){" . "\r\n\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#reseller_search').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload(null, false);' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . "\$('#filter').change(function(){" . "\r\n\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t" . '})' . "\r\n\t\t\t" . '$("#datatable-mass").selectable({' . "\r\n\t\t\t\t" . "filter: 'tr'," . "\r\n\t\t\t\t" . 'selected: function (event, ui) {' . "\r\n\t\t\t\t\t" . "if (\$(ui.selected).hasClass('selectedfilter')) {" . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.splice($.inArray($(ui.selected).find("td:eq(0)").text(), window.rSelected), 1);' . "\r\n\t\t\t\t\t" . '} else { ' . "\r\n\t\t\t\t\t\t" . "\$(ui.selected).addClass('selectedfilter').addClass('ui-selected').addClass(\"selected\");" . "\r\n\t\t\t\t\t\t" . 'window.rSelected.push($(ui.selected).find("td:eq(0)").text());' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . '$("#selected_count").html(" - " + window.rSelected.length + " selected")' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n" . " \$(\".orinput\").on('keyup', function() {" . "\r\n" . ' if (($(this).val().length > 0) && (!$("#c_override").is(":checked"))) {' . "\r\n" . " \$(\"#c_override\").prop('checked', true);" . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' $("form").submit(function(e){' . "\r\n" . ' e.preventDefault();' . "\r\n\t\t\t\t" . '$("#users_selected").val(JSON.stringify(window.rSelected));' . "\r\n\t\t\t\t" . 'if (window.rSelected.length == 0) {' . "\r\n\t\t\t\t\t" . '$.toast("Select at least one user to edit.");' . "\r\n\t\t\t\t" . '} else {' . "\r\n" . " \$(':input[type=\"submit\"]').prop('disabled', true);" . "\r\n" . ' submitForm(window.rCurrentPage, new FormData($("form")[0]));' . "\r\n" . ' }' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n\t\t"; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/useragent.php b/src/admin/useragent.php index 31dd1c9c..059c504c 100644 --- a/src/admin/useragent.php +++ b/src/admin/useragent.php @@ -202,13 +202,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - $(document).ready(function() { $("form").submit(function(e) { e.preventDefault(); @@ -216,6 +209,11 @@ include 'footer.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/useragents.php b/src/admin/useragents.php index c245dfc1..ac4f29d4 100644 --- a/src/admin/useragents.php +++ b/src/admin/useragents.php @@ -179,13 +179,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function api(rID, rType, rConfirm = false) { if ((rType == "delete") && (!rConfirm)) { new jBox("Confirm", { @@ -238,6 +231,11 @@ include 'footer.php'; ?> }); $("#datatable").css("width", "100%"); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/users.php b/src/admin/users.php index 8d68f7e1..6b1be3b5 100644 --- a/src/admin/users.php +++ b/src/admin/users.php @@ -245,12 +245,7 @@ include 'header.php'; } }); - - $(document).ready(function() { - initSearch(); - }); - - 0)) {' . "\r\n" . ' $.toast("Individual actions disabled in multi-select mode.");' . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete this user?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' api(rID, rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=reg_user&sub=" + rType + "&user_id=" + rID, function(data) {' . "\r\n" . ' if (data.result === true) {' . "\r\n" . ' if (rType == "delete") {' . "\r\n" . ' $.toast("User has been deleted.");' . "\r\n" . ' } else if (rType == "enable") {' . "\r\n" . ' $.toast("User has been enabled.");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' $.toast("User has been disabled.");' . "\r\n" . ' }' . "\r\n" . ' $("#datatable-users").DataTable().ajax.reload(null, false);' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n" . ' function multiAPI(rType, rConfirm=false) {' . "\r\n" . ' if (rType == "clear") {' . "\r\n" . ' if ("#header_stats") {' . "\r\n" . ' $("#header_stats").show();' . "\r\n" . ' }' . "\r\n" . ' window.rSelected = [];' . "\r\n" . ' $(".multiselect").hide();' . "\r\n" . " \$(\"#datatable-users tr\").removeClass('selectedfilter').removeClass('ui-selected').removeClass(\"selected\");" . "\r\n" . ' return;' . "\r\n" . ' }' . "\r\n" . ' if ((rType == "delete") && (!rConfirm)) {' . "\r\n" . ' new jBox("Confirm", {' . "\r\n" . ' confirmButton: "Delete",' . "\r\n" . ' cancelButton: "Cancel",' . "\r\n" . ' content: "Are you sure you want to delete these users?",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' multiAPI(rType, true);' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '} else {' . "\r\n" . ' rConfirm = true;' . "\r\n" . ' }' . "\r\n" . ' if (rConfirm) {' . "\r\n" . ' $.getJSON("./api?action=multi&type=user&sub=" + rType + "&ids=" + JSON.stringify(window.rSelected), function(data) {' . "\r\n" . ' if (data.result == true) {' . "\r\n" . ' if (rType == "enable") {' . "\r\n" . ' $.toast("Users have been enabled.");' . "\r\n" . ' } else if (rType == "disable") {' . "\r\n" . ' $.toast("Users have been disabled.");' . "\r\n" . ' } else if (rType == "delete") {' . "\r\n" . ' $.toast("Users have been deleted.");' . "\r\n" . ' }' . "\r\n" . ' $("#datatable-users").DataTable().ajax.reload(null, false);' . "\r\n" . ' } else {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' }' . "\r\n" . ' }).fail(function() {' . "\r\n" . ' $.toast("An error occured while processing your request.");' . "\r\n" . ' });' . "\r\n" . ' multiAPI("clear");' . "\r\n" . ' }' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getFilter() {' . "\r\n\t\t\t" . 'return $("#reg_filter").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function getReseller() {' . "\r\n\t\t\t" . 'return $("#reg_reseller").val();' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function clearFilters() {' . "\r\n\t\t\t" . 'window.rClearing = true;' . "\r\n\t\t\t" . "\$(\"#reg_search\").val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#reg_filter').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#reg_reseller').val(\"\").trigger('change');" . "\r\n\t\t\t" . "\$('#reg_show_entries').val(\""; echo (intval($rSettings['default_entries']) ?: 10); echo "\").trigger('change');" . "\r\n\t\t\t" . 'window.rClearing = false;' . "\r\n\t\t\t" . "\$('#datatable-users').DataTable().search(\$(\"#reg_search\").val());" . "\r\n\t\t\t" . "\$('#datatable-users').DataTable().page.len(\$('#reg_show_entries').val());" . "\r\n\t\t\t" . "\$(\"#datatable-users\").DataTable().page(0).draw('page');" . "\r\n\t\t\t" . '$("#datatable-users").DataTable().ajax.reload( null, false );' . "\r\n" . ' delParams(["search", "filter", "owner", "page", "entries"]);' . "\r\n\t\t\t" . 'checkClear();' . "\r\n\t\t" . '}' . "\r\n" . ' function checkClear() {' . "\r\n\t\t\t" . 'if (!hasParams(["search", "filter", "owner"])) {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", true);' . "\r\n\t\t\t" . '} else {' . "\r\n\t\t\t\t" . '$("#clearFilters").prop("disabled", false);' . "\r\n\t\t\t" . '}' . "\r\n\t\t" . '}' . "\r\n\t\t" . 'function refreshTable() {' . "\r\n\t\t\t" . '$("#datatable-users").DataTable().ajax.reload( null, false );' . "\r\n\t\t" . '}' . "\r\n" . ' function clearOwner() {' . "\r\n" . " \$('#reg_reseller').val(\"\").trigger('change');" . "\r\n" . ' }' . "\r\n" . ' var rSearch;' . "\r\n\t\t" . '$(document).ready(function() {' . "\r\n\t\t\t" . "\$('select').select2({width: '100%'});" . "\r\n" . " \$('#reg_reseller').select2({" . "\r\n\t\t\t" . ' ajax: {' . "\r\n\t\t\t\t" . "url: './api'," . "\r\n\t\t\t\t" . "dataType: 'json'," . "\r\n\t\t\t\t" . 'data: function (params) {' . "\r\n\t\t\t\t" . ' return {' . "\r\n\t\t\t\t\t" . 'search: params.term,' . "\r\n\t\t\t\t\t" . "action: 'reguserlist'," . "\r\n\t\t\t\t\t" . 'page: params.page' . "\r\n\t\t\t\t" . ' };' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'processResults: function (data, params) {' . "\r\n\t\t\t\t" . ' params.page = params.page || 1;' . "\r\n\t\t\t\t" . ' return {' . "\r\n\t\t\t\t\t" . 'results: data.items,' . "\r\n\t\t\t\t\t" . 'pagination: {' . "\r\n\t\t\t\t\t\t" . 'more: (params.page * 100) < data.total_count' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . ' };' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'cache: true,' . "\r\n\t\t\t\t" . 'width: "100%"' . "\r\n\t\t\t" . ' },' . "\r\n\t\t\t" . " placeholder: 'Search for an owner...'" . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . 'var rPage = getParam("page");' . "\r\n" . ' if (!rPage) { rPage = 1; }' . "\r\n" . ' var rEntries = getParam("entries");' . "\r\n" . ' if (!rEntries) { rEntries = '; @@ -275,6 +270,11 @@ include 'header.php'; echo (in_array(strtolower(CoreUtilities::$rRequest['dir']), array('asc', 'desc')) ? strtolower(CoreUtilities::$rRequest['dir']) : 'desc'); echo '" ]],' . "\r\n\t\t\t\t" . 'pageLength: parseInt(rEntries),' . "\r\n\t\t\t\t" . 'lengthMenu: [10, 25, 50, 250, 500, 1000],' . "\r\n" . ' displayStart: (parseInt(rPage)-1) * parseInt(rEntries)' . "\r\n\t\t\t" . '});' . "\r\n" . ' function doSearch(rValue) {' . "\r\n" . ' clearTimeout(window.rSearch); window.rSearch = setTimeout(function(){ rTable.search(rValue).draw(); }, 500);' . "\r\n" . ' }' . "\r\n\t\t\t" . '$("#datatable-users").css("width", "100%");' . "\r\n\t\t\t" . "\$('#reg_search').keyup(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#reg_search").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("search", $("#reg_search").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("search");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'doSearch($(this).val());' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#reg_show_entries').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#reg_show_entries").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("entries", $("#reg_show_entries").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("entries");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.page.len($(this).val()).draw();' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#reg_filter').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#reg_filter").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("filter", $("#reg_filter").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("filter");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . 'rTable.ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "\$('#reg_reseller').change(function(){" . "\r\n\t\t\t\t" . 'if (!window.rClearing) {' . "\r\n" . ' delParam("page");' . "\r\n" . ' rTable.page(0);' . "\r\n\t\t\t\t\t" . 'if ($("#reg_reseller").val()) {' . "\r\n\t\t\t\t\t\t" . 'setParam("owner", $("#reg_reseller").val());' . "\r\n\t\t\t\t\t" . '} else {' . "\r\n\t\t\t\t\t\t" . 'delParam("owner");' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t\t" . 'checkClear();' . "\r\n\t\t\t\t\t" . '$("#datatable-users").DataTable().ajax.reload( null, false );' . "\r\n\t\t\t\t" . '}' . "\r\n\t\t\t" . '});' . "\r\n\t\t\t" . "if (\$('#reg_search').val()) {" . "\r\n\t\t\t\t" . "rTable.search(\$('#reg_search').val()).draw();" . "\r\n\t\t\t" . '}' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-users").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n" . ' checkClear();' . "\r\n\t\t" . '});' . "\r\n" . ' ' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/watch.php b/src/admin/watch.php index 92001504..b154cdb7 100644 --- a/src/admin/watch.php +++ b/src/admin/watch.php @@ -191,13 +191,6 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - - function disableAll(rConfirm = false) { if (!rConfirm) { new jBox("Confirm", { @@ -317,6 +310,11 @@ include 'footer.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/watch_add.php b/src/admin/watch_add.php index 35582931..6d334756 100644 --- a/src/admin/watch_add.php +++ b/src/admin/watch_add.php @@ -638,14 +638,7 @@ include 'footer.php'; ?> } } }); - - - $(document).ready(function() { - initSearch(); - }); - - - + function selectDirectory(elem) { window.currentDirectory += elem + "/"; $("#selected_path").val(window.currentDirectory); @@ -762,6 +755,11 @@ include 'footer.php'; ?> submitForm(window.rCurrentPage, new FormData($("form")[0])); }); }); + + $(document).ready(function() { + initSearch(); + }); + diff --git a/src/admin/watch_output.php b/src/admin/watch_output.php index 96d1a9e2..7f5af433 100644 --- a/src/admin/watch_output.php +++ b/src/admin/watch_output.php @@ -190,12 +190,7 @@ include 'footer.php'; ?> } }); - - $(document).ready(function() { - initSearch(); - }); - - \"," . "\r\n\t\t\t\t\t\t" . "next: \"\"" . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'drawCallback: function() {' . "\r\n\t\t\t\t\t" . 'bindHref(); refreshTooltips();' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'responsive: false,' . "\r\n\t\t\t\t" . 'processing: true,' . "\r\n\t\t\t\t" . 'serverSide: true,' . "\r\n\t\t\t\t" . 'ajax: {' . "\r\n\t\t\t\t\t" . 'url: "./table",' . "\r\n\t\t\t\t\t" . '"data": function(d) {' . "\r\n\t\t\t\t\t\t" . 'd.id = "watch_output";' . "\r\n\t\t\t\t\t\t" . 'd.server = getServer();' . "\r\n\t\t\t\t\t\t" . 'd.type = getType();' . "\r\n\t\t\t\t\t\t" . 'd.status = getStatus();' . "\r\n\t\t\t\t\t" . '}' . "\r\n\t\t\t\t" . '},' . "\r\n\t\t\t\t" . 'columnDefs: [' . "\r\n\t\t\t\t\t" . '{"className": "dt-center", "targets": [0,4,5,6]},' . "\r\n\t\t\t\t\t" . '{"orderable": false, "targets": [6]}' . "\r\n\t\t\t\t" . '],' . "\r\n\t\t\t\t" . 'order: [[ 5, "desc" ]],' . "\r\n\t\t\t\t" . 'pageLength: '; @@ -204,6 +199,11 @@ include 'footer.php'; ?> echo $_['clear_confirm']; echo '",' . "\r\n" . ' confirm: function () {' . "\r\n" . ' $(".bs-logs-modal-center").modal("hide");' . "\r\n" . ' $.getJSON("./api?action=clear_logs&type=watch_logs&from=" + encodeURIComponent($("#range_clear_from").val()) + "&to=" + encodeURIComponent($("#range_clear_to").val()), function(data) {' . "\r\n" . ' $.toast("Logs have been cleared.");' . "\r\n" . ' $("#datatable-activity").DataTable().ajax.reload( null, false );' . "\r\n" . ' });' . "\r\n" . ' }' . "\r\n" . ' }).open();' . "\r\n\t\t\t" . '});' . "\r\n" . ' $("#btn-export-csv").click(function() {' . "\r\n" . ' $.toast("Generating CSV report...");' . "\r\n" . ' window.location.href = "api?action=report¶ms=" + encodeURIComponent(JSON.stringify($("#datatable-md1").DataTable().ajax.params()));' . "\r\n\t\t\t" . '});' . "\r\n\t\t" . '});' . "\r\n" . ' '; ?> + + $(document).ready(function() { + initSearch(); + }); +