iecap
Version:
JavaScript library to detect the version of Internet Explorer and display a warning screen
6 lines • 2.3 kB
JavaScript
// iecap.js v1.2.0
(function(f,k){var c={languages:{en:{title:"Your browser is out of date",description:"If you want to appreciate the beauty and functionality of this site you need to update your current browser to the latest version or install one of the browsers below."},ru:{title:"Вы используете устаревший браузер",description:"Чтобы оценить всю красоту и функционал сайта Вам необходимо обновить текущий браузер до последней версии или установить один из предложенных ниже."}},
template:'<div class="iecap"><h5 class="iecap-title">{title}</h5><p class="iecap-description">{description}</p><ul class="iecap-list"><li class="explorer"><a href="http://windows.microsoft.com/en-us/internet-explorer/download-ie" title="Internet Explorer">Internet Explorer</a></li><li class="chrome"><a href="http://www.google.com/chrome/browser/" title="Google Chrome">Google Chrome</a></li><li class="firefox"><a href="http://www.mozilla.org/firefox/desktop/" title="Mozilla Firefox">Mozilla Firefox</a></li><li class="safari"><a href="http://www.apple.com/safari/" title="Apple Safari">Apple Safari</a></li></ul></div>',
options:{language:"en",availability:9}},g=c.getVersion=function(){var a=window.navigator.userAgent,b=null;return 0<a.indexOf("MSIE")?(b=a.indexOf("MSIE"),parseInt(a.substring(b+5,a.indexOf(".",b)))):0<a.indexOf("Trident")?(b=a.indexOf("rv:"),parseInt(a.substring(b+3,a.indexOf(".",b)))):!1},h=c.displayVersion=function(a){a=Number(a)||c.options.availability;var b=g(),d=document.getElementsByTagName("body")[0];if(b){var e="ie-"+b;d.className=d.className?d.className+(" "+e):e}b&&b<=a&&(d.className=d.className?
d.className+" ie-old":"ie-old");return b};c.showScreen=function(a,b){a=a||c.options.language;b=Number(b)||c.options.availability;var d=h(b),e=document.getElementsByTagName("body")[0];d&&d<=b&&(e.innerHTML+=c.template.replace("{title}",c.languages[a].title).replace("{description}",c.languages[a].description))};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=c),exports.iecap=c):"function"===typeof define&&define.amd?define([],function(){return c}):
f.iecap=c})(this);