diff --git a/bower.json b/bower.json index 9c3abf6..98040a7 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "defunctr", "description": "JavaScript library for web browser detection by feature detection.", "main": "dist/defunctr.js", - "version": "1.3.0", + "version": "1.3.0-beta1", "main": [ "dist/defunctr.js" ], diff --git a/dist/defunctr-dev.js b/dist/defunctr-dev.js new file mode 100644 index 0000000..3c0265b --- /dev/null +++ b/dist/defunctr-dev.js @@ -0,0 +1,645 @@ +/*! + * Defunctr 1.3.0-beta1 + * https://github.com/cinecove/defunctr + * + * Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors + * Released under the MIT license + * https://github.com/cinecove/defunctr/blob/master/LICENSE.md + * + * Build Date: 2016-08-24T17:04:24.709Z + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('modernizr')) : + typeof define === 'function' && define.amd ? define(['modernizr'], factory) : + (global.defunctr = factory(global.Modernizr)); +}(this, (function (Modernizr) { 'use strict'; + +Modernizr = 'default' in Modernizr ? Modernizr['default'] : Modernizr; + +var window$1 = window || null; +var navigator$1 = navigator || null; +var document = window$1 ? window$1.document || null : null; +var _undefined = void 0; + +var noop = function noop() {}; +var console = window$1 && window$1.console ? window$1.console : undefined; +var log = console ? console.log || noop : noop; +var warn = console ? console.warn || log : noop; +var error = console ? console.error || log : noop; + +var logger = { + log: log, + warn: warn, + error: error +}; + +function htmlElementConstructorCheck () { + return Boolean(window$1 && window$1.HTMLElement && Object.prototype.toString.call(window$1.HTMLElement).indexOf('Constructor') > 0); +} + +function safari () { + return htmlElementConstructorCheck(); +} + +function webKitTransformCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'WebkitTransform' in document.documentElement.style); +} + +function msWriteProfilerMarkCheck () { + return Boolean(window$1 && typeof window$1.msWriteProfilerMark !== 'undefined'); +} + +function webkit () { + return webKitTransformCheck() && msWriteProfilerMarkCheck() === false; +} + + +function hasOperaHeader() { + return Boolean(navigator$1 && navigator$1.userAgent && /(Opera|OPR)/.test(navigator$1.userAgent)); +} + +function operaNext () { + return webkit() && hasOperaHeader(); +} + +function chrome () { + return !safari() && !operaNext() && webkit(); +} + +function activeXCheck () { + return 'ActiveXObject' in window$1; +} + +function functionalEventCheck () { + return Boolean(window$1 && window$1.Event && typeof window$1.Event === 'function'); +} + +function edge () { + return Boolean(!activeXCheck() && functionalEventCheck() && msWriteProfilerMarkCheck()); +} + +function mozBoxSizingCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'MozBoxSizing' in document.documentElement.style); +} + +function firefox () { + return mozBoxSizingCheck(); +} + +function khtmlMarqueeCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'KhtmlMarquee' in document.documentElement.style); +} + +function khtml () { + return khtmlMarqueeCheck(); +} + +function operaVersionCheck () { + return Boolean(window$1 && window$1.opera && window$1.opera.version !== _undefined); +} + +function opera () { + return operaVersionCheck(); +} + + + +function ie () { + return activeXCheck(); +} + +function undetected () { + return !webkit() && !ie() && !chrome() && !edge() && !firefox() && !opera() && !operaNext() && !safari(); +} + +function hasXmlHttpRequestCheck () { + return Boolean(window$1 && typeof window$1.XMLHttpRequest !== 'undefined'); +} + +function hasBackCompatCheck () { + return Boolean(document && document.compatMode && document.compatMode === 'BackCompat'); +} + +function isAboveVersion6 () { + return ie() && hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function hasQuerySelectorCheck () { + return Boolean(document && document.querySelector !== 'undefined'); +} + +function isAboveVersion7 () { + return ie() && hasQuerySelectorCheck(); +} + +function hasAddEventListenerCheck () { + return Boolean(document && document.addEventListener !== 'undefined'); +} + +function isAboveVersion8 () { + return ie() && hasAddEventListenerCheck(); +} + +function hasAtobCheck () { + return Boolean(window$1 && typeof window$1.atob !== 'undefined'); +} + +function isAboveVersion9 () { + return ie() && hasAtobCheck(); +} + +function isAboveVersion10 () { + return ie() && hasAtobCheck() && !activeXCheck(); +} + +function isAboveVersion11 () { + return ie() && functionalEventCheck(); +} + +function hasCompatModeCheck () { + return Boolean(document && typeof document.compatMode !== 'undefined'); +} + +function isBelowVersion6 () { + return ie() && (!hasCompatModeCheck() || hasBackCompatCheck()); +} + +function isBelowVersion7 () { + return ie() && !hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function isBelowVersion8 () { + return ie() && !hasQuerySelectorCheck(); +} + +function isBelowVersion9 () { + return ie() && !hasAddEventListenerCheck(); +} + +function isBelowVersion10 () { + return ie() && !hasAtobCheck(); +} + +function isBelowVersion11 () { + return ie() && !hasAtobCheck() && activeXCheck(); +} + +function isBelowVersion12 () { + return ie() && !functionalEventCheck(); +} + +function isAboveVersion5 () { + return ie() && hasBackCompatCheck(); +} + +function isVersion6 () { + return isAboveVersion5() && isBelowVersion7(); +} + +function isVersion7 () { + return isAboveVersion6() && isBelowVersion8(); +} + +function isVersion8 () { + return isAboveVersion7() && isBelowVersion9(); +} + +function isVersion9 () { + return isAboveVersion8() && isBelowVersion10(); +} + +function isVersion10 () { + return isAboveVersion9() && isBelowVersion11(); +} + +function isVersion11 () { + return isAboveVersion10() && isBelowVersion12(); +} + + + +var ie$1 = Object.freeze({ + isAboveVersion6: isAboveVersion6, + isAboveVersion7: isAboveVersion7, + isAboveVersion8: isAboveVersion8, + isAboveVersion9: isAboveVersion9, + isAboveVersion10: isAboveVersion10, + isAboveVersion11: isAboveVersion11, + isBelowVersion6: isBelowVersion6, + isBelowVersion7: isBelowVersion7, + isBelowVersion8: isBelowVersion8, + isBelowVersion9: isBelowVersion9, + isBelowVersion10: isBelowVersion10, + isBelowVersion11: isBelowVersion11, + isBelowVersion12: isBelowVersion12, + isVersion6: isVersion6, + isVersion7: isVersion7, + isVersion8: isVersion8, + isVersion9: isVersion9, + isVersion10: isVersion10, + isVersion11: isVersion11 +}); + +function hasChromeWebstoreInstallCheck () { + return Boolean(window$1 && window$1.chrome && window$1.chrome.webstore && window$1.chrome.webstore.install); +} + +function isAboveVersion15 () { + return chrome() && hasChromeWebstoreInstallCheck(); +} + + + +var chrome$1 = Object.freeze({ + isAboveVersion15: isAboveVersion15 +}); + +var versions = { + ie: ie$1, + chrome: chrome$1 +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var Detective = function () { + function Detective() { + classCallCheck(this, Detective); + } + + createClass(Detective, [{ + key: 'isWebKit', + get: function get() { + return webkit(); + } + }, { + key: 'isOpera', + get: function get() { + return opera(); + } + }, { + key: 'isIE', + get: function get() { + return ie(); + } + }, { + key: 'isFirefox', + get: function get() { + return firefox(); + } + }, { + key: 'isSafari', + get: function get() { + return safari(); + } + }, { + key: 'isKhtml', + get: function get() { + return khtml(); + } + }, { + key: 'isOperaNext', + get: function get() { + return operaNext(); + } + }, { + key: 'isChrome', + get: function get() { + return chrome(); + } + }, { + key: 'isEdge', + get: function get() { + return edge(); + } + }, { + key: 'isUndetected', + get: function get() { + return undetected(); + } + }, { + key: 'standardsCompliant', + get: function get() { + return versions.ie.isAboveVersion9() || !ie(); + } + }, { + key: 'chromeIsAbove15', + get: function get() { + return versions.chrome.isAboveVersion15(); + } + }, { + key: 'ieIsVersion11', + get: function get() { + return versions.ie.isVersion11(); + } + }, { + key: 'ieIsVersion10', + get: function get() { + return versions.ie.isVersion10(); + } + }, { + key: 'ieIsVersion9', + get: function get() { + return versions.ie.isVersion9(); + } + }, { + key: 'ieIsVersion8', + get: function get() { + return versions.ie.isVersion8(); + } + }, { + key: 'ieIsVersion7', + get: function get() { + return versions.ie.isVersion7(); + } + }, { + key: 'ieIsVersion6', + get: function get() { + return versions.ie.isVersion6(); + } + }, { + key: 'ieIsBelowVersion6', + get: function get() { + return versions.ie.isBelowVersion6(); + } + }, { + key: 'ieIsBelowVersion7', + get: function get() { + return versions.ie.isBelowVersion7(); + } + }, { + key: 'ieIsBelowVersion8', + get: function get() { + return versions.ie.isBelowVersion8(); + } + }, { + key: 'ieIsBelowVersion9', + get: function get() { + return versions.ie.isBelowVersion9(); + } + }, { + key: 'ieIsBelowVersion10', + get: function get() { + return versions.ie.isBelowVersion10(); + } + }, { + key: 'ieIsBelowVersion11', + get: function get() { + return versions.ie.isBelowVersion11(); + } + }, { + key: 'ieIsBelowVersion12', + get: function get() { + return versions.ie.isBelowVersion12(); + } + }, { + key: 'ieIsAboveVersion5', + get: function get() { + return versions.ie.isAboveVersion5(); + } + }, { + key: 'ieIsAboveVersion6', + get: function get() { + return versions.ie.isAboveVersion6(); + } + }, { + key: 'ieIsAboveVersion7', + get: function get() { + return versions.ie.isAboveVersion7(); + } + }, { + key: 'ieIsAboveVersion8', + get: function get() { + return versions.ie.isAboveVersion8(); + } + }, { + key: 'ieIsAboveVersion9', + get: function get() { + return versions.ie.isAboveVersion9(); + } + }, { + key: 'ieIsAboveVersion10', + get: function get() { + return versions.ie.isAboveVersion10(); + } + }, { + key: 'ieIsAboveVersion11', + get: function get() { + return versions.ie.isAboveVersion11(); + } + }]); + return Detective; +}(); + +var classes = { + IE: 'ie', + CHROME: 'chrome', + SAFARI: 'safari', + OPERA: 'opera', + OPERANEXT: 'opera-next', + FIREFOX: 'firefox', + KHTML: 'khtml', + WEBKIT: 'webkit', + EDGE: 'edge', + UNKNOWN: 'undetected-browser', + + IE_LESSTHAN_6: 'ie-lt-6', + IE_LESSTHAN_7: 'ie-lt-7', + IE_LESSTHAN_8: 'ie-lt-8', + IE_LESSTHAN_9: 'ie-lt-9', + IE_LESSTHAN_10: 'ie-lt-10', + IE_LESSTHAN_11: 'ie-lt-11', + IE_LESSTHAN_12: 'ie-lt-12', + + IE_GREATERTHAN_6: 'ie-gt-6', + IE_GREATERTHAN_7: 'ie-gt-7', + IE_GREATERTHAN_8: 'ie-gt-8', + IE_GREATERTHAN_9: 'ie-gt-9', + IE_GREATERTHAN_10: 'ie-gt-10', + IE_GREATERTHAN_11: 'ie-gt-11', + + IE_VERSION_6: 'ie-verion-6', + IE_VERSION_7: 'ie-version-7', + IE_VERSION_8: 'ie-version-8', + IE_VERSION_9: 'ie-version-9', + IE_VERSION_10: 'ie-version-10', + IE_VERSION_11: 'ie-version-11' +}; + +var tags = { + DEFUNCTR: 'defunctr', + VERSION_OFF: 'defunctr-version-off', + IE_ONLY: 'defunctr-ie-only', + IE_LESSTHAN_OFF: 'defunctr-lt-off', + IE_GREATERTHAN_OFF: 'defunctr-gt-off', + NOTAGGING: 'defunctr-off' +}; + +var prefix = ''; + +function prefixedClassFor (className) { + return '' + prefix + className; +} + +var docElement = document && document.documentElement && document.documentElement.className ? document.documentElement : { className: '' }; + +function makeTest(item) { + return function test() { + return item; + }; +} + +function test(key, test) { + if (Modernizr) { + Modernizr.addTest(key, test); + } else { + if (test()) { + addTag(key); + } else { + addTag('no-' + key); + } + } +} + +function removeTag(tag) { + docElement.className = docElement.className.replace(new RegExp('\\b' + tag + '\\b'), ''); +} + +function addTag(tag) { + if (!hasTag(tag)) { + docElement.className += docElement.className.length > 0 ? ' ' + tag : tag; + } +} + +function hasTag(tag) { + return docElement.className.match(new RegExp('\\b' + tag + '\\b')); +} + +function tagPage(detective) { + if (!hasTag(tags.NOTAGGING)) { + test(prefixedClassFor(classes.IE), makeTest(detective.isIE)); + + if (!hasTag(tags.IE_ONLY)) { + test(prefixedClassFor(classes.CHROME), makeTest(detective.isChrome)); + test(prefixedClassFor(classes.SAFARI), makeTest(detective.isSafari)); + test(prefixedClassFor(classes.OPERA), makeTest(detective.isOpera)); + test(prefixedClassFor(classes.OPERANEXT), makeTest(detective.isOperaNext)); + test(prefixedClassFor(classes.FIREFOX), makeTest(detective.isFirefox)); + test(prefixedClassFor(classes.KHTML), makeTest(detective.isKhtml)); + test(prefixedClassFor(classes.WEBKIT), makeTest(detective.isWebKit)); + test(prefixedClassFor(classes.EDGE), makeTest(detective.isEdge)); + test(prefixedClassFor(classes.UNKNOWN), makeTest(detective.isUndetected)); + } + + if (!hasTag(tags.IE_LESSTHAN_OFF)) { + test(prefixedClassFor(classes.IE_LESSTHAN_6), makeTest(detective.ieBelowVersion6)); + test(prefixedClassFor(classes.IE_LESSTHAN_7), makeTest(detective.ieBelowVersion7)); + test(prefixedClassFor(classes.IE_LESSTHAN_8), makeTest(detective.ieBelowVersion8)); + test(prefixedClassFor(classes.IE_LESSTHAN_9), makeTest(detective.ieBelowVersion9)); + test(prefixedClassFor(classes.IE_LESSTHAN_10), makeTest(detective.ieBelowVersion10)); + test(prefixedClassFor(classes.IE_LESSTHAN_11), makeTest(detective.ieBelowVersion11)); + test(prefixedClassFor(classes.IE_LESSTHAN_12), makeTest(detective.ieBelowVersion12)); + } + + if (!hasTag(tags.IE_GREATERTHAN_OFF)) { + test(prefixedClassFor(classes.IE_GREATERTHAN_6), makeTest(detective.ieAboveVersion6)); + test(prefixedClassFor(classes.IE_GREATERTHAN_7), makeTest(detective.ieAboveVersion7)); + test(prefixedClassFor(classes.IE_GREATERTHAN_8), makeTest(detective.ieAboveVersion8)); + test(prefixedClassFor(classes.IE_GREATERTHAN_9), makeTest(detective.ieAboveVersion9)); + test(prefixedClassFor(classes.IE_GREATERTHAN_10), makeTest(detective.ieAboveVersion10)); + test(prefixedClassFor(classes.IE_GREATERTHAN_11), makeTest(detective.ieAboveVersion11)); + } + + if (!hasTag(tags.VERSION_OFF)) { + test(prefixedClassFor(classes.IE_VERSION_6), makeTest(detective.ieIsVersion6)); + test(prefixedClassFor(classes.IE_VERSION_7), makeTest(detective.ieIsVersion7)); + test(prefixedClassFor(classes.IE_VERSION_8), makeTest(detective.ieIsVersion8)); + test(prefixedClassFor(classes.IE_VERSION_9), makeTest(detective.ieIsVersion9)); + test(prefixedClassFor(classes.IE_VERSION_10), makeTest(detective.ieIsVersion10)); + test(prefixedClassFor(classes.IE_VERSION_11), makeTest(detective.ieIsVersion11)); + } + } + cleanTags(); +} + +function cleanTags() { + removeTag(tags.IE_GREATERTHAN_OFF); + removeTag(tags.IE_LESSTHAN_OFF); + removeTag(tags.VERSION_OFF); + removeTag(tags.IE_ONLY); + removeTag(tags.DEFUNCTR); + removeTag(tags.NOTAGGING); +} + +function tagger (detective) { + return { + tag: function tag() { + if (document) { + tagPage(detective); + } + } + }; +} + +var detective = new Detective(); + +var Defunctr = function () { + function Defunctr() { + classCallCheck(this, Defunctr); + + this.version = '1.3.0-beta1'; + } + + createClass(Defunctr, [{ + key: 'detective', + get: function get() { + return detective; + } + }]); + return Defunctr; +}(); + +var defunctr = new Defunctr(); + +if (window) { + tagger(detective).tag(); + + window.defunctr = defunctr; + if (Object.defineProperty) { + Object.defineProperty(window, 'Defunctr', { + get: function get() { + logger.warn('window.Defunctr is deprecated and will be removed. Please use window.defunctr'); + return defunctr; + }, + enumerable: true, + configurable: true + }); + } else { + window.Defunctr = defunctr; + } +} + +return defunctr; + +}))); \ No newline at end of file diff --git a/dist/defunctr.js b/dist/defunctr.js new file mode 100644 index 0000000..00915be --- /dev/null +++ b/dist/defunctr.js @@ -0,0 +1,11 @@ +/*! + * Defunctr 1.3.0-beta1 + * https://github.com/cinecove/defunctr + * + * Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors + * Released under the MIT license + * https://github.com/cinecove/defunctr/blob/master/LICENSE.md + * + * Build Date: 2016-08-24T17:04:24.709Z + */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("modernizr")):"function"==typeof define&&define.amd?define(["modernizr"],n):e.defunctr=n(e.Modernizr)}(this,function(Modernizr){"use strict";function e(){return Boolean(ie&&ie.HTMLElement&&Object.prototype.toString.call(ie.HTMLElement).indexOf("Constructor")>0)}function n(){return e()}function i(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"WebkitTransform"in te.documentElement.style)}function o(){return Boolean(ie&&"undefined"!=typeof ie.msWriteProfilerMark)}function t(){return i()&&o()===!1}function r(){return Boolean(oe&&oe.userAgent&&/(Opera|OPR)/.test(oe.userAgent))}function u(){return t()&&r()}function s(){return!n()&&!u()&&t()}function c(){return"ActiveXObject"in ie}function f(){return Boolean(ie&&ie.Event&&"function"==typeof ie.Event)}function E(){return Boolean(!c()&&f()&&o())}function l(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"MozBoxSizing"in te.documentElement.style)}function I(){return l()}function V(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"KhtmlMarquee"in te.documentElement.style)}function a(){return V()}function _(){return Boolean(ie&&ie.opera&&ie.opera.version!==re)}function A(){return _()}function d(){return c()}function N(){return!(t()||d()||s()||E()||I()||A()||u()||n())}function m(){return Boolean(ie&&"undefined"!=typeof ie.XMLHttpRequest)}function T(){return Boolean(te&&te.compatMode&&"BackCompat"===te.compatMode)}function R(){return d()&&T()&&!m()}function g(){return Boolean(te&&"undefined"!==te.querySelector)}function b(){return d()&&g()}function w(){return Boolean(te&&"undefined"!==te.addEventListener)}function y(){return d()&&w()}function S(){return Boolean(ie&&"undefined"!=typeof ie.atob)}function O(){return d()&&S()}function v(){return d()&&S()&&!c()}function B(){return d()&&f()}function k(){return Boolean(te&&"undefined"!=typeof te.compatMode)}function H(){return d()&&(!k()||T())}function p(){return d()&&!T()&&!m()}function F(){return d()&&!g()}function G(){return d()&&!w()}function L(){return d()&&!S()}function h(){return d()&&!S()&&c()}function M(){return d()&&!f()}function x(){return d()&&T()}function K(){return x()&&p()}function C(){return R()&&F()}function P(){return b()&&G()}function j(){return y()&&L()}function W(){return O()&&h()}function z(){return v()&&M()}function D(){return Boolean(ie&&ie.chrome&&ie.chrome.webstore&&ie.chrome.webstore.install)}function U(){return s()&&D()}function X(e){return""+Te+e}function q(e){return function(){return e}}function Y(e,n){Modernizr?Modernizr.addTest(e,n):Q(n()?e:"no-"+e)}function J(e){Re.className=Re.className.replace(new RegExp("\\b"+e+"\\b"),"")}function Q(e){Z(e)||(Re.className+=Re.className.length>0?" "+e:e)}function Z(e){return Re.className.match(new RegExp("\\b"+e+"\\b"))}function $(e){Z(me.NOTAGGING)||(Y(X(Ne.IE),q(e.isIE)),Z(me.IE_ONLY)||(Y(X(Ne.CHROME),q(e.isChrome)),Y(X(Ne.SAFARI),q(e.isSafari)),Y(X(Ne.OPERA),q(e.isOpera)),Y(X(Ne.OPERANEXT),q(e.isOperaNext)),Y(X(Ne.FIREFOX),q(e.isFirefox)),Y(X(Ne.KHTML),q(e.isKhtml)),Y(X(Ne.WEBKIT),q(e.isWebKit)),Y(X(Ne.EDGE),q(e.isEdge)),Y(X(Ne.UNKNOWN),q(e.isUndetected))),Z(me.IE_LESSTHAN_OFF)||(Y(X(Ne.IE_LESSTHAN_6),q(e.ieBelowVersion6)),Y(X(Ne.IE_LESSTHAN_7),q(e.ieBelowVersion7)),Y(X(Ne.IE_LESSTHAN_8),q(e.ieBelowVersion8)),Y(X(Ne.IE_LESSTHAN_9),q(e.ieBelowVersion9)),Y(X(Ne.IE_LESSTHAN_10),q(e.ieBelowVersion10)),Y(X(Ne.IE_LESSTHAN_11),q(e.ieBelowVersion11)),Y(X(Ne.IE_LESSTHAN_12),q(e.ieBelowVersion12))),Z(me.IE_GREATERTHAN_OFF)||(Y(X(Ne.IE_GREATERTHAN_6),q(e.ieAboveVersion6)),Y(X(Ne.IE_GREATERTHAN_7),q(e.ieAboveVersion7)),Y(X(Ne.IE_GREATERTHAN_8),q(e.ieAboveVersion8)),Y(X(Ne.IE_GREATERTHAN_9),q(e.ieAboveVersion9)),Y(X(Ne.IE_GREATERTHAN_10),q(e.ieAboveVersion10)),Y(X(Ne.IE_GREATERTHAN_11),q(e.ieAboveVersion11))),Z(me.VERSION_OFF)||(Y(X(Ne.IE_VERSION_6),q(e.ieIsVersion6)),Y(X(Ne.IE_VERSION_7),q(e.ieIsVersion7)),Y(X(Ne.IE_VERSION_8),q(e.ieIsVersion8)),Y(X(Ne.IE_VERSION_9),q(e.ieIsVersion9)),Y(X(Ne.IE_VERSION_10),q(e.ieIsVersion10)),Y(X(Ne.IE_VERSION_11),q(e.ieIsVersion11)))),ee()}function ee(){J(me.IE_GREATERTHAN_OFF),J(me.IE_LESSTHAN_OFF),J(me.VERSION_OFF),J(me.IE_ONLY),J(me.DEFUNCTR),J(me.NOTAGGING)}function ne(e){return{tag:function(){te&&$(e)}}}Modernizr="default"in Modernizr?Modernizr.default:Modernizr;var ie=window||null,oe=navigator||null,te=ie?ie.document||null:null,re=void 0,ue=function(){},se=ie&&ie.console?ie.console:void 0,ce=se?se.log||ue:ue,fe=se?se.warn||ce:ue,Ee=se?se.error||ce:ue,le={log:ce,warn:fe,error:Ee},Ie=Object.freeze({isAboveVersion6:R,isAboveVersion7:b,isAboveVersion8:y,isAboveVersion9:O,isAboveVersion10:v,isAboveVersion11:B,isBelowVersion6:H,isBelowVersion7:p,isBelowVersion8:F,isBelowVersion9:G,isBelowVersion10:L,isBelowVersion11:h,isBelowVersion12:M,isVersion6:K,isVersion7:C,isVersion8:P,isVersion9:j,isVersion10:W,isVersion11:z}),Ve=Object.freeze({isAboveVersion15:U}),ae={ie:Ie,chrome:Ve},_e=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},Ae=function(){function e(e,n){for(var i=0;i 0); +} + +function safari () { + return htmlElementConstructorCheck(); +} + +function webKitTransformCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'WebkitTransform' in document.documentElement.style); +} + +function msWriteProfilerMarkCheck () { + return Boolean(window$1 && typeof window$1.msWriteProfilerMark !== 'undefined'); +} + +function webkit () { + return webKitTransformCheck() && msWriteProfilerMarkCheck() === false; +} + + +function hasOperaHeader() { + return Boolean(navigator$1 && navigator$1.userAgent && /(Opera|OPR)/.test(navigator$1.userAgent)); +} + +function operaNext () { + return webkit() && hasOperaHeader(); +} + +function chrome () { + return !safari() && !operaNext() && webkit(); +} + +function activeXCheck () { + return 'ActiveXObject' in window$1; +} + +function functionalEventCheck () { + return Boolean(window$1 && window$1.Event && typeof window$1.Event === 'function'); +} + +function edge () { + return Boolean(!activeXCheck() && functionalEventCheck() && msWriteProfilerMarkCheck()); +} + +function mozBoxSizingCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'MozBoxSizing' in document.documentElement.style); +} + +function firefox () { + return mozBoxSizingCheck(); +} + +function khtmlMarqueeCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'KhtmlMarquee' in document.documentElement.style); +} + +function khtml () { + return khtmlMarqueeCheck(); +} + +function operaVersionCheck () { + return Boolean(window$1 && window$1.opera && window$1.opera.version !== _undefined); +} + +function opera () { + return operaVersionCheck(); +} + + + +function ie () { + return activeXCheck(); +} + +function undetected () { + return !webkit() && !ie() && !chrome() && !edge() && !firefox() && !opera() && !operaNext() && !safari(); +} + +function hasXmlHttpRequestCheck () { + return Boolean(window$1 && typeof window$1.XMLHttpRequest !== 'undefined'); +} + +function hasBackCompatCheck () { + return Boolean(document && document.compatMode && document.compatMode === 'BackCompat'); +} + +function isAboveVersion6 () { + return ie() && hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function hasQuerySelectorCheck () { + return Boolean(document && document.querySelector !== 'undefined'); +} + +function isAboveVersion7 () { + return ie() && hasQuerySelectorCheck(); +} + +function hasAddEventListenerCheck () { + return Boolean(document && document.addEventListener !== 'undefined'); +} + +function isAboveVersion8 () { + return ie() && hasAddEventListenerCheck(); +} + +function hasAtobCheck () { + return Boolean(window$1 && typeof window$1.atob !== 'undefined'); +} + +function isAboveVersion9 () { + return ie() && hasAtobCheck(); +} + +function isAboveVersion10 () { + return ie() && hasAtobCheck() && !activeXCheck(); +} + +function isAboveVersion11 () { + return ie() && functionalEventCheck(); +} + +function hasCompatModeCheck () { + return Boolean(document && typeof document.compatMode !== 'undefined'); +} + +function isBelowVersion6 () { + return ie() && (!hasCompatModeCheck() || hasBackCompatCheck()); +} + +function isBelowVersion7 () { + return ie() && !hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function isBelowVersion8 () { + return ie() && !hasQuerySelectorCheck(); +} + +function isBelowVersion9 () { + return ie() && !hasAddEventListenerCheck(); +} + +function isBelowVersion10 () { + return ie() && !hasAtobCheck(); +} + +function isBelowVersion11 () { + return ie() && !hasAtobCheck() && activeXCheck(); +} + +function isBelowVersion12 () { + return ie() && !functionalEventCheck(); +} + +function isAboveVersion5 () { + return ie() && hasBackCompatCheck(); +} + +function isVersion6 () { + return isAboveVersion5() && isBelowVersion7(); +} + +function isVersion7 () { + return isAboveVersion6() && isBelowVersion8(); +} + +function isVersion8 () { + return isAboveVersion7() && isBelowVersion9(); +} + +function isVersion9 () { + return isAboveVersion8() && isBelowVersion10(); +} + +function isVersion10 () { + return isAboveVersion9() && isBelowVersion11(); +} + +function isVersion11 () { + return isAboveVersion10() && isBelowVersion12(); +} + + + +var ie$1 = Object.freeze({ + isAboveVersion6: isAboveVersion6, + isAboveVersion7: isAboveVersion7, + isAboveVersion8: isAboveVersion8, + isAboveVersion9: isAboveVersion9, + isAboveVersion10: isAboveVersion10, + isAboveVersion11: isAboveVersion11, + isBelowVersion6: isBelowVersion6, + isBelowVersion7: isBelowVersion7, + isBelowVersion8: isBelowVersion8, + isBelowVersion9: isBelowVersion9, + isBelowVersion10: isBelowVersion10, + isBelowVersion11: isBelowVersion11, + isBelowVersion12: isBelowVersion12, + isVersion6: isVersion6, + isVersion7: isVersion7, + isVersion8: isVersion8, + isVersion9: isVersion9, + isVersion10: isVersion10, + isVersion11: isVersion11 +}); + +var ie$1 = Object.freeze({ + isAboveVersion6: isAboveVersion6, + isAboveVersion7: isAboveVersion7, + isAboveVersion8: isAboveVersion8, + isAboveVersion9: isAboveVersion9, + isAboveVersion10: isAboveVersion10, + isAboveVersion11: isAboveVersion11, + isBelowVersion6: isBelowVersion6, + isBelowVersion7: isBelowVersion7, + isBelowVersion8: isBelowVersion8, + isBelowVersion9: isBelowVersion9, + isBelowVersion10: isBelowVersion10, + isBelowVersion11: isBelowVersion11, + isBelowVersion12: isBelowVersion12, + isVersion6: isVersion6, + isVersion7: isVersion7, + isVersion8: isVersion8, + isVersion9: isVersion9, + isVersion10: isVersion10, + isVersion11: isVersion11 +}); + +function hasChromeWebstoreInstallCheck () { + return Boolean(window$1 && window$1.chrome && window$1.chrome.webstore && window$1.chrome.webstore.install); +} + +function isAboveVersion15 () { + return chrome() && hasChromeWebstoreInstallCheck(); +} + + + +var chrome$1 = Object.freeze({ + isAboveVersion15: isAboveVersion15 +}); + +var chrome$1 = Object.freeze({ + isAboveVersion15: isAboveVersion15 +}); + +var versions = { + ie: ie$1, + chrome: chrome$1 +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var Detective = function () { + function Detective() { + classCallCheck(this, Detective); + } + + createClass(Detective, [{ + key: 'isWebKit', + get: function get() { + return webkit(); + } + }, { + key: 'isOpera', + get: function get() { + return opera(); + } + }, { + key: 'isIE', + get: function get() { + return ie(); + } + }, { + key: 'isFirefox', + get: function get() { + return firefox(); + } + }, { + key: 'isSafari', + get: function get() { + return safari(); + } + }, { + key: 'isKhtml', + get: function get() { + return khtml(); + } + }, { + key: 'isOperaNext', + get: function get() { + return operaNext(); + } + }, { + key: 'isChrome', + get: function get() { + return chrome(); + } + }, { + key: 'isEdge', + get: function get() { + return edge(); + } + }, { + key: 'isUndetected', + get: function get() { + return undetected(); + } + }, { + key: 'standardsCompliant', + get: function get() { + return versions.ie.isAboveVersion9() || !ie(); + } + }, { + key: 'chromeIsAbove15', + get: function get() { + return versions.chrome.isAboveVersion15(); + } + }, { + key: 'ieIsVersion11', + get: function get() { + return versions.ie.isVersion11(); + } + }, { + key: 'ieIsVersion10', + get: function get() { + return versions.ie.isVersion10(); + } + }, { + key: 'ieIsVersion9', + get: function get() { + return versions.ie.isVersion9(); + } + }, { + key: 'ieIsVersion8', + get: function get() { + return versions.ie.isVersion8(); + } + }, { + key: 'ieIsVersion7', + get: function get() { + return versions.ie.isVersion7(); + } + }, { + key: 'ieIsVersion6', + get: function get() { + return versions.ie.isVersion6(); + } + }, { + key: 'ieIsBelowVersion6', + get: function get() { + return versions.ie.isBelowVersion6(); + } + }, { + key: 'ieIsBelowVersion7', + get: function get() { + return versions.ie.isBelowVersion7(); + } + }, { + key: 'ieIsBelowVersion8', + get: function get() { + return versions.ie.isBelowVersion8(); + } + }, { + key: 'ieIsBelowVersion9', + get: function get() { + return versions.ie.isBelowVersion9(); + } + }, { + key: 'ieIsBelowVersion10', + get: function get() { + return versions.ie.isBelowVersion10(); + } + }, { + key: 'ieIsBelowVersion11', + get: function get() { + return versions.ie.isBelowVersion11(); + } + }, { + key: 'ieIsBelowVersion12', + get: function get() { + return versions.ie.isBelowVersion12(); + } + }, { + key: 'ieIsAboveVersion5', + get: function get() { + return versions.ie.isAboveVersion5(); + } + }, { + key: 'ieIsAboveVersion6', + get: function get() { + return versions.ie.isAboveVersion6(); + } + }, { + key: 'ieIsAboveVersion7', + get: function get() { + return versions.ie.isAboveVersion7(); + } + }, { + key: 'ieIsAboveVersion8', + get: function get() { + return versions.ie.isAboveVersion8(); + } + }, { + key: 'ieIsAboveVersion9', + get: function get() { + return versions.ie.isAboveVersion9(); + } + }, { + key: 'ieIsAboveVersion10', + get: function get() { + return versions.ie.isAboveVersion10(); + } + }, { + key: 'ieIsAboveVersion11', + get: function get() { + return versions.ie.isAboveVersion11(); + } + }]); + return Detective; +}(); + +var classes = { + IE: 'ie', + CHROME: 'chrome', + SAFARI: 'safari', + OPERA: 'opera', + OPERANEXT: 'opera-next', + FIREFOX: 'firefox', + KHTML: 'khtml', + WEBKIT: 'webkit', + EDGE: 'edge', + UNKNOWN: 'undetected-browser', + + IE_LESSTHAN_6: 'ie-lt-6', + IE_LESSTHAN_7: 'ie-lt-7', + IE_LESSTHAN_8: 'ie-lt-8', + IE_LESSTHAN_9: 'ie-lt-9', + IE_LESSTHAN_10: 'ie-lt-10', + IE_LESSTHAN_11: 'ie-lt-11', + IE_LESSTHAN_12: 'ie-lt-12', + + IE_GREATERTHAN_6: 'ie-gt-6', + IE_GREATERTHAN_7: 'ie-gt-7', + IE_GREATERTHAN_8: 'ie-gt-8', + IE_GREATERTHAN_9: 'ie-gt-9', + IE_GREATERTHAN_10: 'ie-gt-10', + IE_GREATERTHAN_11: 'ie-gt-11', + + IE_VERSION_6: 'ie-verion-6', + IE_VERSION_7: 'ie-version-7', + IE_VERSION_8: 'ie-version-8', + IE_VERSION_9: 'ie-version-9', + IE_VERSION_10: 'ie-version-10', + IE_VERSION_11: 'ie-version-11' +}; + +var tags = { + DEFUNCTR: 'defunctr', + VERSION_OFF: 'defunctr-version-off', + IE_ONLY: 'defunctr-ie-only', + IE_LESSTHAN_OFF: 'defunctr-lt-off', + IE_GREATERTHAN_OFF: 'defunctr-gt-off', + NOTAGGING: 'defunctr-off' +}; + +var prefix = ''; + +function prefixedClassFor (className) { + return '' + prefix + className; +} + +var docElement = document && document.documentElement && document.documentElement.className ? document.documentElement : { className: '' }; + +function makeTest(item) { + return function test() { + return item; + }; +} + +function test(key, test) { + if (Modernizr) { + Modernizr.addTest(key, test); + } else { + if (test()) { + addTag(key); + } else { + addTag('no-' + key); + } + } +} + +function removeTag(tag) { + docElement.className = docElement.className.replace(new RegExp('\\b' + tag + '\\b'), ''); +} + +function addTag(tag) { + if (!hasTag(tag)) { + docElement.className += docElement.className.length > 0 ? ' ' + tag : tag; + } +} + +function hasTag(tag) { + return docElement.className.match(new RegExp('\\b' + tag + '\\b')); +} + +function tagPage(detective) { + if (!hasTag(tags.NOTAGGING)) { + test(prefixedClassFor(classes.IE), makeTest(detective.isIE)); + + if (!hasTag(tags.IE_ONLY)) { + test(prefixedClassFor(classes.CHROME), makeTest(detective.isChrome)); + test(prefixedClassFor(classes.SAFARI), makeTest(detective.isSafari)); + test(prefixedClassFor(classes.OPERA), makeTest(detective.isOpera)); + test(prefixedClassFor(classes.OPERANEXT), makeTest(detective.isOperaNext)); + test(prefixedClassFor(classes.FIREFOX), makeTest(detective.isFirefox)); + test(prefixedClassFor(classes.KHTML), makeTest(detective.isKhtml)); + test(prefixedClassFor(classes.WEBKIT), makeTest(detective.isWebKit)); + test(prefixedClassFor(classes.EDGE), makeTest(detective.isEdge)); + test(prefixedClassFor(classes.UNKNOWN), makeTest(detective.isUndetected)); + } + + if (!hasTag(tags.IE_LESSTHAN_OFF)) { + test(prefixedClassFor(classes.IE_LESSTHAN_6), makeTest(detective.ieBelowVersion6)); + test(prefixedClassFor(classes.IE_LESSTHAN_7), makeTest(detective.ieBelowVersion7)); + test(prefixedClassFor(classes.IE_LESSTHAN_8), makeTest(detective.ieBelowVersion8)); + test(prefixedClassFor(classes.IE_LESSTHAN_9), makeTest(detective.ieBelowVersion9)); + test(prefixedClassFor(classes.IE_LESSTHAN_10), makeTest(detective.ieBelowVersion10)); + test(prefixedClassFor(classes.IE_LESSTHAN_11), makeTest(detective.ieBelowVersion11)); + test(prefixedClassFor(classes.IE_LESSTHAN_12), makeTest(detective.ieBelowVersion12)); + } + + if (!hasTag(tags.IE_GREATERTHAN_OFF)) { + test(prefixedClassFor(classes.IE_GREATERTHAN_6), makeTest(detective.ieAboveVersion6)); + test(prefixedClassFor(classes.IE_GREATERTHAN_7), makeTest(detective.ieAboveVersion7)); + test(prefixedClassFor(classes.IE_GREATERTHAN_8), makeTest(detective.ieAboveVersion8)); + test(prefixedClassFor(classes.IE_GREATERTHAN_9), makeTest(detective.ieAboveVersion9)); + test(prefixedClassFor(classes.IE_GREATERTHAN_10), makeTest(detective.ieAboveVersion10)); + test(prefixedClassFor(classes.IE_GREATERTHAN_11), makeTest(detective.ieAboveVersion11)); + } + + if (!hasTag(tags.VERSION_OFF)) { + test(prefixedClassFor(classes.IE_VERSION_6), makeTest(detective.ieIsVersion6)); + test(prefixedClassFor(classes.IE_VERSION_7), makeTest(detective.ieIsVersion7)); + test(prefixedClassFor(classes.IE_VERSION_8), makeTest(detective.ieIsVersion8)); + test(prefixedClassFor(classes.IE_VERSION_9), makeTest(detective.ieIsVersion9)); + test(prefixedClassFor(classes.IE_VERSION_10), makeTest(detective.ieIsVersion10)); + test(prefixedClassFor(classes.IE_VERSION_11), makeTest(detective.ieIsVersion11)); + } + } + cleanTags(); +} + +function cleanTags() { + removeTag(tags.IE_GREATERTHAN_OFF); + removeTag(tags.IE_LESSTHAN_OFF); + removeTag(tags.VERSION_OFF); + removeTag(tags.IE_ONLY); + removeTag(tags.DEFUNCTR); + removeTag(tags.NOTAGGING); +} + +function tagger (detective) { + return { + tag: function tag() { + if (document) { + tagPage(detective); + } + } + }; +} + +var detective = new Detective(); + +var Defunctr = function () { + function Defunctr() { + classCallCheck(this, Defunctr); + + this.version = '1.3.0-beta1'; + } + + createClass(Defunctr, [{ + key: 'detective', + get: function get() { + return detective; + } + }]); + return Defunctr; +}(); + +var defunctr = new Defunctr(); + +if (window) { + tagger(detective).tag(); + + window.defunctr = defunctr; + if (Object.defineProperty) { + Object.defineProperty(window, 'Defunctr', { + get: function get() { + logger.warn('window.Defunctr is deprecated and will be removed. Please use window.defunctr'); + return defunctr; + }, + enumerable: true, + configurable: true + }); + } else { + window.Defunctr = defunctr; + } +} + +export default defunctr; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 819a362..54efb10 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -68,6 +68,7 @@ gulp.task('build-umd', function () { .pipe(strip()) .pipe(replace('@@version', version)) .pipe(banner(header, { pkg: pkg, build_tag: build_tag, buildDate: buildDate })) + .pipe(gulp.dest('./release')) .pipe(rename({suffix: '-' + version})) .pipe(gulp.dest('./release')) .pipe(rename({basename: 'defunctr', suffix: '-dev'})) @@ -80,7 +81,9 @@ gulp.task('build-umd', function () { })) .pipe(rename({ basename: 'defunctr', suffix: ''})) .pipe(gulp.dest('./dist')) - .pipe(rename({ suffix: '-' + version + '.min'})) + .pipe(rename({ suffix: '.min'})) + .pipe(gulp.dest('./release')) + .pipe(rename({ basename: 'defunctr', suffix: '-' + version + '.min'})) .pipe(gulp.dest('./release')); }); diff --git a/nuget/Defunctr.1.3.0-beta1.nupkg b/nuget/Defunctr.1.3.0-beta1.nupkg new file mode 100644 index 0000000..7987d5a Binary files /dev/null and b/nuget/Defunctr.1.3.0-beta1.nupkg differ diff --git a/package.json b/package.json index b4f6d68..ab32fd5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "defunctr", "title": "Defunctr", "description": "JavaScript library for web browser detection by feature detection.", - "version": "1.3.0", + "version": "1.3.0-beta1", "main": "dist/defunctr.js", "module": "dist/index.js", "jsnext:main": "dist/index.js", @@ -70,7 +70,8 @@ "scripts": { "prebuild": "eslint lib test", "build": "rollup -c && gulp --env=dev", - "release": "rollup -c && gulp bump && gulp release --env=production", + "__release": "rollup -c && gulp bump && gulp release --env=production", + "release": "rollup -c && gulp release --env=production", "watch": "rollup -c -w", "pretest": "npm run build", "test": "mocha \"./{,!(node_modules)/**/}*.test.js\"", diff --git a/release/defunctr-1.3.0-beta1.js b/release/defunctr-1.3.0-beta1.js new file mode 100644 index 0000000..3c0265b --- /dev/null +++ b/release/defunctr-1.3.0-beta1.js @@ -0,0 +1,645 @@ +/*! + * Defunctr 1.3.0-beta1 + * https://github.com/cinecove/defunctr + * + * Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors + * Released under the MIT license + * https://github.com/cinecove/defunctr/blob/master/LICENSE.md + * + * Build Date: 2016-08-24T17:04:24.709Z + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('modernizr')) : + typeof define === 'function' && define.amd ? define(['modernizr'], factory) : + (global.defunctr = factory(global.Modernizr)); +}(this, (function (Modernizr) { 'use strict'; + +Modernizr = 'default' in Modernizr ? Modernizr['default'] : Modernizr; + +var window$1 = window || null; +var navigator$1 = navigator || null; +var document = window$1 ? window$1.document || null : null; +var _undefined = void 0; + +var noop = function noop() {}; +var console = window$1 && window$1.console ? window$1.console : undefined; +var log = console ? console.log || noop : noop; +var warn = console ? console.warn || log : noop; +var error = console ? console.error || log : noop; + +var logger = { + log: log, + warn: warn, + error: error +}; + +function htmlElementConstructorCheck () { + return Boolean(window$1 && window$1.HTMLElement && Object.prototype.toString.call(window$1.HTMLElement).indexOf('Constructor') > 0); +} + +function safari () { + return htmlElementConstructorCheck(); +} + +function webKitTransformCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'WebkitTransform' in document.documentElement.style); +} + +function msWriteProfilerMarkCheck () { + return Boolean(window$1 && typeof window$1.msWriteProfilerMark !== 'undefined'); +} + +function webkit () { + return webKitTransformCheck() && msWriteProfilerMarkCheck() === false; +} + + +function hasOperaHeader() { + return Boolean(navigator$1 && navigator$1.userAgent && /(Opera|OPR)/.test(navigator$1.userAgent)); +} + +function operaNext () { + return webkit() && hasOperaHeader(); +} + +function chrome () { + return !safari() && !operaNext() && webkit(); +} + +function activeXCheck () { + return 'ActiveXObject' in window$1; +} + +function functionalEventCheck () { + return Boolean(window$1 && window$1.Event && typeof window$1.Event === 'function'); +} + +function edge () { + return Boolean(!activeXCheck() && functionalEventCheck() && msWriteProfilerMarkCheck()); +} + +function mozBoxSizingCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'MozBoxSizing' in document.documentElement.style); +} + +function firefox () { + return mozBoxSizingCheck(); +} + +function khtmlMarqueeCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'KhtmlMarquee' in document.documentElement.style); +} + +function khtml () { + return khtmlMarqueeCheck(); +} + +function operaVersionCheck () { + return Boolean(window$1 && window$1.opera && window$1.opera.version !== _undefined); +} + +function opera () { + return operaVersionCheck(); +} + + + +function ie () { + return activeXCheck(); +} + +function undetected () { + return !webkit() && !ie() && !chrome() && !edge() && !firefox() && !opera() && !operaNext() && !safari(); +} + +function hasXmlHttpRequestCheck () { + return Boolean(window$1 && typeof window$1.XMLHttpRequest !== 'undefined'); +} + +function hasBackCompatCheck () { + return Boolean(document && document.compatMode && document.compatMode === 'BackCompat'); +} + +function isAboveVersion6 () { + return ie() && hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function hasQuerySelectorCheck () { + return Boolean(document && document.querySelector !== 'undefined'); +} + +function isAboveVersion7 () { + return ie() && hasQuerySelectorCheck(); +} + +function hasAddEventListenerCheck () { + return Boolean(document && document.addEventListener !== 'undefined'); +} + +function isAboveVersion8 () { + return ie() && hasAddEventListenerCheck(); +} + +function hasAtobCheck () { + return Boolean(window$1 && typeof window$1.atob !== 'undefined'); +} + +function isAboveVersion9 () { + return ie() && hasAtobCheck(); +} + +function isAboveVersion10 () { + return ie() && hasAtobCheck() && !activeXCheck(); +} + +function isAboveVersion11 () { + return ie() && functionalEventCheck(); +} + +function hasCompatModeCheck () { + return Boolean(document && typeof document.compatMode !== 'undefined'); +} + +function isBelowVersion6 () { + return ie() && (!hasCompatModeCheck() || hasBackCompatCheck()); +} + +function isBelowVersion7 () { + return ie() && !hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function isBelowVersion8 () { + return ie() && !hasQuerySelectorCheck(); +} + +function isBelowVersion9 () { + return ie() && !hasAddEventListenerCheck(); +} + +function isBelowVersion10 () { + return ie() && !hasAtobCheck(); +} + +function isBelowVersion11 () { + return ie() && !hasAtobCheck() && activeXCheck(); +} + +function isBelowVersion12 () { + return ie() && !functionalEventCheck(); +} + +function isAboveVersion5 () { + return ie() && hasBackCompatCheck(); +} + +function isVersion6 () { + return isAboveVersion5() && isBelowVersion7(); +} + +function isVersion7 () { + return isAboveVersion6() && isBelowVersion8(); +} + +function isVersion8 () { + return isAboveVersion7() && isBelowVersion9(); +} + +function isVersion9 () { + return isAboveVersion8() && isBelowVersion10(); +} + +function isVersion10 () { + return isAboveVersion9() && isBelowVersion11(); +} + +function isVersion11 () { + return isAboveVersion10() && isBelowVersion12(); +} + + + +var ie$1 = Object.freeze({ + isAboveVersion6: isAboveVersion6, + isAboveVersion7: isAboveVersion7, + isAboveVersion8: isAboveVersion8, + isAboveVersion9: isAboveVersion9, + isAboveVersion10: isAboveVersion10, + isAboveVersion11: isAboveVersion11, + isBelowVersion6: isBelowVersion6, + isBelowVersion7: isBelowVersion7, + isBelowVersion8: isBelowVersion8, + isBelowVersion9: isBelowVersion9, + isBelowVersion10: isBelowVersion10, + isBelowVersion11: isBelowVersion11, + isBelowVersion12: isBelowVersion12, + isVersion6: isVersion6, + isVersion7: isVersion7, + isVersion8: isVersion8, + isVersion9: isVersion9, + isVersion10: isVersion10, + isVersion11: isVersion11 +}); + +function hasChromeWebstoreInstallCheck () { + return Boolean(window$1 && window$1.chrome && window$1.chrome.webstore && window$1.chrome.webstore.install); +} + +function isAboveVersion15 () { + return chrome() && hasChromeWebstoreInstallCheck(); +} + + + +var chrome$1 = Object.freeze({ + isAboveVersion15: isAboveVersion15 +}); + +var versions = { + ie: ie$1, + chrome: chrome$1 +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var Detective = function () { + function Detective() { + classCallCheck(this, Detective); + } + + createClass(Detective, [{ + key: 'isWebKit', + get: function get() { + return webkit(); + } + }, { + key: 'isOpera', + get: function get() { + return opera(); + } + }, { + key: 'isIE', + get: function get() { + return ie(); + } + }, { + key: 'isFirefox', + get: function get() { + return firefox(); + } + }, { + key: 'isSafari', + get: function get() { + return safari(); + } + }, { + key: 'isKhtml', + get: function get() { + return khtml(); + } + }, { + key: 'isOperaNext', + get: function get() { + return operaNext(); + } + }, { + key: 'isChrome', + get: function get() { + return chrome(); + } + }, { + key: 'isEdge', + get: function get() { + return edge(); + } + }, { + key: 'isUndetected', + get: function get() { + return undetected(); + } + }, { + key: 'standardsCompliant', + get: function get() { + return versions.ie.isAboveVersion9() || !ie(); + } + }, { + key: 'chromeIsAbove15', + get: function get() { + return versions.chrome.isAboveVersion15(); + } + }, { + key: 'ieIsVersion11', + get: function get() { + return versions.ie.isVersion11(); + } + }, { + key: 'ieIsVersion10', + get: function get() { + return versions.ie.isVersion10(); + } + }, { + key: 'ieIsVersion9', + get: function get() { + return versions.ie.isVersion9(); + } + }, { + key: 'ieIsVersion8', + get: function get() { + return versions.ie.isVersion8(); + } + }, { + key: 'ieIsVersion7', + get: function get() { + return versions.ie.isVersion7(); + } + }, { + key: 'ieIsVersion6', + get: function get() { + return versions.ie.isVersion6(); + } + }, { + key: 'ieIsBelowVersion6', + get: function get() { + return versions.ie.isBelowVersion6(); + } + }, { + key: 'ieIsBelowVersion7', + get: function get() { + return versions.ie.isBelowVersion7(); + } + }, { + key: 'ieIsBelowVersion8', + get: function get() { + return versions.ie.isBelowVersion8(); + } + }, { + key: 'ieIsBelowVersion9', + get: function get() { + return versions.ie.isBelowVersion9(); + } + }, { + key: 'ieIsBelowVersion10', + get: function get() { + return versions.ie.isBelowVersion10(); + } + }, { + key: 'ieIsBelowVersion11', + get: function get() { + return versions.ie.isBelowVersion11(); + } + }, { + key: 'ieIsBelowVersion12', + get: function get() { + return versions.ie.isBelowVersion12(); + } + }, { + key: 'ieIsAboveVersion5', + get: function get() { + return versions.ie.isAboveVersion5(); + } + }, { + key: 'ieIsAboveVersion6', + get: function get() { + return versions.ie.isAboveVersion6(); + } + }, { + key: 'ieIsAboveVersion7', + get: function get() { + return versions.ie.isAboveVersion7(); + } + }, { + key: 'ieIsAboveVersion8', + get: function get() { + return versions.ie.isAboveVersion8(); + } + }, { + key: 'ieIsAboveVersion9', + get: function get() { + return versions.ie.isAboveVersion9(); + } + }, { + key: 'ieIsAboveVersion10', + get: function get() { + return versions.ie.isAboveVersion10(); + } + }, { + key: 'ieIsAboveVersion11', + get: function get() { + return versions.ie.isAboveVersion11(); + } + }]); + return Detective; +}(); + +var classes = { + IE: 'ie', + CHROME: 'chrome', + SAFARI: 'safari', + OPERA: 'opera', + OPERANEXT: 'opera-next', + FIREFOX: 'firefox', + KHTML: 'khtml', + WEBKIT: 'webkit', + EDGE: 'edge', + UNKNOWN: 'undetected-browser', + + IE_LESSTHAN_6: 'ie-lt-6', + IE_LESSTHAN_7: 'ie-lt-7', + IE_LESSTHAN_8: 'ie-lt-8', + IE_LESSTHAN_9: 'ie-lt-9', + IE_LESSTHAN_10: 'ie-lt-10', + IE_LESSTHAN_11: 'ie-lt-11', + IE_LESSTHAN_12: 'ie-lt-12', + + IE_GREATERTHAN_6: 'ie-gt-6', + IE_GREATERTHAN_7: 'ie-gt-7', + IE_GREATERTHAN_8: 'ie-gt-8', + IE_GREATERTHAN_9: 'ie-gt-9', + IE_GREATERTHAN_10: 'ie-gt-10', + IE_GREATERTHAN_11: 'ie-gt-11', + + IE_VERSION_6: 'ie-verion-6', + IE_VERSION_7: 'ie-version-7', + IE_VERSION_8: 'ie-version-8', + IE_VERSION_9: 'ie-version-9', + IE_VERSION_10: 'ie-version-10', + IE_VERSION_11: 'ie-version-11' +}; + +var tags = { + DEFUNCTR: 'defunctr', + VERSION_OFF: 'defunctr-version-off', + IE_ONLY: 'defunctr-ie-only', + IE_LESSTHAN_OFF: 'defunctr-lt-off', + IE_GREATERTHAN_OFF: 'defunctr-gt-off', + NOTAGGING: 'defunctr-off' +}; + +var prefix = ''; + +function prefixedClassFor (className) { + return '' + prefix + className; +} + +var docElement = document && document.documentElement && document.documentElement.className ? document.documentElement : { className: '' }; + +function makeTest(item) { + return function test() { + return item; + }; +} + +function test(key, test) { + if (Modernizr) { + Modernizr.addTest(key, test); + } else { + if (test()) { + addTag(key); + } else { + addTag('no-' + key); + } + } +} + +function removeTag(tag) { + docElement.className = docElement.className.replace(new RegExp('\\b' + tag + '\\b'), ''); +} + +function addTag(tag) { + if (!hasTag(tag)) { + docElement.className += docElement.className.length > 0 ? ' ' + tag : tag; + } +} + +function hasTag(tag) { + return docElement.className.match(new RegExp('\\b' + tag + '\\b')); +} + +function tagPage(detective) { + if (!hasTag(tags.NOTAGGING)) { + test(prefixedClassFor(classes.IE), makeTest(detective.isIE)); + + if (!hasTag(tags.IE_ONLY)) { + test(prefixedClassFor(classes.CHROME), makeTest(detective.isChrome)); + test(prefixedClassFor(classes.SAFARI), makeTest(detective.isSafari)); + test(prefixedClassFor(classes.OPERA), makeTest(detective.isOpera)); + test(prefixedClassFor(classes.OPERANEXT), makeTest(detective.isOperaNext)); + test(prefixedClassFor(classes.FIREFOX), makeTest(detective.isFirefox)); + test(prefixedClassFor(classes.KHTML), makeTest(detective.isKhtml)); + test(prefixedClassFor(classes.WEBKIT), makeTest(detective.isWebKit)); + test(prefixedClassFor(classes.EDGE), makeTest(detective.isEdge)); + test(prefixedClassFor(classes.UNKNOWN), makeTest(detective.isUndetected)); + } + + if (!hasTag(tags.IE_LESSTHAN_OFF)) { + test(prefixedClassFor(classes.IE_LESSTHAN_6), makeTest(detective.ieBelowVersion6)); + test(prefixedClassFor(classes.IE_LESSTHAN_7), makeTest(detective.ieBelowVersion7)); + test(prefixedClassFor(classes.IE_LESSTHAN_8), makeTest(detective.ieBelowVersion8)); + test(prefixedClassFor(classes.IE_LESSTHAN_9), makeTest(detective.ieBelowVersion9)); + test(prefixedClassFor(classes.IE_LESSTHAN_10), makeTest(detective.ieBelowVersion10)); + test(prefixedClassFor(classes.IE_LESSTHAN_11), makeTest(detective.ieBelowVersion11)); + test(prefixedClassFor(classes.IE_LESSTHAN_12), makeTest(detective.ieBelowVersion12)); + } + + if (!hasTag(tags.IE_GREATERTHAN_OFF)) { + test(prefixedClassFor(classes.IE_GREATERTHAN_6), makeTest(detective.ieAboveVersion6)); + test(prefixedClassFor(classes.IE_GREATERTHAN_7), makeTest(detective.ieAboveVersion7)); + test(prefixedClassFor(classes.IE_GREATERTHAN_8), makeTest(detective.ieAboveVersion8)); + test(prefixedClassFor(classes.IE_GREATERTHAN_9), makeTest(detective.ieAboveVersion9)); + test(prefixedClassFor(classes.IE_GREATERTHAN_10), makeTest(detective.ieAboveVersion10)); + test(prefixedClassFor(classes.IE_GREATERTHAN_11), makeTest(detective.ieAboveVersion11)); + } + + if (!hasTag(tags.VERSION_OFF)) { + test(prefixedClassFor(classes.IE_VERSION_6), makeTest(detective.ieIsVersion6)); + test(prefixedClassFor(classes.IE_VERSION_7), makeTest(detective.ieIsVersion7)); + test(prefixedClassFor(classes.IE_VERSION_8), makeTest(detective.ieIsVersion8)); + test(prefixedClassFor(classes.IE_VERSION_9), makeTest(detective.ieIsVersion9)); + test(prefixedClassFor(classes.IE_VERSION_10), makeTest(detective.ieIsVersion10)); + test(prefixedClassFor(classes.IE_VERSION_11), makeTest(detective.ieIsVersion11)); + } + } + cleanTags(); +} + +function cleanTags() { + removeTag(tags.IE_GREATERTHAN_OFF); + removeTag(tags.IE_LESSTHAN_OFF); + removeTag(tags.VERSION_OFF); + removeTag(tags.IE_ONLY); + removeTag(tags.DEFUNCTR); + removeTag(tags.NOTAGGING); +} + +function tagger (detective) { + return { + tag: function tag() { + if (document) { + tagPage(detective); + } + } + }; +} + +var detective = new Detective(); + +var Defunctr = function () { + function Defunctr() { + classCallCheck(this, Defunctr); + + this.version = '1.3.0-beta1'; + } + + createClass(Defunctr, [{ + key: 'detective', + get: function get() { + return detective; + } + }]); + return Defunctr; +}(); + +var defunctr = new Defunctr(); + +if (window) { + tagger(detective).tag(); + + window.defunctr = defunctr; + if (Object.defineProperty) { + Object.defineProperty(window, 'Defunctr', { + get: function get() { + logger.warn('window.Defunctr is deprecated and will be removed. Please use window.defunctr'); + return defunctr; + }, + enumerable: true, + configurable: true + }); + } else { + window.Defunctr = defunctr; + } +} + +return defunctr; + +}))); \ No newline at end of file diff --git a/release/defunctr-1.3.0-beta1.min.js b/release/defunctr-1.3.0-beta1.min.js new file mode 100644 index 0000000..00915be --- /dev/null +++ b/release/defunctr-1.3.0-beta1.min.js @@ -0,0 +1,11 @@ +/*! + * Defunctr 1.3.0-beta1 + * https://github.com/cinecove/defunctr + * + * Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors + * Released under the MIT license + * https://github.com/cinecove/defunctr/blob/master/LICENSE.md + * + * Build Date: 2016-08-24T17:04:24.709Z + */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("modernizr")):"function"==typeof define&&define.amd?define(["modernizr"],n):e.defunctr=n(e.Modernizr)}(this,function(Modernizr){"use strict";function e(){return Boolean(ie&&ie.HTMLElement&&Object.prototype.toString.call(ie.HTMLElement).indexOf("Constructor")>0)}function n(){return e()}function i(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"WebkitTransform"in te.documentElement.style)}function o(){return Boolean(ie&&"undefined"!=typeof ie.msWriteProfilerMark)}function t(){return i()&&o()===!1}function r(){return Boolean(oe&&oe.userAgent&&/(Opera|OPR)/.test(oe.userAgent))}function u(){return t()&&r()}function s(){return!n()&&!u()&&t()}function c(){return"ActiveXObject"in ie}function f(){return Boolean(ie&&ie.Event&&"function"==typeof ie.Event)}function E(){return Boolean(!c()&&f()&&o())}function l(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"MozBoxSizing"in te.documentElement.style)}function I(){return l()}function V(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"KhtmlMarquee"in te.documentElement.style)}function a(){return V()}function _(){return Boolean(ie&&ie.opera&&ie.opera.version!==re)}function A(){return _()}function d(){return c()}function N(){return!(t()||d()||s()||E()||I()||A()||u()||n())}function m(){return Boolean(ie&&"undefined"!=typeof ie.XMLHttpRequest)}function T(){return Boolean(te&&te.compatMode&&"BackCompat"===te.compatMode)}function R(){return d()&&T()&&!m()}function g(){return Boolean(te&&"undefined"!==te.querySelector)}function b(){return d()&&g()}function w(){return Boolean(te&&"undefined"!==te.addEventListener)}function y(){return d()&&w()}function S(){return Boolean(ie&&"undefined"!=typeof ie.atob)}function O(){return d()&&S()}function v(){return d()&&S()&&!c()}function B(){return d()&&f()}function k(){return Boolean(te&&"undefined"!=typeof te.compatMode)}function H(){return d()&&(!k()||T())}function p(){return d()&&!T()&&!m()}function F(){return d()&&!g()}function G(){return d()&&!w()}function L(){return d()&&!S()}function h(){return d()&&!S()&&c()}function M(){return d()&&!f()}function x(){return d()&&T()}function K(){return x()&&p()}function C(){return R()&&F()}function P(){return b()&&G()}function j(){return y()&&L()}function W(){return O()&&h()}function z(){return v()&&M()}function D(){return Boolean(ie&&ie.chrome&&ie.chrome.webstore&&ie.chrome.webstore.install)}function U(){return s()&&D()}function X(e){return""+Te+e}function q(e){return function(){return e}}function Y(e,n){Modernizr?Modernizr.addTest(e,n):Q(n()?e:"no-"+e)}function J(e){Re.className=Re.className.replace(new RegExp("\\b"+e+"\\b"),"")}function Q(e){Z(e)||(Re.className+=Re.className.length>0?" "+e:e)}function Z(e){return Re.className.match(new RegExp("\\b"+e+"\\b"))}function $(e){Z(me.NOTAGGING)||(Y(X(Ne.IE),q(e.isIE)),Z(me.IE_ONLY)||(Y(X(Ne.CHROME),q(e.isChrome)),Y(X(Ne.SAFARI),q(e.isSafari)),Y(X(Ne.OPERA),q(e.isOpera)),Y(X(Ne.OPERANEXT),q(e.isOperaNext)),Y(X(Ne.FIREFOX),q(e.isFirefox)),Y(X(Ne.KHTML),q(e.isKhtml)),Y(X(Ne.WEBKIT),q(e.isWebKit)),Y(X(Ne.EDGE),q(e.isEdge)),Y(X(Ne.UNKNOWN),q(e.isUndetected))),Z(me.IE_LESSTHAN_OFF)||(Y(X(Ne.IE_LESSTHAN_6),q(e.ieBelowVersion6)),Y(X(Ne.IE_LESSTHAN_7),q(e.ieBelowVersion7)),Y(X(Ne.IE_LESSTHAN_8),q(e.ieBelowVersion8)),Y(X(Ne.IE_LESSTHAN_9),q(e.ieBelowVersion9)),Y(X(Ne.IE_LESSTHAN_10),q(e.ieBelowVersion10)),Y(X(Ne.IE_LESSTHAN_11),q(e.ieBelowVersion11)),Y(X(Ne.IE_LESSTHAN_12),q(e.ieBelowVersion12))),Z(me.IE_GREATERTHAN_OFF)||(Y(X(Ne.IE_GREATERTHAN_6),q(e.ieAboveVersion6)),Y(X(Ne.IE_GREATERTHAN_7),q(e.ieAboveVersion7)),Y(X(Ne.IE_GREATERTHAN_8),q(e.ieAboveVersion8)),Y(X(Ne.IE_GREATERTHAN_9),q(e.ieAboveVersion9)),Y(X(Ne.IE_GREATERTHAN_10),q(e.ieAboveVersion10)),Y(X(Ne.IE_GREATERTHAN_11),q(e.ieAboveVersion11))),Z(me.VERSION_OFF)||(Y(X(Ne.IE_VERSION_6),q(e.ieIsVersion6)),Y(X(Ne.IE_VERSION_7),q(e.ieIsVersion7)),Y(X(Ne.IE_VERSION_8),q(e.ieIsVersion8)),Y(X(Ne.IE_VERSION_9),q(e.ieIsVersion9)),Y(X(Ne.IE_VERSION_10),q(e.ieIsVersion10)),Y(X(Ne.IE_VERSION_11),q(e.ieIsVersion11)))),ee()}function ee(){J(me.IE_GREATERTHAN_OFF),J(me.IE_LESSTHAN_OFF),J(me.VERSION_OFF),J(me.IE_ONLY),J(me.DEFUNCTR),J(me.NOTAGGING)}function ne(e){return{tag:function(){te&&$(e)}}}Modernizr="default"in Modernizr?Modernizr.default:Modernizr;var ie=window||null,oe=navigator||null,te=ie?ie.document||null:null,re=void 0,ue=function(){},se=ie&&ie.console?ie.console:void 0,ce=se?se.log||ue:ue,fe=se?se.warn||ce:ue,Ee=se?se.error||ce:ue,le={log:ce,warn:fe,error:Ee},Ie=Object.freeze({isAboveVersion6:R,isAboveVersion7:b,isAboveVersion8:y,isAboveVersion9:O,isAboveVersion10:v,isAboveVersion11:B,isBelowVersion6:H,isBelowVersion7:p,isBelowVersion8:F,isBelowVersion9:G,isBelowVersion10:L,isBelowVersion11:h,isBelowVersion12:M,isVersion6:K,isVersion7:C,isVersion8:P,isVersion9:j,isVersion10:W,isVersion11:z}),Ve=Object.freeze({isAboveVersion15:U}),ae={ie:Ie,chrome:Ve},_e=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},Ae=function(){function e(e,n){for(var i=0;i 0); +} + +function safari () { + return htmlElementConstructorCheck(); +} + +function webKitTransformCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'WebkitTransform' in document.documentElement.style); +} + +function msWriteProfilerMarkCheck () { + return Boolean(window$1 && typeof window$1.msWriteProfilerMark !== 'undefined'); +} + +function webkit () { + return webKitTransformCheck() && msWriteProfilerMarkCheck() === false; +} + + +function hasOperaHeader() { + return Boolean(navigator$1 && navigator$1.userAgent && /(Opera|OPR)/.test(navigator$1.userAgent)); +} + +function operaNext () { + return webkit() && hasOperaHeader(); +} + +function chrome () { + return !safari() && !operaNext() && webkit(); +} + +function activeXCheck () { + return 'ActiveXObject' in window$1; +} + +function functionalEventCheck () { + return Boolean(window$1 && window$1.Event && typeof window$1.Event === 'function'); +} + +function edge () { + return Boolean(!activeXCheck() && functionalEventCheck() && msWriteProfilerMarkCheck()); +} + +function mozBoxSizingCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'MozBoxSizing' in document.documentElement.style); +} + +function firefox () { + return mozBoxSizingCheck(); +} + +function khtmlMarqueeCheck () { + return Boolean(document && document.documentElement && document.documentElement.style && 'KhtmlMarquee' in document.documentElement.style); +} + +function khtml () { + return khtmlMarqueeCheck(); +} + +function operaVersionCheck () { + return Boolean(window$1 && window$1.opera && window$1.opera.version !== _undefined); +} + +function opera () { + return operaVersionCheck(); +} + + + +function ie () { + return activeXCheck(); +} + +function undetected () { + return !webkit() && !ie() && !chrome() && !edge() && !firefox() && !opera() && !operaNext() && !safari(); +} + +function hasXmlHttpRequestCheck () { + return Boolean(window$1 && typeof window$1.XMLHttpRequest !== 'undefined'); +} + +function hasBackCompatCheck () { + return Boolean(document && document.compatMode && document.compatMode === 'BackCompat'); +} + +function isAboveVersion6 () { + return ie() && hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function hasQuerySelectorCheck () { + return Boolean(document && document.querySelector !== 'undefined'); +} + +function isAboveVersion7 () { + return ie() && hasQuerySelectorCheck(); +} + +function hasAddEventListenerCheck () { + return Boolean(document && document.addEventListener !== 'undefined'); +} + +function isAboveVersion8 () { + return ie() && hasAddEventListenerCheck(); +} + +function hasAtobCheck () { + return Boolean(window$1 && typeof window$1.atob !== 'undefined'); +} + +function isAboveVersion9 () { + return ie() && hasAtobCheck(); +} + +function isAboveVersion10 () { + return ie() && hasAtobCheck() && !activeXCheck(); +} + +function isAboveVersion11 () { + return ie() && functionalEventCheck(); +} + +function hasCompatModeCheck () { + return Boolean(document && typeof document.compatMode !== 'undefined'); +} + +function isBelowVersion6 () { + return ie() && (!hasCompatModeCheck() || hasBackCompatCheck()); +} + +function isBelowVersion7 () { + return ie() && !hasBackCompatCheck() && !hasXmlHttpRequestCheck(); +} + +function isBelowVersion8 () { + return ie() && !hasQuerySelectorCheck(); +} + +function isBelowVersion9 () { + return ie() && !hasAddEventListenerCheck(); +} + +function isBelowVersion10 () { + return ie() && !hasAtobCheck(); +} + +function isBelowVersion11 () { + return ie() && !hasAtobCheck() && activeXCheck(); +} + +function isBelowVersion12 () { + return ie() && !functionalEventCheck(); +} + +function isAboveVersion5 () { + return ie() && hasBackCompatCheck(); +} + +function isVersion6 () { + return isAboveVersion5() && isBelowVersion7(); +} + +function isVersion7 () { + return isAboveVersion6() && isBelowVersion8(); +} + +function isVersion8 () { + return isAboveVersion7() && isBelowVersion9(); +} + +function isVersion9 () { + return isAboveVersion8() && isBelowVersion10(); +} + +function isVersion10 () { + return isAboveVersion9() && isBelowVersion11(); +} + +function isVersion11 () { + return isAboveVersion10() && isBelowVersion12(); +} + + + +var ie$1 = Object.freeze({ + isAboveVersion6: isAboveVersion6, + isAboveVersion7: isAboveVersion7, + isAboveVersion8: isAboveVersion8, + isAboveVersion9: isAboveVersion9, + isAboveVersion10: isAboveVersion10, + isAboveVersion11: isAboveVersion11, + isBelowVersion6: isBelowVersion6, + isBelowVersion7: isBelowVersion7, + isBelowVersion8: isBelowVersion8, + isBelowVersion9: isBelowVersion9, + isBelowVersion10: isBelowVersion10, + isBelowVersion11: isBelowVersion11, + isBelowVersion12: isBelowVersion12, + isVersion6: isVersion6, + isVersion7: isVersion7, + isVersion8: isVersion8, + isVersion9: isVersion9, + isVersion10: isVersion10, + isVersion11: isVersion11 +}); + +function hasChromeWebstoreInstallCheck () { + return Boolean(window$1 && window$1.chrome && window$1.chrome.webstore && window$1.chrome.webstore.install); +} + +function isAboveVersion15 () { + return chrome() && hasChromeWebstoreInstallCheck(); +} + + + +var chrome$1 = Object.freeze({ + isAboveVersion15: isAboveVersion15 +}); + +var versions = { + ie: ie$1, + chrome: chrome$1 +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var Detective = function () { + function Detective() { + classCallCheck(this, Detective); + } + + createClass(Detective, [{ + key: 'isWebKit', + get: function get() { + return webkit(); + } + }, { + key: 'isOpera', + get: function get() { + return opera(); + } + }, { + key: 'isIE', + get: function get() { + return ie(); + } + }, { + key: 'isFirefox', + get: function get() { + return firefox(); + } + }, { + key: 'isSafari', + get: function get() { + return safari(); + } + }, { + key: 'isKhtml', + get: function get() { + return khtml(); + } + }, { + key: 'isOperaNext', + get: function get() { + return operaNext(); + } + }, { + key: 'isChrome', + get: function get() { + return chrome(); + } + }, { + key: 'isEdge', + get: function get() { + return edge(); + } + }, { + key: 'isUndetected', + get: function get() { + return undetected(); + } + }, { + key: 'standardsCompliant', + get: function get() { + return versions.ie.isAboveVersion9() || !ie(); + } + }, { + key: 'chromeIsAbove15', + get: function get() { + return versions.chrome.isAboveVersion15(); + } + }, { + key: 'ieIsVersion11', + get: function get() { + return versions.ie.isVersion11(); + } + }, { + key: 'ieIsVersion10', + get: function get() { + return versions.ie.isVersion10(); + } + }, { + key: 'ieIsVersion9', + get: function get() { + return versions.ie.isVersion9(); + } + }, { + key: 'ieIsVersion8', + get: function get() { + return versions.ie.isVersion8(); + } + }, { + key: 'ieIsVersion7', + get: function get() { + return versions.ie.isVersion7(); + } + }, { + key: 'ieIsVersion6', + get: function get() { + return versions.ie.isVersion6(); + } + }, { + key: 'ieIsBelowVersion6', + get: function get() { + return versions.ie.isBelowVersion6(); + } + }, { + key: 'ieIsBelowVersion7', + get: function get() { + return versions.ie.isBelowVersion7(); + } + }, { + key: 'ieIsBelowVersion8', + get: function get() { + return versions.ie.isBelowVersion8(); + } + }, { + key: 'ieIsBelowVersion9', + get: function get() { + return versions.ie.isBelowVersion9(); + } + }, { + key: 'ieIsBelowVersion10', + get: function get() { + return versions.ie.isBelowVersion10(); + } + }, { + key: 'ieIsBelowVersion11', + get: function get() { + return versions.ie.isBelowVersion11(); + } + }, { + key: 'ieIsBelowVersion12', + get: function get() { + return versions.ie.isBelowVersion12(); + } + }, { + key: 'ieIsAboveVersion5', + get: function get() { + return versions.ie.isAboveVersion5(); + } + }, { + key: 'ieIsAboveVersion6', + get: function get() { + return versions.ie.isAboveVersion6(); + } + }, { + key: 'ieIsAboveVersion7', + get: function get() { + return versions.ie.isAboveVersion7(); + } + }, { + key: 'ieIsAboveVersion8', + get: function get() { + return versions.ie.isAboveVersion8(); + } + }, { + key: 'ieIsAboveVersion9', + get: function get() { + return versions.ie.isAboveVersion9(); + } + }, { + key: 'ieIsAboveVersion10', + get: function get() { + return versions.ie.isAboveVersion10(); + } + }, { + key: 'ieIsAboveVersion11', + get: function get() { + return versions.ie.isAboveVersion11(); + } + }]); + return Detective; +}(); + +var classes = { + IE: 'ie', + CHROME: 'chrome', + SAFARI: 'safari', + OPERA: 'opera', + OPERANEXT: 'opera-next', + FIREFOX: 'firefox', + KHTML: 'khtml', + WEBKIT: 'webkit', + EDGE: 'edge', + UNKNOWN: 'undetected-browser', + + IE_LESSTHAN_6: 'ie-lt-6', + IE_LESSTHAN_7: 'ie-lt-7', + IE_LESSTHAN_8: 'ie-lt-8', + IE_LESSTHAN_9: 'ie-lt-9', + IE_LESSTHAN_10: 'ie-lt-10', + IE_LESSTHAN_11: 'ie-lt-11', + IE_LESSTHAN_12: 'ie-lt-12', + + IE_GREATERTHAN_6: 'ie-gt-6', + IE_GREATERTHAN_7: 'ie-gt-7', + IE_GREATERTHAN_8: 'ie-gt-8', + IE_GREATERTHAN_9: 'ie-gt-9', + IE_GREATERTHAN_10: 'ie-gt-10', + IE_GREATERTHAN_11: 'ie-gt-11', + + IE_VERSION_6: 'ie-verion-6', + IE_VERSION_7: 'ie-version-7', + IE_VERSION_8: 'ie-version-8', + IE_VERSION_9: 'ie-version-9', + IE_VERSION_10: 'ie-version-10', + IE_VERSION_11: 'ie-version-11' +}; + +var tags = { + DEFUNCTR: 'defunctr', + VERSION_OFF: 'defunctr-version-off', + IE_ONLY: 'defunctr-ie-only', + IE_LESSTHAN_OFF: 'defunctr-lt-off', + IE_GREATERTHAN_OFF: 'defunctr-gt-off', + NOTAGGING: 'defunctr-off' +}; + +var prefix = ''; + +function prefixedClassFor (className) { + return '' + prefix + className; +} + +var docElement = document && document.documentElement && document.documentElement.className ? document.documentElement : { className: '' }; + +function makeTest(item) { + return function test() { + return item; + }; +} + +function test(key, test) { + if (Modernizr) { + Modernizr.addTest(key, test); + } else { + if (test()) { + addTag(key); + } else { + addTag('no-' + key); + } + } +} + +function removeTag(tag) { + docElement.className = docElement.className.replace(new RegExp('\\b' + tag + '\\b'), ''); +} + +function addTag(tag) { + if (!hasTag(tag)) { + docElement.className += docElement.className.length > 0 ? ' ' + tag : tag; + } +} + +function hasTag(tag) { + return docElement.className.match(new RegExp('\\b' + tag + '\\b')); +} + +function tagPage(detective) { + if (!hasTag(tags.NOTAGGING)) { + test(prefixedClassFor(classes.IE), makeTest(detective.isIE)); + + if (!hasTag(tags.IE_ONLY)) { + test(prefixedClassFor(classes.CHROME), makeTest(detective.isChrome)); + test(prefixedClassFor(classes.SAFARI), makeTest(detective.isSafari)); + test(prefixedClassFor(classes.OPERA), makeTest(detective.isOpera)); + test(prefixedClassFor(classes.OPERANEXT), makeTest(detective.isOperaNext)); + test(prefixedClassFor(classes.FIREFOX), makeTest(detective.isFirefox)); + test(prefixedClassFor(classes.KHTML), makeTest(detective.isKhtml)); + test(prefixedClassFor(classes.WEBKIT), makeTest(detective.isWebKit)); + test(prefixedClassFor(classes.EDGE), makeTest(detective.isEdge)); + test(prefixedClassFor(classes.UNKNOWN), makeTest(detective.isUndetected)); + } + + if (!hasTag(tags.IE_LESSTHAN_OFF)) { + test(prefixedClassFor(classes.IE_LESSTHAN_6), makeTest(detective.ieBelowVersion6)); + test(prefixedClassFor(classes.IE_LESSTHAN_7), makeTest(detective.ieBelowVersion7)); + test(prefixedClassFor(classes.IE_LESSTHAN_8), makeTest(detective.ieBelowVersion8)); + test(prefixedClassFor(classes.IE_LESSTHAN_9), makeTest(detective.ieBelowVersion9)); + test(prefixedClassFor(classes.IE_LESSTHAN_10), makeTest(detective.ieBelowVersion10)); + test(prefixedClassFor(classes.IE_LESSTHAN_11), makeTest(detective.ieBelowVersion11)); + test(prefixedClassFor(classes.IE_LESSTHAN_12), makeTest(detective.ieBelowVersion12)); + } + + if (!hasTag(tags.IE_GREATERTHAN_OFF)) { + test(prefixedClassFor(classes.IE_GREATERTHAN_6), makeTest(detective.ieAboveVersion6)); + test(prefixedClassFor(classes.IE_GREATERTHAN_7), makeTest(detective.ieAboveVersion7)); + test(prefixedClassFor(classes.IE_GREATERTHAN_8), makeTest(detective.ieAboveVersion8)); + test(prefixedClassFor(classes.IE_GREATERTHAN_9), makeTest(detective.ieAboveVersion9)); + test(prefixedClassFor(classes.IE_GREATERTHAN_10), makeTest(detective.ieAboveVersion10)); + test(prefixedClassFor(classes.IE_GREATERTHAN_11), makeTest(detective.ieAboveVersion11)); + } + + if (!hasTag(tags.VERSION_OFF)) { + test(prefixedClassFor(classes.IE_VERSION_6), makeTest(detective.ieIsVersion6)); + test(prefixedClassFor(classes.IE_VERSION_7), makeTest(detective.ieIsVersion7)); + test(prefixedClassFor(classes.IE_VERSION_8), makeTest(detective.ieIsVersion8)); + test(prefixedClassFor(classes.IE_VERSION_9), makeTest(detective.ieIsVersion9)); + test(prefixedClassFor(classes.IE_VERSION_10), makeTest(detective.ieIsVersion10)); + test(prefixedClassFor(classes.IE_VERSION_11), makeTest(detective.ieIsVersion11)); + } + } + cleanTags(); +} + +function cleanTags() { + removeTag(tags.IE_GREATERTHAN_OFF); + removeTag(tags.IE_LESSTHAN_OFF); + removeTag(tags.VERSION_OFF); + removeTag(tags.IE_ONLY); + removeTag(tags.DEFUNCTR); + removeTag(tags.NOTAGGING); +} + +function tagger (detective) { + return { + tag: function tag() { + if (document) { + tagPage(detective); + } + } + }; +} + +var detective = new Detective(); + +var Defunctr = function () { + function Defunctr() { + classCallCheck(this, Defunctr); + + this.version = '1.3.0-beta1'; + } + + createClass(Defunctr, [{ + key: 'detective', + get: function get() { + return detective; + } + }]); + return Defunctr; +}(); + +var defunctr = new Defunctr(); + +if (window) { + tagger(detective).tag(); + + window.defunctr = defunctr; + if (Object.defineProperty) { + Object.defineProperty(window, 'Defunctr', { + get: function get() { + logger.warn('window.Defunctr is deprecated and will be removed. Please use window.defunctr'); + return defunctr; + }, + enumerable: true, + configurable: true + }); + } else { + window.Defunctr = defunctr; + } +} + +return defunctr; + +}))); \ No newline at end of file diff --git a/release/defunctr.min.js b/release/defunctr.min.js new file mode 100644 index 0000000..00915be --- /dev/null +++ b/release/defunctr.min.js @@ -0,0 +1,11 @@ +/*! + * Defunctr 1.3.0-beta1 + * https://github.com/cinecove/defunctr + * + * Copyright 2012 - 2016 Cinecove Digital, LLC and other contributors + * Released under the MIT license + * https://github.com/cinecove/defunctr/blob/master/LICENSE.md + * + * Build Date: 2016-08-24T17:04:24.709Z + */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("modernizr")):"function"==typeof define&&define.amd?define(["modernizr"],n):e.defunctr=n(e.Modernizr)}(this,function(Modernizr){"use strict";function e(){return Boolean(ie&&ie.HTMLElement&&Object.prototype.toString.call(ie.HTMLElement).indexOf("Constructor")>0)}function n(){return e()}function i(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"WebkitTransform"in te.documentElement.style)}function o(){return Boolean(ie&&"undefined"!=typeof ie.msWriteProfilerMark)}function t(){return i()&&o()===!1}function r(){return Boolean(oe&&oe.userAgent&&/(Opera|OPR)/.test(oe.userAgent))}function u(){return t()&&r()}function s(){return!n()&&!u()&&t()}function c(){return"ActiveXObject"in ie}function f(){return Boolean(ie&&ie.Event&&"function"==typeof ie.Event)}function E(){return Boolean(!c()&&f()&&o())}function l(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"MozBoxSizing"in te.documentElement.style)}function I(){return l()}function V(){return Boolean(te&&te.documentElement&&te.documentElement.style&&"KhtmlMarquee"in te.documentElement.style)}function a(){return V()}function _(){return Boolean(ie&&ie.opera&&ie.opera.version!==re)}function A(){return _()}function d(){return c()}function N(){return!(t()||d()||s()||E()||I()||A()||u()||n())}function m(){return Boolean(ie&&"undefined"!=typeof ie.XMLHttpRequest)}function T(){return Boolean(te&&te.compatMode&&"BackCompat"===te.compatMode)}function R(){return d()&&T()&&!m()}function g(){return Boolean(te&&"undefined"!==te.querySelector)}function b(){return d()&&g()}function w(){return Boolean(te&&"undefined"!==te.addEventListener)}function y(){return d()&&w()}function S(){return Boolean(ie&&"undefined"!=typeof ie.atob)}function O(){return d()&&S()}function v(){return d()&&S()&&!c()}function B(){return d()&&f()}function k(){return Boolean(te&&"undefined"!=typeof te.compatMode)}function H(){return d()&&(!k()||T())}function p(){return d()&&!T()&&!m()}function F(){return d()&&!g()}function G(){return d()&&!w()}function L(){return d()&&!S()}function h(){return d()&&!S()&&c()}function M(){return d()&&!f()}function x(){return d()&&T()}function K(){return x()&&p()}function C(){return R()&&F()}function P(){return b()&&G()}function j(){return y()&&L()}function W(){return O()&&h()}function z(){return v()&&M()}function D(){return Boolean(ie&&ie.chrome&&ie.chrome.webstore&&ie.chrome.webstore.install)}function U(){return s()&&D()}function X(e){return""+Te+e}function q(e){return function(){return e}}function Y(e,n){Modernizr?Modernizr.addTest(e,n):Q(n()?e:"no-"+e)}function J(e){Re.className=Re.className.replace(new RegExp("\\b"+e+"\\b"),"")}function Q(e){Z(e)||(Re.className+=Re.className.length>0?" "+e:e)}function Z(e){return Re.className.match(new RegExp("\\b"+e+"\\b"))}function $(e){Z(me.NOTAGGING)||(Y(X(Ne.IE),q(e.isIE)),Z(me.IE_ONLY)||(Y(X(Ne.CHROME),q(e.isChrome)),Y(X(Ne.SAFARI),q(e.isSafari)),Y(X(Ne.OPERA),q(e.isOpera)),Y(X(Ne.OPERANEXT),q(e.isOperaNext)),Y(X(Ne.FIREFOX),q(e.isFirefox)),Y(X(Ne.KHTML),q(e.isKhtml)),Y(X(Ne.WEBKIT),q(e.isWebKit)),Y(X(Ne.EDGE),q(e.isEdge)),Y(X(Ne.UNKNOWN),q(e.isUndetected))),Z(me.IE_LESSTHAN_OFF)||(Y(X(Ne.IE_LESSTHAN_6),q(e.ieBelowVersion6)),Y(X(Ne.IE_LESSTHAN_7),q(e.ieBelowVersion7)),Y(X(Ne.IE_LESSTHAN_8),q(e.ieBelowVersion8)),Y(X(Ne.IE_LESSTHAN_9),q(e.ieBelowVersion9)),Y(X(Ne.IE_LESSTHAN_10),q(e.ieBelowVersion10)),Y(X(Ne.IE_LESSTHAN_11),q(e.ieBelowVersion11)),Y(X(Ne.IE_LESSTHAN_12),q(e.ieBelowVersion12))),Z(me.IE_GREATERTHAN_OFF)||(Y(X(Ne.IE_GREATERTHAN_6),q(e.ieAboveVersion6)),Y(X(Ne.IE_GREATERTHAN_7),q(e.ieAboveVersion7)),Y(X(Ne.IE_GREATERTHAN_8),q(e.ieAboveVersion8)),Y(X(Ne.IE_GREATERTHAN_9),q(e.ieAboveVersion9)),Y(X(Ne.IE_GREATERTHAN_10),q(e.ieAboveVersion10)),Y(X(Ne.IE_GREATERTHAN_11),q(e.ieAboveVersion11))),Z(me.VERSION_OFF)||(Y(X(Ne.IE_VERSION_6),q(e.ieIsVersion6)),Y(X(Ne.IE_VERSION_7),q(e.ieIsVersion7)),Y(X(Ne.IE_VERSION_8),q(e.ieIsVersion8)),Y(X(Ne.IE_VERSION_9),q(e.ieIsVersion9)),Y(X(Ne.IE_VERSION_10),q(e.ieIsVersion10)),Y(X(Ne.IE_VERSION_11),q(e.ieIsVersion11)))),ee()}function ee(){J(me.IE_GREATERTHAN_OFF),J(me.IE_LESSTHAN_OFF),J(me.VERSION_OFF),J(me.IE_ONLY),J(me.DEFUNCTR),J(me.NOTAGGING)}function ne(e){return{tag:function(){te&&$(e)}}}Modernizr="default"in Modernizr?Modernizr.default:Modernizr;var ie=window||null,oe=navigator||null,te=ie?ie.document||null:null,re=void 0,ue=function(){},se=ie&&ie.console?ie.console:void 0,ce=se?se.log||ue:ue,fe=se?se.warn||ce:ue,Ee=se?se.error||ce:ue,le={log:ce,warn:fe,error:Ee},Ie=Object.freeze({isAboveVersion6:R,isAboveVersion7:b,isAboveVersion8:y,isAboveVersion9:O,isAboveVersion10:v,isAboveVersion11:B,isBelowVersion6:H,isBelowVersion7:p,isBelowVersion8:F,isBelowVersion9:G,isBelowVersion10:L,isBelowVersion11:h,isBelowVersion12:M,isVersion6:K,isVersion7:C,isVersion8:P,isVersion9:j,isVersion10:W,isVersion11:z}),Ve=Object.freeze({isAboveVersion15:U}),ae={ie:Ie,chrome:Ve},_e=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},Ae=function(){function e(e,n){for(var i=0;i