Skip to content

Instantly share code, notes, and snippets.

@DominikVavra
Last active May 3, 2018 13:53
Show Gist options
  • Save DominikVavra/073f383e3c077ddfed3c638dbe8a4d55 to your computer and use it in GitHub Desktop.
Save DominikVavra/073f383e3c077ddfed3c638dbe8a4d55 to your computer and use it in GitHub Desktop.
Outdatedbrowser included Edge support
var outdatedBrowser=function(t){var o=document.getElementById("outdated");this.defaultOpts={bgColor:"#f25648",color:"#ffffff",lowerThan:"transform",languagePath:"../outdatedbrowser/lang/en.html"},t?("IE8"==t.lowerThan||"borderSpacing"==t.lowerThan?t.lowerThan="borderSpacing":"IE9"==t.lowerThan||"boxShadow"==t.lowerThan?t.lowerThan="boxShadow":"IE10"==t.lowerThan||"transform"==t.lowerThan||""==t.lowerThan||void 0===t.lowerThan?t.lowerThan="transform":"IE11"==t.lowerThan||"borderImage"==t.lowerThan?t.lowerThan="borderImage":"Edge"!=t.lowerThan&&"js:Promise"!=t.lowerThan||(t.lowerThan="js:Promise"),this.defaultOpts.bgColor=t.bgColor,this.defaultOpts.color=t.color,this.defaultOpts.lowerThan=t.lowerThan,this.defaultOpts.languagePath=t.languagePath,bkgColor=this.defaultOpts.bgColor,txtColor=this.defaultOpts.color,cssProp=this.defaultOpts.lowerThan,languagePath=this.defaultOpts.languagePath):(bkgColor=this.defaultOpts.bgColor,txtColor=this.defaultOpts.color,cssProp=this.defaultOpts.lowerThan,languagePath=this.defaultOpts.languagePath);var e,r,l,a=!0;function n(t){var e;e=t,o.style.opacity=e/100,o.style.filter="alpha(opacity="+e+")",1==t&&(o.style.display="block"),100==t&&(a=!0)}if(!(e=document.createElement("div"),r="Khtml Ms O Moz Webkit".split(" "),l=r.length,function(t){if(t in e.style)return!0;for(t=t.replace(/^[a-z]/,function(t){return t.toUpperCase()});l--;)if(r[l]+t in e.style)return!0;return!1})(""+cssProp)){if(a&&"1"!==o.style.opacity){a=!1;for(var s=1;s<=100;s++)setTimeout(function(t){return function(){n(t)}}(s),8*s)}" "===languagePath||0==languagePath.length?u():function(t){var o=function(){var t=!1;if(window.XMLHttpRequest)t=new XMLHttpRequest;else if(window.ActiveXObject)try{t=new ActiveXObject("Msxml2.XMLHTTP")}catch(o){try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(o){t=!1}}return t}();o&&(o.onreadystatechange=function(){!function(t){var o=document.getElementById("outdated");4==t.readyState&&(200==t.status||304==t.status?o.innerHTML=t.responseText:o.innerHTML=i,u())}(o)},o.open("GET",t,!0),o.send(null))}(languagePath);var i='<h6>Your browser is out-of-date!</h6><p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update my browser now </a></p><p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>'}function u(){var t=document.getElementById("btnCloseUpdateBrowser"),e=document.getElementById("btnUpdateBrowser");o.style.backgroundColor=bkgColor,o.style.color=txtColor,o.children[0].style.color=txtColor,o.children[1].style.color=txtColor,e.style.color=txtColor,e.style.borderColor&&(e.style.borderColor=txtColor),t.style.color=txtColor,t.onmousedown=function(){return o.style.display="none",!1},e.onmouseover=function(){this.style.color=bkgColor,this.style.backgroundColor=txtColor},e.onmouseout=function(){this.style.color=txtColor,this.style.backgroundColor=bkgColor}}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment