/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-geolocation-touch-cssclasses-teststyles-hasevent-prefixes
*/
;
window.Modernizr = (function( window, document, undefined ) {
var version = '2.8.3',
Modernizr = {},
enableClasses = true,
docElement = document.documentElement,
mod = 'modernizr',
modElem = document.createElement(mod),
mStyle = modElem.style,
inputElem ,
toString = {}.toString,
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
tests = {},
inputs = {},
attrs = {},
classes = [],
slice = classes.slice,
featureName,
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
var style, ret, node, docOverflow,
div = document.createElement('div'),
body = document.body,
fakeBody = body || document.createElement('body');
if ( parseInt(nodes, 10) ) {
while ( nodes-- ) {
node = document.createElement('div');
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
div.appendChild(node);
}
}
style = ['',''].join('');
div.id = mod;
(body ? div : fakeBody).innerHTML += style;
fakeBody.appendChild(div);
if ( !body ) {
fakeBody.style.background = '';
fakeBody.style.overflow = 'hidden';
docOverflow = docElement.style.overflow;
docElement.style.overflow = 'hidden';
docElement.appendChild(fakeBody);
}
ret = callback(div, rule);
if ( !body ) {
fakeBody.parentNode.removeChild(fakeBody);
docElement.style.overflow = docOverflow;
} else {
div.parentNode.removeChild(div);
}
return !!ret;
},
isEventSupported = (function() {
var TAGNAMES = {
'select': 'input', 'change': 'input',
'submit': 'form', 'reset': 'form',
'error': 'img', 'load': 'img', 'abort': 'img'
};
function isEventSupported( eventName, element ) {
element = element || document.createElement(TAGNAMES[eventName] || 'div');
eventName = 'on' + eventName;
var isSupported = eventName in element;
if ( !isSupported ) {
if ( !element.setAttribute ) {
element = document.createElement('div');
}
if ( element.setAttribute && element.removeAttribute ) {
element.setAttribute(eventName, '');
isSupported = is(element[eventName], 'function');
if ( !is(element[eventName], 'undefined') ) {
element[eventName] = undefined;
}
element.removeAttribute(eventName);
}
}
element = null;
return isSupported;
}
return isEventSupported;
})(),
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
hasOwnProp = function (object, property) {
return _hasOwnProperty.call(object, property);
};
}
else {
hasOwnProp = function (object, property) {
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
};
}
if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) {
var target = this;
if (typeof target != "function") {
throw new TypeError();
}
var args = slice.call(arguments, 1),
bound = function () {
if (this instanceof bound) {
var F = function(){};
F.prototype = target.prototype;
var self = new F();
var result = target.apply(
self,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
return bound;
};
}
function setCss( str ) {
mStyle.cssText = str;
}
function setCssAll( str1, str2 ) {
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
}
function is( obj, type ) {
return typeof obj === type;
}
function contains( str, substr ) {
return !!~('' + str).indexOf(substr);
}
function testDOMProps( props, obj, elem ) {
for ( var i in props ) {
var item = obj[props[i]];
if ( item !== undefined) {
if (elem === false) return props[i];
if (is(item, 'function')){
return item.bind(elem || obj);
}
return item;
}
}
return false;
}
tests['touch'] = function() {
var bool;
if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
bool = true;
} else {
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
bool = node.offsetTop === 9;
});
}
return bool;
};
tests['geolocation'] = function() {
return 'geolocation' in navigator;
};
for ( var feature in tests ) {
if ( hasOwnProp(tests, feature) ) {
featureName = feature.toLowerCase();
Modernizr[featureName] = tests[feature]();
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
}
}
Modernizr.addTest = function ( feature, test ) {
if ( typeof feature == 'object' ) {
for ( var key in feature ) {
if ( hasOwnProp( feature, key ) ) {
Modernizr.addTest( key, feature[ key ] );
}
}
} else {
feature = feature.toLowerCase();
if ( Modernizr[feature] !== undefined ) {
return Modernizr;
}
test = typeof test == 'function' ? test() : test;
if (typeof enableClasses !== "undefined" && enableClasses) {
docElement.className += ' ' + (test ? '' : 'no-') + feature;
}
Modernizr[feature] = test;
}
return Modernizr;
};
setCss('');
modElem = inputElem = null;
Modernizr._version = version;
Modernizr._prefixes = prefixes;
Modernizr.hasEvent = isEventSupported; Modernizr.testStyles = injectElementWithStyles; docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
(enableClasses ? ' js ' + classes.join(' ') : '');
return Modernizr;
})(this, this.document);
;
/**
* Utilities; useful scripts
*
* @author Tijs Verkoyen
* @author Thomas Deceuninck
*/
var utils =
{
debug: false
};
/**
* Functions related to arrays
*
* @author Tijs Verkoyen
*/
utils.array =
{
/**
* Is the given value present in the array
*
* @return bool
*/
inArray: function(needle, array)
{
// loop values
for(var i in array)
{
if(array[i] == needle) return true;
}
// fallback
return false;
}
};
/**
* Function related to cookies
*
* @author Tijs Verkoyen
*/
utils.cookies =
{
/**
* Are cookies enabled?
*
* @return bool
*/
isEnabled: function()
{
// try to grab the property
var cookiesEnabled = !!(navigator.cookieEnabled);
// unknown property?
if(typeof navigator.cookieEnabled == 'undefined' && !cookiesEnabled)
{
// try to set a cookie
document.cookie = 'testcookie';
cookiesEnabled = ($.inArray('testcookie', document.cookie) != -1);
}
// return
return cookiesEnabled;
},
/**
* Read a cookie
*
* @return mixed
*/
readCookie: function(name)
{
// get cookies
var cookies = document.cookie.split(';');
name = name + '=';
for(var i = 0; i < cookies.length; i++)
{
var cookie = cookies[i];
while(cookie.charAt(0) === ' ') cookie = cookie.substring(1, cookie.length);
if(cookie.indexOf(name) === 0) return cookie.substring(name.length, cookie.length);
}
// fallback
return null;
},
setCookie: function(name, value, days)
{
if(typeof days == 'undefined') days = 7;
var expireDate = new Date();
expireDate.setDate(expireDate.getDate() + days);
document.cookie = name + '=' + escape(value) + ';expires=' + expireDate.toUTCString() + ';path=/';
}
};
/**
* Functions related to forms
*
* @author Tijs Verkoyen
*/
utils.form =
{
/**
* Is a checkbox checked?
*
* @return bool
* @param object element
*/
isChecked: function(element)
{
return ($('input[name="' + element.attr('name') + '"]:checked').length >= 1);
},
/**
* Is the value inside the element a valid email address
*
* @return bool
* @param object element
*/
isEmail: function(element)
{
var regexp = /^[a-z0-9!#\$%&'*+-\/=?^_`{|}\.~]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i;
return regexp.test(element.val());
},
/**
* Is the element filled
*
* @return bool
* @param object element
*/
isFilled: function(element)
{
return (utils.string.trim(element.val()) !== '');
},
/**
* Is the value inside the element a valid number
*
* @return bool
* @param object element
*/
isNumber: function(element)
{
return (!isNaN(element.val()) && element.val() !== '');
},
/**
* Is the value inside the element a valid URL
*
* @return bool
* @param object element
*/
isURL: function(element)
{
var regexp = /^((http|ftp|https):\/{2})?(([0-9a-zA-Z_-]+\.)+[0-9a-zA-Z]+)((:[0-9]+)?)((\/([~0-9a-zA-Z\#%@\.\/_-]+)?(\?[0-9a-zA-Z%@\/&=_-]+)?)?)$/i;
return regexp.test(element.val());
}
};
/**
* Functions related to strings
*
* @author Tijs Verkoyen
* @author Dieter Vanden Eynde
* @author Matthias Mullie
*/
utils.string =
{
// data member
div: false,
/**
* Fix a HTML5-chunk, so IE can render it
*
* @return string
* @param string html
*/
html5: function(html)
{
var html5 = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
// create div if needed
if(utils.string.div === false)
{
utils.string.div = document.createElement('div');
utils.string.div.innerHTML = '';
if(utils.string.div.childNodes.length !== 1)
{
var fragment = document.createDocumentFragment();
var i = html5.length;
while(i--) fragment.createElement(html5[i]);
fragment.appendChild(utils.string.div);
}
}
html = html.replace(/^\s\s*/, '').replace(/\s\s*$/, '')
.replace(/