Every police alert that Ive tryd the icon is not showing , I read the html and its there
html
any sugestion ?
Every police alert that Ive tryd the icon is not showing , I read the html and its there
html
any sugestion ?
What icon are you talking about?
supposedly next to the alert there should an Icon
Any errors in console while triggering alert?
nop everything is okidoki
I guess something else is messed up cause my code is exactly that one.
$('document').ready(function() {
alerts = {};
window.addEventListener('message', function (event) {
ShowNotif(event.data);
});
function ShowNotif(data) {
var $notification = CreateNotification(data);
$('.notif-container').append($notification);
setTimeout(function() {
$.when($notification.fadeOut()).done(function() {
$notification.remove()
});
}, data.length != null ? data.length : 2500);
}
function CreateNotification(data) {
var $notification = $(document.createElement('div'));
//$notification.addClass('notification').addClass(data.type);
$notification.addClass('notification').addClass(data.style);
//$notification.html(data.text);
$notification.html('\
<div class="content">\
<div id="code">' + data.info["code"] + '</div>\
<div id="alert-name">' + data.info["name"] + '</div>\
<div id="marker"><i class="fas fa-map-marker-alt" aria-hidden="true"></i></div>\
<div id="alert-info"><i class="fas fa-globe-europe"></i>' + data.info["loc"] + '</div>\
</div>');
$notification.fadeIn();
if (data.style !== undefined) {
Object.keys(data.style).forEach(function(css) {
$notification.css(css, data.style[css])
});
}
return $notification;
}
alerts.BaseAlert = function(style, info) {
switch(style) {
case 'ems':
alerts.EMSAlert(info)
break;
case 'police':
alerts.PoPo(info)
break;
}
};
alerts.PoPo = function(info) {
$('.alerts-wrapper').html('\
<div class="alerts police">\
<div class="content">\
<div id="code">' + info["code"] + '</div>\
<div id="alert-name">' + info["name"] + '</div>\
<div id="marker"><i class="fas fa-map-marker-alt" aria-hidden="true"></i></div>\
<div id="alert-info"><i class="fas fa-globe-europe"></i>' + info["loc"] + '</div>\
</div>').fadeIn(1000);
setTimeout(HideAlert, 4500);
};
alerts.EMSAlert = function(info) {
//console.log(info["code"])
$('.alerts-wrapper').html('\
<div class="alerts ems">\
<div class="content">\
<div id="code">' + info["code"] + '</div>\
<div id="alert-name">' + info["name"] + '</div>\
<div id="marker"><i class="fas fa-map-marker-alt" aria-hidden="true"></i></div>\
<div id="alert-info"><i class="fas fa-skull-crossbones"></i> ' + info["loc"] + '</div>\
</div>').fadeIn(1000);
setTimeout(HideAlert, 4500);
};
function HideAlert() {
$('.alerts-wrapper').fadeOut(1000);
};
/*window.addEventListener('message', function(event) {
//console.log(event.data.action + " " + event.data.style)
switch(event.data.action) {
case 'display':
//console.log("We've been called for this one")
alerts.BaseAlert(event.data.style, event.data.info)
break;
}
});*/
});
Will verify
Well that’s strange the Icons won’t show in any of the alerts scripts
For the icons to work you must use your own fontawesome url link. To do that, open up /html/alerts.html and then go onto Line: 7, once you’re on line 7, head towards https://fontawesome.com/ And basically sign up for free, grab the javascript link they provide you and replace the line 7.