Created
February 10, 2022 00:47
-
-
Save 404ryannotfound/2378db31262f357e753d9c95f131e3ee to your computer and use it in GitHub Desktop.
This script displays an alert (if present) for PWS parks, and will allow viewers to view on the Alerts system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8' /> | |
<title>Park Alert</title> | |
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | |
<link href="https://fonts.googleapis.com/css?family=Heebo" rel="stylesheet"> | |
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon" /> | |
<style> | |
html,body{margin:0;padding:0;overflow:hidden}body{margin:0;padding:0;font-family:'Heebo','Helvetica Neue',Arial,Helvetica,sans-serif;position:relative}.qrcode{float:right;width:150px;height:150px;position:absolute;top:0;right:0}.qrcode>img{width:130px;height:130px;float:right;margin:0;border:10px solid #fff;display:block}body{overflow:hidden}section{min-height:150px;background-color:#fff;margin:20px;-webkit-box-shadow:10px 10px 28px 1px rgba(0,0,0,.2);-moz-box-shadow:10px 10px 28px 1px rgba(0,0,0,.2);box-shadow:10px 10px 28px 1px rgba(0,0,0,.2);position:relative}section .fa-times{position:absolute;right:7px;top:7px;font-size:1.3em;cursor:pointer}section .icon{padding:43px;margin-right:30px;float:left}section .icon i{font-size:4em;color:#fff}section h1{font-size:.8em;font-weight:bolder;padding:10px 0;margin:0}section p{font-size:.8em;padding:0;margin:5px 0}.red{color:red}#fail{position:relative}#fail .icon{background-color:#e44b5e;background:linear-gradient(-45deg,#db0087,#bf00db,#db7700,#ce2c00);background-size:400% 400%;animation:gradient 15s ease infinite;color:#fff} | |
@media (min-width:576px){section h1{font-size:1.8em}section p{font-size:1.2em}}@keyframes gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}} | |
</style> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> | |
</head> | |
<body> | |
<div id="dalert" class="alert alert-warning"></div> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> | |
<!--input type="hidden" name="parkId" id="parkId" value="1234"--> | |
<script type="text/javascript"> | |
/* | |
This script displays an alert (if present) for PWS parks, and will allow viewers to view on the Alerts system. | |
If an alert has been issued for the related Park ID, display alert information and a QR code. | |
Usage: Simply embed the script as an IFrame, and append the ParkID to the URl. I.e: park-alerts.html?parkId=1241 | |
Website with park ID's: https://exploreparks.dbca.wa.gov.au/ | |
Alerts system: https://alerts.dbca.wa.gov.au/ | |
*/ | |
//<![CDATA[ | |
jQuery(function() { | |
const urlParams = new URLSearchParams(window.location.search); | |
const pid = urlParams.get('parkId'); | |
//console.log(urlParams + ' - ' + pid); | |
//var pid=$('#parkId').val(); | |
$.ajax({ | |
type: "GET", | |
url: 'https://alerts.dbca.wa.gov.au/api/AlertsApi/park/', | |
data: { //Passing data | |
token: '6e8981e3-7d62-4577-ae47-ab1bd72a51b3', | |
count: true, | |
id: pid | |
}, | |
success: function(response, request) { | |
if (response.count >= 1) { | |
//alert("Active alerts found"); | |
var aid = response.alertId; | |
var qrUrl = "https://dbcacdn.blob.core.windows.net/pica-interactives/PVS-Park-Alerts/qrcode.min.js"; | |
$.getScript(qrUrl, function() { | |
new QRCode(document.getElementById("qrcode"), "https://alerts.dbca.wa.gov.au/home/index#" + aid); | |
}); | |
var alerts = response.count; | |
$('#dalert').html("<section id=\"fail\"><div class=\"icon\"><i class=\"fas fa-exclamation-triangle\" aria-hidden=\"true\"></i></div><h1>ALERT NOTIFICATION</h1><p>" + alerts + " active alert/s found for this park.</p><p><small>Scan the QR code, or visit: <span class=\"red\">https://alerts.dbca.wa.gov.au</span></small></p><div id=\"qrcode\" class=\"qrcode\"></div></section>"); | |
} else { | |
//alert("No active alerts found"); | |
$('#dalert').html(""); | |
} | |
}, | |
dataType: "json" | |
}); | |
}); | |
//]]> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment