/*eslint-disable */
// namespaces
var dwv = dwv || {};
/*!
* modernizr v3.6.0
* Build https://modernizr.com/download?-dataview-directory-filereader-inputtypes-typedarrays-urlparser-urlsearchparams-xhrresponsetype-xhrresponsetypearraybuffer-xhrresponsetypejson-xhrresponsetypetext-dontmin
*
* Copyright (c)
* Faruk Ates
* Paul Irish
* Alex Sexton
* Ryan Seddon
* Patrick Kettner
* Stu Cox
* Richard Herrera
* MIT License
*/
/*
* Modernizr tests which native CSS3 and HTML5 features are available in the
* current UA and makes the results available to you in two ways: as properties on
* a global `Modernizr` object, and as classes on the `<html>` element. This
* information allows you to progressively enhance your pages with a granular level
* of control over the experience.
*/
dwv.ModernizrInit = function (window, document, undefined) {
// ;(function(window, document, undefined){
var tests = [];
/**
*
* ModernizrProto is the constructor for Modernizr
*
* @class
* @access public
*/
var ModernizrProto = {
// The current version, dummy
_version: '3.6.0',
// Any settings that don't work as separate modules
// can go in here as configuration.
_config: {
'classPrefix': '',
'enableClasses': true,
'enableJSClass': true,
'usePrefixes': true
},
// Queue of tests
_q: [],
// Stub these for people who are listening
on: function(test, cb) {
// I don't really think people should do this, but we can
// safe guard it a bit.
// -- NOTE:: this gets WAY overridden in src/addTest for actual async tests.
// This is in case people listen to synchronous tests. I would leave it out,
// but the code to *disallow* sync tests in the real version of this
// function is actually larger than this.
var self = this;
setTimeout(function() {
cb(self[test]);
}, 0);
},
addTest: function(name, fn, options) {
tests.push({name: name, fn: fn, options: options});
},
addAsyncTest: function(fn) {
tests.push({name: null, fn: fn});
}
};
// Fake some of Object.create so we can force non test results to be non "own" properties.
var Modernizr = function() {};
Modernizr.prototype = ModernizrProto;
// Leak modernizr globally when you `require` it rather than force it here.
// Overwrite name so constructor name is nicer :D
Modernizr = new Modernizr();
/*!
{
"name": "DataView",
"property": "dataview",
"authors": ["Addy Osmani"],
"builderAliases": ["dataview_api"],
"notes": [{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView"
}],
"polyfills": ["jdataview"]
}
!*/
/* DOC
Detects support for the DataView interface for reading data from an ArrayBuffer as part of the Typed Array spec.
*/
Modernizr.addTest('dataview', (typeof DataView !== 'undefined' && 'getFloat64' in DataView.prototype));
/*!
{
"name": "Typed arrays",
"property": "typedarrays",
"caniuse": "typedarrays",
"tags": ["js"],
"authors": ["Stanley Stuart (@fivetanley)"],
"notes": [{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/JavaScript_typed_arrays"
},{
"name": "Kronos spec",
"href": "https://www.khronos.org/registry/typedarray/specs/latest/"
}],
"polyfills": ["joshuabell-polyfill"]
}
!*/
/* DOC
Detects support for native binary data manipulation via Typed Arrays in JavaScript.
Does not check for DataView support; use `Modernizr.dataview` for that.
*/
// Should fail in:
// Internet Explorer <= 9
// Firefox <= 3.6
// Chrome <= 6.0
// iOS Safari < 4.2
// Safari < 5.1
// Opera < 11.6
// Opera Mini, <= 7.0
// Android Browser < 4.0
// Blackberry Browser < 10.0
Modernizr.addTest('typedarrays', 'ArrayBuffer' in window);
/*!
{
"name": "File API",
"property": "filereader",
"caniuse": "fileapi",
"notes": [{
"name": "W3C Working Draft",
"href": "https://www.w3.org/TR/FileAPI/"
}],
"tags": ["file"],
"builderAliases": ["file_api"],
"knownBugs": ["Will fail in Safari 5 due to its lack of support for the standards defined FileReader object"]
}
!*/
/* DOC
`filereader` tests for the File API specification
Tests for objects specific to the File API W3C specification without
being redundant (don't bother testing for Blob since it is assumed
to be the File object's prototype.)
*/
Modernizr.addTest('filereader', !!(window.File && window.FileList && window.FileReader));
/*!
{
"name": "XHR responseType",
"property": "xhrresponsetype",
"tags": ["network"],
"notes": [{
"name": "XMLHttpRequest Living Standard",
"href": "https://xhr.spec.whatwg.org/#the-responsetype-attribute"
}]
}
!*/
/* DOC
Tests for XMLHttpRequest xhr.responseType.
*/
Modernizr.addTest('xhrresponsetype', (function() {
if (typeof XMLHttpRequest == 'undefined') {
return false;
}
var xhr = new XMLHttpRequest();
xhr.open('get', '/', true);
return 'response' in xhr;
}()));
/*!
{
"name": "URL parser",
"property": "urlparser",
"notes": [{
"name": "URL",
"href": "https://dvcs.w3.org/hg/url/raw-file/tip/Overview.html"
}],
"polyfills": ["urlparser"],
"authors": ["Ron Waldon (@jokeyrhyme)"],
"tags": ["url"]
}
!*/
/* DOC
Check if browser implements the URL constructor for parsing URLs.
*/
Modernizr.addTest('urlparser', function() {
var url;
try {
// have to actually try use it, because Safari defines a dud constructor
url = new URL('http://modernizr.com/');
return url.href === 'http://modernizr.com/';
} catch (e) {
return false;
}
});
/*!
{
"authors": ["Cătălin Mariș"],
"name": "URLSearchParams API",
"notes": [
{
"name": "WHATWG specification",
"href": "https://url.spec.whatwg.org/#interface-urlsearchparams"
},
{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams"
}
],
"property": "urlsearchparams",
"tags": ["querystring", "url"]
}
!*/
/* DOC
Detects support for an API that provides utility methods for working with the query string of a URL.
*/
Modernizr.addTest('urlsearchparams', 'URLSearchParams' in window);
var classes = [];
/**
* is returns a boolean if the typeof an obj is exactly type.
*
* @access private
* @function is
* @param {*} obj - A thing we want to check the type of
* @param {string} type - A string to compare the typeof against
* @returns {boolean}
*/
function is(obj, type) {
return typeof obj === type;
}
;
/**
* Run through all tests and detect their support in the current UA.
*
* @access private
*/
function testRunner() {
var featureNames;
var feature;
var aliasIdx;
var result;
var nameIdx;
var featureName;
var featureNameSplit;
for (var featureIdx in tests) {
if (tests.hasOwnProperty(featureIdx)) {
featureNames = [];
feature = tests[featureIdx];
// run the test, throw the return value into the Modernizr,
// then based on that boolean, define an appropriate className
// and push it into an array of classes we'll join later.
//
// If there is no name, it's an 'async' test that is run,
// but not directly added to the object. That should
// be done with a post-run addTest call.
if (feature.name) {
featureNames.push(feature.name.toLowerCase());
if (feature.options && feature.options.aliases && feature.options.aliases.length) {
// Add all the aliases into the names list
for (aliasIdx = 0; aliasIdx < feature.options.aliases.length; aliasIdx++) {
featureNames.push(feature.options.aliases[aliasIdx].toLowerCase());
}
}
}
// Run the test, or use the raw value if it's not a function
result = is(feature.fn, 'function') ? feature.fn() : feature.fn;
// Set each of the names on the Modernizr object
for (nameIdx = 0; nameIdx < featureNames.length; nameIdx++) {
featureName = featureNames[nameIdx];
// Support dot properties as sub tests. We don't do checking to make sure
// that the implied parent tests have been added. You must call them in
// order (either in the test, or make the parent test a dependency).
//
// Cap it to TWO to make the logic simple and because who needs that kind of subtesting
// hashtag famous last words
featureNameSplit = featureName.split('.');
if (featureNameSplit.length === 1) {
Modernizr[featureNameSplit[0]] = result;
} else {
// cast to a Boolean, if not one already
if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
}
Modernizr[featureNameSplit[0]][featureNameSplit[1]] = result;
}
classes.push((result ? '' : 'no-') + featureNameSplit.join('-'));
}
}
}
}
;
/**
* docElement is a convenience wrapper to grab the root element of the document
*
* @access private
* @returns {HTMLElement|SVGElement} The root element of the document
*/
var docElement = document.documentElement;
/**
* http://mathiasbynens.be/notes/xhr-responsetype-json#comment-4
*
* @access private
* @function testXhrType
* @param {string} type - String name of the XHR type you want to detect
* @returns {boolean}
* @author Mathias Bynens
*/
/* istanbul ignore next */
var testXhrType = function(type) {
if (typeof XMLHttpRequest == 'undefined') {
return false;
}
var xhr = new XMLHttpRequest();
xhr.open('get', '/', true);
try {
xhr.responseType = type;
} catch (error) {
return false;
}
return 'response' in xhr && xhr.responseType == type;
};
/*!
{
"name": "XHR responseType='arraybuffer'",
"property": "xhrresponsetypearraybuffer",
"tags": ["network"],
"notes": [{
"name": "XMLHttpRequest Living Standard",
"href": "https://xhr.spec.whatwg.org/#the-responsetype-attribute"
}]
}
!*/
/* DOC
Tests for XMLHttpRequest xhr.responseType='arraybuffer'.
*/
Modernizr.addTest('xhrresponsetypearraybuffer', testXhrType('arraybuffer'));
/*!
{
"name": "XHR responseType='json'",
"property": "xhrresponsetypejson",
"tags": ["network"],
"notes": [{
"name": "XMLHttpRequest Living Standard",
"href": "https://xhr.spec.whatwg.org/#the-responsetype-attribute"
},{
"name": "Explanation of xhr.responseType='json'",
"href": "https://mathiasbynens.be/notes/xhr-responsetype-json"
}]
}
!*/
/* DOC
Tests for XMLHttpRequest xhr.responseType='json'.
*/
Modernizr.addTest('xhrresponsetypejson', testXhrType('json'));
/*!
{
"name": "XHR responseType='text'",
"property": "xhrresponsetypetext",
"tags": ["network"],
"notes": [{
"name": "XMLHttpRequest Living Standard",
"href": "https://xhr.spec.whatwg.org/#the-responsetype-attribute"
}]
}
!*/
/* DOC
Tests for XMLHttpRequest xhr.responseType='text'.
*/
Modernizr.addTest('xhrresponsetypetext', testXhrType('text'));
/**
* A convenience helper to check if the document we are running in is an SVG document
*
* @access private
* @returns {boolean}
*/
var isSVG = docElement.nodeName.toLowerCase() === 'svg';
/**
* createElement is a convenience wrapper around document.createElement. Since we
* use createElement all over the place, this allows for (slightly) smaller code
* as well as abstracting away issues with creating elements in contexts other than
* HTML documents (e.g. SVG documents).
*
* @access private
* @function createElement
* @returns {HTMLElement|SVGElement} An HTML or SVG element
*/
function createElement() {
if (typeof document.createElement !== 'function') {
// This is the case in IE7, where the type of createElement is "object".
// For this reason, we cannot call apply() as Object is not a Function.
return document.createElement(arguments[0]);
} else if (isSVG) {
return document.createElementNS.call(document, 'http://www.w3.org/2000/svg', arguments[0]);
} else {
return document.createElement.apply(document, arguments);
}
}
;
/**
* since we have a fairly large number of input tests that don't mutate the input
* we create a single element that can be shared with all of those tests for a
* minor perf boost
*
* @access private
* @returns {HTMLInputElement}
*/
var inputElem = createElement('input');
/*!
{
"name": "Form input types",
"property": "inputtypes",
"caniuse": "forms",
"tags": ["forms"],
"authors": ["Mike Taylor"],
"polyfills": [
"jquerytools",
"webshims",
"h5f",
"webforms2",
"nwxforms",
"fdslider",
"html5slider",
"galleryhtml5forms",
"jscolor",
"html5formshim",
"selectedoptionsjs",
"formvalidationjs"
]
}
!*/
/* DOC
Detects support for HTML5 form input types and exposes Boolean subproperties with the results:
```javascript
Modernizr.inputtypes.color
Modernizr.inputtypes.date
Modernizr.inputtypes.datetime
Modernizr.inputtypes['datetime-local']
Modernizr.inputtypes.email
Modernizr.inputtypes.month
Modernizr.inputtypes.number
Modernizr.inputtypes.range
Modernizr.inputtypes.search
Modernizr.inputtypes.tel
Modernizr.inputtypes.time
Modernizr.inputtypes.url
Modernizr.inputtypes.week
```
*/
// Run through HTML5's new input types to see if the UA understands any.
// This is put behind the tests runloop because it doesn't return a
// true/false like all the other tests; instead, it returns an object
// containing each input type with its corresponding true/false value
// Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/
var inputtypes = 'search tel url email datetime date month week time datetime-local number range color'.split(' ');
var inputs = {};
Modernizr.inputtypes = (function(props) {
var len = props.length;
var smile = '1)';
var inputElemType;
var defaultView;
var bool;
for (var i = 0; i < len; i++) {
inputElem.setAttribute('type', inputElemType = props[i]);
bool = inputElem.type !== 'text' && 'style' in inputElem;
// We first check to see if the type we give it sticks..
// If the type does, we feed it a textual value, which shouldn't be valid.
// If the value doesn't stick, we know there's input sanitization which infers a custom UI
if (bool) {
inputElem.value = smile;
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
if (/^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined) {
docElement.appendChild(inputElem);
defaultView = document.defaultView;
// Safari 2-4 allows the smiley as a value, despite making a slider
bool = defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
// Mobile android web browser has false positive, so must
// check the height to see if the widget is actually there.
(inputElem.offsetHeight !== 0);
docElement.removeChild(inputElem);
} else if (/^(search|tel)$/.test(inputElemType)) {
// Spec doesn't define any special parsing or detectable UI
// behaviors so we pass these through as true
// Interestingly, opera fails the earlier test, so it doesn't
// even make it here.
} else if (/^(url|email)$/.test(inputElemType)) {
// Real url and email support comes with prebaked validation.
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
} else {
// If the upgraded input compontent rejects the :) text, we got a winner
bool = inputElem.value != smile;
}
}
inputs[ props[i] ] = !!bool;
}
return inputs;
})(inputtypes);
/**
* If the browsers follow the spec, then they would expose vendor-specific styles as:
* elem.style.WebkitBorderRadius
* instead of something like the following (which is technically incorrect):
* elem.style.webkitBorderRadius
* WebKit ghosts their properties in lowercase but Opera & Moz do not.
* Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
* erik.eae.net/archives/2008/03/10/21.48.10/
* More here: github.com/Modernizr/Modernizr/issues/issue/21
*
* @access private
* @returns {string} The string representing the vendor-specific style properties
*/
var omPrefixes = 'Moz O ms Webkit';
/**
* List of JavaScript DOM values used for tests
*
* @memberof Modernizr
* @name Modernizr._domPrefixes
* @optionName Modernizr._domPrefixes
* @optionProp domPrefixes
* @access public
* @example
*
* Modernizr._domPrefixes is exactly the same as [_prefixes](#modernizr-_prefixes), but rather
* than kebab-case properties, all properties are their Capitalized variant
*
* ```js
* Modernizr._domPrefixes === [ "Moz", "O", "ms", "Webkit" ];
* ```
*/
var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []);
ModernizrProto._domPrefixes = domPrefixes;
/*!
{
"name": "input[directory] Attribute",
"property": "directory",
"authors": ["silverwind"],
"tags": ["file", "input", "attribute"]
}
!*/
/* DOC
When used on an `<input type="file">`, the `directory` attribute instructs
the user agent to present a directory selection dialog instead of the usual
file selection dialog.
*/
Modernizr.addTest('fileinputdirectory', function() {
var elem = createElement('input'), dir = 'directory';
elem.type = 'file';
if (dir in elem) {
return true;
} else {
for (var i = 0, len = domPrefixes.length; i < len; i++) {
if (domPrefixes[i] + dir in elem) {
return true;
}
}
}
return false;
});
// Run each test
testRunner();
delete ModernizrProto.addTest;
delete ModernizrProto.addAsyncTest;
// Run the things that are supposed to run after the tests
for (var i = 0; i < Modernizr._q.length; i++) {
Modernizr._q[i]();
}
// Leak Modernizr namespace
// window.Modernizr = Modernizr;
dwv.Modernizr = Modernizr;
;
// })(window, document);
};