Newer
Older
function buckeyeAlert(a){function d(b){var c=b.getElementsByTagName("item");if(c.length){var d=document.createElement("h2");d.className="osu-semantic",d.innerHTML="Emergency alert message";var e=document.createElement("div");e.className=a.messageClass,e.setAttribute("id","buckeye_alert_msg");for(var f=0;f<c.length;f++){var g=c[f].getElementsByTagName("description")[0],h=g.textContent||g.text;"undefined"!=h&&(e.innerHTML+=h)}var i=document.getElementById(a.element_id);i.childNodes[0]?i.insertBefore(e,i.childNodes[0]):i.appendChild(e),i.insertBefore(d,i.childNodes[0]),i.setAttribute("role","alert"),i.removeAttribute("hidden"),i.style.display=a.display,a.callback()}}if("undefined"==typeof a&&(a=new Object),"undefined"==typeof a.element_id&&(a.element_id="buckeye_alert"),"undefined"==typeof a.url&&(a.url="//www.osu.edu/feeds/emergency-alert.rss"),"undefined"==typeof a.callback&&(a.callback=function(){}),"undefined"==typeof a.displayType&&(a.display="block"),window.XDomainRequest){var b=new XDomainRequest;b.open("GET",a.url),b.onprogress=function(){},b.ontimeout=function(){},b.onerror=function(){},b.onload=function(){var a;if(window.DOMParser){var c=new window.DOMParser;a=c.parseFromString(b.responseText,"text/xml")}else a=new ActiveXObject("Microsoft.XMLDOM"),a.async=!1,a.loadXML(b.responseText);d(a)},setTimeout(function(){b.send()},0)}else{var c=new XMLHttpRequest;c.onreadystatechange=function(){4==c.readyState&&200==c.status&&d(c.responseXML)},c.open("GET",a.url,!0),c.send()}}