forked from outdatedbrowser/outdated-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutdatedbrowser.min.js
More file actions
executable file
·8 lines (8 loc) · 4 KB
/
outdatedbrowser.min.js
File metadata and controls
executable file
·8 lines (8 loc) · 4 KB
1
2
3
4
5
6
7
8
/*!--------------------------------------------------------------------
JAVASCRIPT "Outdated Browser"
Version: 1.1.2 - 2015
author: Burocratik
website: http://www.burocratik.com
* @preserve
-----------------------------------------------------------------------*/
var outdatedBrowser=function(options){var outdated=document.getElementById("outdated");this.defaultOpts={bgColor:"#f25648",color:"#ffffff",lowerThan:"transform",languagePath:"../outdatedbrowser/lang/en.html"};if(options){if(options.lowerThan=="IE8"||options.lowerThan=="borderSpacing"){options.lowerThan="borderSpacing"}else if(options.lowerThan=="IE9"||options.lowerThan=="boxShadow"){options.lowerThan="boxShadow"}else if(options.lowerThan=="IE10"||options.lowerThan=="transform"||options.lowerThan==""||typeof options.lowerThan==="undefined"){options.lowerThan="transform"}else if(options.lowerThan=="IE11"||options.lowerThan=="borderImage"){options.lowerThan="borderImage"}this.defaultOpts.bgColor=options.bgColor;this.defaultOpts.color=options.color;this.defaultOpts.lowerThan=options.lowerThan;this.defaultOpts.languagePath=options.languagePath;bkgColor=this.defaultOpts.bgColor;txtColor=this.defaultOpts.color;cssProp=this.defaultOpts.lowerThan;languagePath=this.defaultOpts.languagePath}else{bkgColor=this.defaultOpts.bgColor;txtColor=this.defaultOpts.color;cssProp=this.defaultOpts.lowerThan;languagePath=this.defaultOpts.languagePath}var done=true;function function_opacity(opacity_value){outdated.style.opacity=opacity_value/100;outdated.style.filter="alpha(opacity="+opacity_value+")"}function function_fade_in(opacity_value){function_opacity(opacity_value);if(opacity_value==1){outdated.style.display="block"}if(opacity_value==100){done=true}}var supports=function(){var div=document.createElement("div");var vendors="Khtml Ms O Moz Webkit".split(" ");var len=vendors.length;return function(prop){if(prop in div.style)return true;prop=prop.replace(/^[a-z]/,function(val){return val.toUpperCase()});while(len--){if(vendors[len]+prop in div.style){return true}}return false}}();if(!supports(""+cssProp+"")){if(done&&outdated.style.opacity!=="1"){done=false;for(var i=1;i<=100;i++){setTimeout(function(x){return function(){function_fade_in(x)}}(i),i*8)}}}else{return}if(languagePath===" "||languagePath.length==0){startStylesAndEvents()}else{grabFile(languagePath)}function startStylesAndEvents(){var btnClose=document.getElementById("btnCloseUpdateBrowser");var btnUpdate=document.getElementById("btnUpdateBrowser");outdated.style.backgroundColor=bkgColor;outdated.style.color=txtColor;outdated.children[0].style.color=txtColor;outdated.children[1].style.color=txtColor;btnUpdate.style.color=txtColor;if(btnUpdate.style.borderColor){btnUpdate.style.borderColor=txtColor}btnClose.style.color=txtColor;btnClose.onmousedown=function(){outdated.style.display="none";return false};btnUpdate.onmouseover=function(){this.style.color=bkgColor;this.style.backgroundColor=txtColor};btnUpdate.onmouseout=function(){this.style.color=txtColor;this.style.backgroundColor=bkgColor}}var ajaxEnglishDefault="<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">×</a></p>';function getHTTPObject(){var xhr=false;if(window.XMLHttpRequest){xhr=new XMLHttpRequest}else if(window.ActiveXObject){try{xhr=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xhr=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){xhr=false}}}return xhr}function grabFile(file){var request=getHTTPObject();if(request){request.onreadystatechange=function(){displayResponse(request)};request.open("GET",file,true);request.send(null)}return false}function displayResponse(request){var insertContentHere=document.getElementById("outdated");if(request.readyState==4){if(request.status==200||request.status==304){insertContentHere.innerHTML=request.responseText}else{insertContentHere.innerHTML=ajaxEnglishDefault}startStylesAndEvents()}return false}};