mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Update ajax handler + indicate status
This commit is contained in:
parent
6299540216
commit
ca7bde25c6
@ -19,7 +19,7 @@ if (isset($_POST['blocklist_id'])) {
|
|||||||
$blocklist = $notracking_url . $file;
|
$blocklist = $notracking_url . $file;
|
||||||
|
|
||||||
exec("sudo /etc/raspap/adblock/update_blocklist.sh $blocklist $file $dnsmasq_config", $return);
|
exec("sudo /etc/raspap/adblock/update_blocklist.sh $blocklist $file $dnsmasq_config", $return);
|
||||||
|
$jsonData = ['return'=>$return];
|
||||||
echo json_encode($return);
|
echo json_encode($jsonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +291,24 @@ function loadChannelSelect(selected) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Updates the selected ad blocklist
|
||||||
|
* Request is passed to an ajax handler to download the associated list
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function updateBlocklist() {
|
||||||
|
var blocklist_id = $('#cbxblocklist').val();
|
||||||
|
if (blocklist_id == '') { return; }
|
||||||
|
$.post('ajax/adblock/update_blocklist.php',{ 'blocklist_id':blocklist_id },function(data){
|
||||||
|
var jsonData = JSON.parse(data);
|
||||||
|
if (jsonData['return'] == '0') {
|
||||||
|
$('#cbxblocklist-status').removeClass('check-hidden').addClass('check-updated').delay(500).animate({ opacity: 1 }, 700);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearBlocklistStatus() {
|
||||||
|
$('#cbxblocklist-status').addClass('check-hidden');
|
||||||
|
}
|
||||||
// Static Array method
|
// Static Array method
|
||||||
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
|
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="input-group col-md-12 mb-4">
|
<div class="input-group col-md-12 mb-4">
|
||||||
<select class="custom-select custom-select-sm" id="cbxblocklist">
|
<select class="custom-select custom-select-sm" id="cbxblocklist" onchange="clearBlocklistStatus()">
|
||||||
<option value=""><?php echo _("Choose a blocklist provider") ?></option>
|
<option value=""><?php echo _("Choose a blocklist provider") ?></option>
|
||||||
<option disabled="disabled"></option>
|
<option disabled="disabled"></option>
|
||||||
<?php echo optionsForSelect(blocklistProviders()) ?>
|
<?php echo optionsForSelect(blocklistProviders()) ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user