Move PHP scripts to scripts folder

This commit is contained in:
Mcat12
2016-12-19 19:44:51 -05:00
committed by DL6ER
parent d0553ef169
commit 2f65430a4d
29 changed files with 15 additions and 15 deletions

View File

@@ -0,0 +1,40 @@
function eventsource() {
var alInfo = $("#alInfo");
var alSuccess = $("#alSuccess");
var ta = $("#output");
var source = new EventSource("php/gravity.sh.php");
ta.html("");
ta.show();
alInfo.show();
alSuccess.hide();
source.addEventListener("message", function(e) {
if(e.data.indexOf("Pi-hole blocking is") !== -1)
{
alSuccess.show();
}
ta.append(e.data);
}, false);
// Will be called when script has finished
source.addEventListener("error", function(e) {
alInfo.delay(1000).fadeOut(2000, function() { alInfo.hide(); });
source.close();
$("#gravityBtn").removeAttr("disabled");
}, false);
}
$("#gravityBtn").on("click", () => {
$("#gravityBtn").attr("disabled", true);
eventsource();
});
// Handle hiding of alerts
$(function(){
$("[data-hide]").on("click", function(){
$(this).closest("." + $(this).attr("data-hide")).hide();
});
});