forked from experianplc/Experian-Address-Validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_ua.js
26 lines (24 loc) · 924 Bytes
/
_ua.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Method to handle showing of UA (User Assistance) content
ContactDataServices.ua = {
banner: {
show: function(html){
// Retrieve the existing banner
var banner = document.querySelector(".ua-banner");
// Create a new banner if necessary
if(!banner){
var firstChildElement = document.querySelector("body").firstChild;
banner = document.createElement("div");
banner.classList.add("ua-banner");
firstChildElement.parentNode.insertBefore(banner, firstChildElement.nextSibling);
}
// Apply the HTML content
banner.innerHTML = html;
},
hide: function(){
var banner = document.querySelector(".ua-banner");
if(banner) {
banner.parentNode.removeChild(banner);
}
}
}
};