Update ajax handler + indicate status

This commit is contained in:
billz
2020-03-27 09:24:48 +00:00
parent 6299540216
commit ca7bde25c6
3 changed files with 21 additions and 3 deletions

View File

@@ -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
Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);