universal-tilt.js
Advanced tools
Comparing version 2.0.5 to 2.0.6-beta.1
@@ -5,2 +5,6 @@ # universal-tilt.js Changelog | ||
## 2.0.6 (2019-06-17) | ||
#### Repository Changes | ||
- `platform` is now built-in | ||
## 2.0.4 / 2.0.5 (2019-06-04) | ||
@@ -7,0 +11,0 @@ #### Bug Fix |
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("platform")); | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define("UniversalTilt", ["platform"], factory); | ||
define("UniversalTilt", [], factory); | ||
else if(typeof exports === 'object') | ||
exports["UniversalTilt"] = factory(require("platform")); | ||
exports["UniversalTilt"] = factory(); | ||
else | ||
root["UniversalTilt"] = factory(root["platform"]); | ||
})(typeof window !== "object" ? global.window = global : window, function(__WEBPACK_EXTERNAL_MODULE_platform__) { | ||
root["UniversalTilt"] = factory(); | ||
})(typeof window !== "object" ? global.window = global : window, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -99,2 +99,1287 @@ /******/ // The module cache | ||
/***/ "./node_modules/platform/platform.js": | ||
/*!*******************************************!*\ | ||
!*** ./node_modules/platform/platform.js ***! | ||
\*******************************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
* Platform.js <https://mths.be/platform> | ||
* Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/> | ||
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/> | ||
* Available under MIT license <https://mths.be/mit> | ||
*/ | ||
;(function() { | ||
'use strict'; | ||
/** Used to determine if values are of the language type `Object`. */ | ||
var objectTypes = { | ||
'function': true, | ||
'object': true | ||
}; | ||
/** Used as a reference to the global object. */ | ||
var root = (objectTypes[typeof window] && window) || this; | ||
/** Backup possible global object. */ | ||
var oldRoot = root; | ||
/** Detect free variable `exports`. */ | ||
var freeExports = objectTypes[typeof exports] && exports; | ||
/** Detect free variable `module`. */ | ||
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; | ||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */ | ||
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; | ||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { | ||
root = freeGlobal; | ||
} | ||
/** | ||
* Used as the maximum length of an array-like object. | ||
* See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) | ||
* for more details. | ||
*/ | ||
var maxSafeInteger = Math.pow(2, 53) - 1; | ||
/** Regular expression to detect Opera. */ | ||
var reOpera = /\bOpera/; | ||
/** Possible global object. */ | ||
var thisBinding = this; | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check for own properties of an object. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** Used to resolve the internal `[[Class]]` of values. */ | ||
var toString = objectProto.toString; | ||
/*--------------------------------------------------------------------------*/ | ||
/** | ||
* Capitalizes a string value. | ||
* | ||
* @private | ||
* @param {string} string The string to capitalize. | ||
* @returns {string} The capitalized string. | ||
*/ | ||
function capitalize(string) { | ||
string = String(string); | ||
return string.charAt(0).toUpperCase() + string.slice(1); | ||
} | ||
/** | ||
* A utility function to clean up the OS name. | ||
* | ||
* @private | ||
* @param {string} os The OS name to clean up. | ||
* @param {string} [pattern] A `RegExp` pattern matching the OS name. | ||
* @param {string} [label] A label for the OS. | ||
*/ | ||
function cleanupOS(os, pattern, label) { | ||
// Platform tokens are defined at: | ||
// http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx | ||
// http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx | ||
var data = { | ||
'10.0': '10', | ||
'6.4': '10 Technical Preview', | ||
'6.3': '8.1', | ||
'6.2': '8', | ||
'6.1': 'Server 2008 R2 / 7', | ||
'6.0': 'Server 2008 / Vista', | ||
'5.2': 'Server 2003 / XP 64-bit', | ||
'5.1': 'XP', | ||
'5.01': '2000 SP1', | ||
'5.0': '2000', | ||
'4.0': 'NT', | ||
'4.90': 'ME' | ||
}; | ||
// Detect Windows version from platform tokens. | ||
if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) && | ||
(data = data[/[\d.]+$/.exec(os)])) { | ||
os = 'Windows ' + data; | ||
} | ||
// Correct character case and cleanup string. | ||
os = String(os); | ||
if (pattern && label) { | ||
os = os.replace(RegExp(pattern, 'i'), label); | ||
} | ||
os = format( | ||
os.replace(/ ce$/i, ' CE') | ||
.replace(/\bhpw/i, 'web') | ||
.replace(/\bMacintosh\b/, 'Mac OS') | ||
.replace(/_PowerPC\b/i, ' OS') | ||
.replace(/\b(OS X) [^ \d]+/i, '$1') | ||
.replace(/\bMac (OS X)\b/, '$1') | ||
.replace(/\/(\d)/, ' $1') | ||
.replace(/_/g, '.') | ||
.replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '') | ||
.replace(/\bx86\.64\b/gi, 'x86_64') | ||
.replace(/\b(Windows Phone) OS\b/, '$1') | ||
.replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1') | ||
.split(' on ')[0] | ||
); | ||
return os; | ||
} | ||
/** | ||
* An iteration utility for arrays and objects. | ||
* | ||
* @private | ||
* @param {Array|Object} object The object to iterate over. | ||
* @param {Function} callback The function called per iteration. | ||
*/ | ||
function each(object, callback) { | ||
var index = -1, | ||
length = object ? object.length : 0; | ||
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) { | ||
while (++index < length) { | ||
callback(object[index], index, object); | ||
} | ||
} else { | ||
forOwn(object, callback); | ||
} | ||
} | ||
/** | ||
* Trim and conditionally capitalize string values. | ||
* | ||
* @private | ||
* @param {string} string The string to format. | ||
* @returns {string} The formatted string. | ||
*/ | ||
function format(string) { | ||
string = trim(string); | ||
return /^(?:webOS|i(?:OS|P))/.test(string) | ||
? string | ||
: capitalize(string); | ||
} | ||
/** | ||
* Iterates over an object's own properties, executing the `callback` for each. | ||
* | ||
* @private | ||
* @param {Object} object The object to iterate over. | ||
* @param {Function} callback The function executed per own property. | ||
*/ | ||
function forOwn(object, callback) { | ||
for (var key in object) { | ||
if (hasOwnProperty.call(object, key)) { | ||
callback(object[key], key, object); | ||
} | ||
} | ||
} | ||
/** | ||
* Gets the internal `[[Class]]` of a value. | ||
* | ||
* @private | ||
* @param {*} value The value. | ||
* @returns {string} The `[[Class]]`. | ||
*/ | ||
function getClassOf(value) { | ||
return value == null | ||
? capitalize(value) | ||
: toString.call(value).slice(8, -1); | ||
} | ||
/** | ||
* Host objects can return type values that are different from their actual | ||
* data type. The objects we are concerned with usually return non-primitive | ||
* types of "object", "function", or "unknown". | ||
* | ||
* @private | ||
* @param {*} object The owner of the property. | ||
* @param {string} property The property to check. | ||
* @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`. | ||
*/ | ||
function isHostType(object, property) { | ||
var type = object != null ? typeof object[property] : 'number'; | ||
return !/^(?:boolean|number|string|undefined)$/.test(type) && | ||
(type == 'object' ? !!object[property] : true); | ||
} | ||
/** | ||
* Prepares a string for use in a `RegExp` by making hyphens and spaces optional. | ||
* | ||
* @private | ||
* @param {string} string The string to qualify. | ||
* @returns {string} The qualified string. | ||
*/ | ||
function qualify(string) { | ||
return String(string).replace(/([ -])(?!$)/g, '$1?'); | ||
} | ||
/** | ||
* A bare-bones `Array#reduce` like utility function. | ||
* | ||
* @private | ||
* @param {Array} array The array to iterate over. | ||
* @param {Function} callback The function called per iteration. | ||
* @returns {*} The accumulated result. | ||
*/ | ||
function reduce(array, callback) { | ||
var accumulator = null; | ||
each(array, function(value, index) { | ||
accumulator = callback(accumulator, value, index, array); | ||
}); | ||
return accumulator; | ||
} | ||
/** | ||
* Removes leading and trailing whitespace from a string. | ||
* | ||
* @private | ||
* @param {string} string The string to trim. | ||
* @returns {string} The trimmed string. | ||
*/ | ||
function trim(string) { | ||
return String(string).replace(/^ +| +$/g, ''); | ||
} | ||
/*--------------------------------------------------------------------------*/ | ||
/** | ||
* Creates a new platform object. | ||
* | ||
* @memberOf platform | ||
* @param {Object|string} [ua=navigator.userAgent] The user agent string or | ||
* context object. | ||
* @returns {Object} A platform object. | ||
*/ | ||
function parse(ua) { | ||
/** The environment context object. */ | ||
var context = root; | ||
/** Used to flag when a custom context is provided. */ | ||
var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String'; | ||
// Juggle arguments. | ||
if (isCustomContext) { | ||
context = ua; | ||
ua = null; | ||
} | ||
/** Browser navigator object. */ | ||
var nav = context.navigator || {}; | ||
/** Browser user agent string. */ | ||
var userAgent = nav.userAgent || ''; | ||
ua || (ua = userAgent); | ||
/** Used to flag when `thisBinding` is the [ModuleScope]. */ | ||
var isModuleScope = isCustomContext || thisBinding == oldRoot; | ||
/** Used to detect if browser is like Chrome. */ | ||
var likeChrome = isCustomContext | ||
? !!nav.likeChrome | ||
: /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString()); | ||
/** Internal `[[Class]]` value shortcuts. */ | ||
var objectClass = 'Object', | ||
airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject', | ||
enviroClass = isCustomContext ? objectClass : 'Environment', | ||
javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java), | ||
phantomClass = isCustomContext ? objectClass : 'RuntimeObject'; | ||
/** Detect Java environments. */ | ||
var java = /\bJava/.test(javaClass) && context.java; | ||
/** Detect Rhino. */ | ||
var rhino = java && getClassOf(context.environment) == enviroClass; | ||
/** A character to represent alpha. */ | ||
var alpha = java ? 'a' : '\u03b1'; | ||
/** A character to represent beta. */ | ||
var beta = java ? 'b' : '\u03b2'; | ||
/** Browser document object. */ | ||
var doc = context.document || {}; | ||
/** | ||
* Detect Opera browser (Presto-based). | ||
* http://www.howtocreate.co.uk/operaStuff/operaObject.html | ||
* http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini | ||
*/ | ||
var opera = context.operamini || context.opera; | ||
/** Opera `[[Class]]`. */ | ||
var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera)) | ||
? operaClass | ||
: (opera = null); | ||
/*------------------------------------------------------------------------*/ | ||
/** Temporary variable used over the script's lifetime. */ | ||
var data; | ||
/** The CPU architecture. */ | ||
var arch = ua; | ||
/** Platform description array. */ | ||
var description = []; | ||
/** Platform alpha/beta indicator. */ | ||
var prerelease = null; | ||
/** A flag to indicate that environment features should be used to resolve the platform. */ | ||
var useFeatures = ua == userAgent; | ||
/** The browser/environment version. */ | ||
var version = useFeatures && opera && typeof opera.version == 'function' && opera.version(); | ||
/** A flag to indicate if the OS ends with "/ Version" */ | ||
var isSpecialCasedOS; | ||
/* Detectable layout engines (order is important). */ | ||
var layout = getLayout([ | ||
{ 'label': 'EdgeHTML', 'pattern': 'Edge' }, | ||
'Trident', | ||
{ 'label': 'WebKit', 'pattern': 'AppleWebKit' }, | ||
'iCab', | ||
'Presto', | ||
'NetFront', | ||
'Tasman', | ||
'KHTML', | ||
'Gecko' | ||
]); | ||
/* Detectable browser names (order is important). */ | ||
var name = getName([ | ||
'Adobe AIR', | ||
'Arora', | ||
'Avant Browser', | ||
'Breach', | ||
'Camino', | ||
'Electron', | ||
'Epiphany', | ||
'Fennec', | ||
'Flock', | ||
'Galeon', | ||
'GreenBrowser', | ||
'iCab', | ||
'Iceweasel', | ||
'K-Meleon', | ||
'Konqueror', | ||
'Lunascape', | ||
'Maxthon', | ||
{ 'label': 'Microsoft Edge', 'pattern': 'Edge' }, | ||
'Midori', | ||
'Nook Browser', | ||
'PaleMoon', | ||
'PhantomJS', | ||
'Raven', | ||
'Rekonq', | ||
'RockMelt', | ||
{ 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' }, | ||
'SeaMonkey', | ||
{ 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, | ||
'Sleipnir', | ||
'SlimBrowser', | ||
{ 'label': 'SRWare Iron', 'pattern': 'Iron' }, | ||
'Sunrise', | ||
'Swiftfox', | ||
'Waterfox', | ||
'WebPositive', | ||
'Opera Mini', | ||
{ 'label': 'Opera Mini', 'pattern': 'OPiOS' }, | ||
'Opera', | ||
{ 'label': 'Opera', 'pattern': 'OPR' }, | ||
'Chrome', | ||
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, | ||
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, | ||
{ 'label': 'Firefox for iOS', 'pattern': 'FxiOS' }, | ||
{ 'label': 'IE', 'pattern': 'IEMobile' }, | ||
{ 'label': 'IE', 'pattern': 'MSIE' }, | ||
'Safari' | ||
]); | ||
/* Detectable products (order is important). */ | ||
var product = getProduct([ | ||
{ 'label': 'BlackBerry', 'pattern': 'BB10' }, | ||
'BlackBerry', | ||
{ 'label': 'Galaxy S', 'pattern': 'GT-I9000' }, | ||
{ 'label': 'Galaxy S2', 'pattern': 'GT-I9100' }, | ||
{ 'label': 'Galaxy S3', 'pattern': 'GT-I9300' }, | ||
{ 'label': 'Galaxy S4', 'pattern': 'GT-I9500' }, | ||
{ 'label': 'Galaxy S5', 'pattern': 'SM-G900' }, | ||
{ 'label': 'Galaxy S6', 'pattern': 'SM-G920' }, | ||
{ 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' }, | ||
{ 'label': 'Galaxy S7', 'pattern': 'SM-G930' }, | ||
{ 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' }, | ||
'Google TV', | ||
'Lumia', | ||
'iPad', | ||
'iPod', | ||
'iPhone', | ||
'Kindle', | ||
{ 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, | ||
'Nexus', | ||
'Nook', | ||
'PlayBook', | ||
'PlayStation Vita', | ||
'PlayStation', | ||
'TouchPad', | ||
'Transformer', | ||
{ 'label': 'Wii U', 'pattern': 'WiiU' }, | ||
'Wii', | ||
'Xbox One', | ||
{ 'label': 'Xbox 360', 'pattern': 'Xbox' }, | ||
'Xoom' | ||
]); | ||
/* Detectable manufacturers. */ | ||
var manufacturer = getManufacturer({ | ||
'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, | ||
'Archos': {}, | ||
'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, | ||
'Asus': { 'Transformer': 1 }, | ||
'Barnes & Noble': { 'Nook': 1 }, | ||
'BlackBerry': { 'PlayBook': 1 }, | ||
'Google': { 'Google TV': 1, 'Nexus': 1 }, | ||
'HP': { 'TouchPad': 1 }, | ||
'HTC': {}, | ||
'LG': {}, | ||
'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, | ||
'Motorola': { 'Xoom': 1 }, | ||
'Nintendo': { 'Wii U': 1, 'Wii': 1 }, | ||
'Nokia': { 'Lumia': 1 }, | ||
'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, | ||
'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 } | ||
}); | ||
/* Detectable operating systems (order is important). */ | ||
var os = getOS([ | ||
'Windows Phone', | ||
'Android', | ||
'CentOS', | ||
{ 'label': 'Chrome OS', 'pattern': 'CrOS' }, | ||
'Debian', | ||
'Fedora', | ||
'FreeBSD', | ||
'Gentoo', | ||
'Haiku', | ||
'Kubuntu', | ||
'Linux Mint', | ||
'OpenBSD', | ||
'Red Hat', | ||
'SuSE', | ||
'Ubuntu', | ||
'Xubuntu', | ||
'Cygwin', | ||
'Symbian OS', | ||
'hpwOS', | ||
'webOS ', | ||
'webOS', | ||
'Tablet OS', | ||
'Tizen', | ||
'Linux', | ||
'Mac OS X', | ||
'Macintosh', | ||
'Mac', | ||
'Windows 98;', | ||
'Windows ' | ||
]); | ||
/*------------------------------------------------------------------------*/ | ||
/** | ||
* Picks the layout engine from an array of guesses. | ||
* | ||
* @private | ||
* @param {Array} guesses An array of guesses. | ||
* @returns {null|string} The detected layout engine. | ||
*/ | ||
function getLayout(guesses) { | ||
return reduce(guesses, function(result, guess) { | ||
return result || RegExp('\\b' + ( | ||
guess.pattern || qualify(guess) | ||
) + '\\b', 'i').exec(ua) && (guess.label || guess); | ||
}); | ||
} | ||
/** | ||
* Picks the manufacturer from an array of guesses. | ||
* | ||
* @private | ||
* @param {Array} guesses An object of guesses. | ||
* @returns {null|string} The detected manufacturer. | ||
*/ | ||
function getManufacturer(guesses) { | ||
return reduce(guesses, function(result, value, key) { | ||
// Lookup the manufacturer by product or scan the UA for the manufacturer. | ||
return result || ( | ||
value[product] || | ||
value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] || | ||
RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua) | ||
) && key; | ||
}); | ||
} | ||
/** | ||
* Picks the browser name from an array of guesses. | ||
* | ||
* @private | ||
* @param {Array} guesses An array of guesses. | ||
* @returns {null|string} The detected browser name. | ||
*/ | ||
function getName(guesses) { | ||
return reduce(guesses, function(result, guess) { | ||
return result || RegExp('\\b' + ( | ||
guess.pattern || qualify(guess) | ||
) + '\\b', 'i').exec(ua) && (guess.label || guess); | ||
}); | ||
} | ||
/** | ||
* Picks the OS name from an array of guesses. | ||
* | ||
* @private | ||
* @param {Array} guesses An array of guesses. | ||
* @returns {null|string} The detected OS name. | ||
*/ | ||
function getOS(guesses) { | ||
return reduce(guesses, function(result, guess) { | ||
var pattern = guess.pattern || qualify(guess); | ||
if (!result && (result = | ||
RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua) | ||
)) { | ||
result = cleanupOS(result, pattern, guess.label || guess); | ||
} | ||
return result; | ||
}); | ||
} | ||
/** | ||
* Picks the product name from an array of guesses. | ||
* | ||
* @private | ||
* @param {Array} guesses An array of guesses. | ||
* @returns {null|string} The detected product name. | ||
*/ | ||
function getProduct(guesses) { | ||
return reduce(guesses, function(result, guess) { | ||
var pattern = guess.pattern || qualify(guess); | ||
if (!result && (result = | ||
RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) || | ||
RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) || | ||
RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua) | ||
)) { | ||
// Split by forward slash and append product version if needed. | ||
if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) { | ||
result[0] += ' ' + result[1]; | ||
} | ||
// Correct character case and cleanup string. | ||
guess = guess.label || guess; | ||
result = format(result[0] | ||
.replace(RegExp(pattern, 'i'), guess) | ||
.replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ') | ||
.replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2')); | ||
} | ||
return result; | ||
}); | ||
} | ||
/** | ||
* Resolves the version using an array of UA patterns. | ||
* | ||
* @private | ||
* @param {Array} patterns An array of UA patterns. | ||
* @returns {null|string} The detected version. | ||
*/ | ||
function getVersion(patterns) { | ||
return reduce(patterns, function(result, pattern) { | ||
return result || (RegExp(pattern + | ||
'(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null; | ||
}); | ||
} | ||
/** | ||
* Returns `platform.description` when the platform object is coerced to a string. | ||
* | ||
* @name toString | ||
* @memberOf platform | ||
* @returns {string} Returns `platform.description` if available, else an empty string. | ||
*/ | ||
function toStringPlatform() { | ||
return this.description || ''; | ||
} | ||
/*------------------------------------------------------------------------*/ | ||
// Convert layout to an array so we can add extra details. | ||
layout && (layout = [layout]); | ||
// Detect product names that contain their manufacturer's name. | ||
if (manufacturer && !product) { | ||
product = getProduct([manufacturer]); | ||
} | ||
// Clean up Google TV. | ||
if ((data = /\bGoogle TV\b/.exec(product))) { | ||
product = data[0]; | ||
} | ||
// Detect simulators. | ||
if (/\bSimulator\b/i.test(ua)) { | ||
product = (product ? product + ' ' : '') + 'Simulator'; | ||
} | ||
// Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS. | ||
if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) { | ||
description.push('running in Turbo/Uncompressed mode'); | ||
} | ||
// Detect IE Mobile 11. | ||
if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) { | ||
data = parse(ua.replace(/like iPhone OS/, '')); | ||
manufacturer = data.manufacturer; | ||
product = data.product; | ||
} | ||
// Detect iOS. | ||
else if (/^iP/.test(product)) { | ||
name || (name = 'Safari'); | ||
os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) | ||
? ' ' + data[1].replace(/_/g, '.') | ||
: ''); | ||
} | ||
// Detect Kubuntu. | ||
else if (name == 'Konqueror' && !/buntu/i.test(os)) { | ||
os = 'Kubuntu'; | ||
} | ||
// Detect Android browsers. | ||
else if ((manufacturer && manufacturer != 'Google' && | ||
((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) || | ||
(/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) { | ||
name = 'Android Browser'; | ||
os = /\bAndroid\b/.test(os) ? os : 'Android'; | ||
} | ||
// Detect Silk desktop/accelerated modes. | ||
else if (name == 'Silk') { | ||
if (!/\bMobi/i.test(ua)) { | ||
os = 'Android'; | ||
description.unshift('desktop mode'); | ||
} | ||
if (/Accelerated *= *true/i.test(ua)) { | ||
description.unshift('accelerated'); | ||
} | ||
} | ||
// Detect PaleMoon identifying as Firefox. | ||
else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) { | ||
description.push('identifying as Firefox ' + data[1]); | ||
} | ||
// Detect Firefox OS and products running Firefox. | ||
else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) { | ||
os || (os = 'Firefox OS'); | ||
product || (product = data[1]); | ||
} | ||
// Detect false positives for Firefox/Safari. | ||
else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) { | ||
// Escape the `/` for Firefox 1. | ||
if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) { | ||
// Clear name of false positives. | ||
name = null; | ||
} | ||
// Reassign a generic name. | ||
if ((data = product || manufacturer || os) && | ||
(product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) { | ||
name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser'; | ||
} | ||
} | ||
// Add Chrome version to description for Electron. | ||
else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) { | ||
description.push('Chromium ' + data); | ||
} | ||
// Detect non-Opera (Presto-based) versions (order is important). | ||
if (!version) { | ||
version = getVersion([ | ||
'(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))', | ||
'Version', | ||
qualify(name), | ||
'(?:Firefox|Minefield|NetFront)' | ||
]); | ||
} | ||
// Detect stubborn layout engines. | ||
if ((data = | ||
layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' || | ||
/\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') || | ||
/\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' || | ||
!layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') || | ||
layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront' | ||
)) { | ||
layout = [data]; | ||
} | ||
// Detect Windows Phone 7 desktop mode. | ||
if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) { | ||
name += ' Mobile'; | ||
os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x'); | ||
description.unshift('desktop mode'); | ||
} | ||
// Detect Windows Phone 8.x desktop mode. | ||
else if (/\bWPDesktop\b/i.test(ua)) { | ||
name = 'IE Mobile'; | ||
os = 'Windows Phone 8.x'; | ||
description.unshift('desktop mode'); | ||
version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]); | ||
} | ||
// Detect IE 11 identifying as other browsers. | ||
else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) { | ||
if (name) { | ||
description.push('identifying as ' + name + (version ? ' ' + version : '')); | ||
} | ||
name = 'IE'; | ||
version = data[1]; | ||
} | ||
// Leverage environment features. | ||
if (useFeatures) { | ||
// Detect server-side environments. | ||
// Rhino has a global function while others have a global object. | ||
if (isHostType(context, 'global')) { | ||
if (java) { | ||
data = java.lang.System; | ||
arch = data.getProperty('os.arch'); | ||
os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); | ||
} | ||
if (rhino) { | ||
try { | ||
version = context.require('ringo/engine').version.join('.'); | ||
name = 'RingoJS'; | ||
} catch(e) { | ||
if ((data = context.system) && data.global.system == context.system) { | ||
name = 'Narwhal'; | ||
os || (os = data[0].os || null); | ||
} | ||
} | ||
if (!name) { | ||
name = 'Rhino'; | ||
} | ||
} | ||
else if ( | ||
typeof context.process == 'object' && !context.process.browser && | ||
(data = context.process) | ||
) { | ||
if (typeof data.versions == 'object') { | ||
if (typeof data.versions.electron == 'string') { | ||
description.push('Node ' + data.versions.node); | ||
name = 'Electron'; | ||
version = data.versions.electron; | ||
} else if (typeof data.versions.nw == 'string') { | ||
description.push('Chromium ' + version, 'Node ' + data.versions.node); | ||
name = 'NW.js'; | ||
version = data.versions.nw; | ||
} | ||
} | ||
if (!name) { | ||
name = 'Node.js'; | ||
arch = data.arch; | ||
os = data.platform; | ||
version = /[\d.]+/.exec(data.version); | ||
version = version ? version[0] : null; | ||
} | ||
} | ||
} | ||
// Detect Adobe AIR. | ||
else if (getClassOf((data = context.runtime)) == airRuntimeClass) { | ||
name = 'Adobe AIR'; | ||
os = data.flash.system.Capabilities.os; | ||
} | ||
// Detect PhantomJS. | ||
else if (getClassOf((data = context.phantom)) == phantomClass) { | ||
name = 'PhantomJS'; | ||
version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch); | ||
} | ||
// Detect IE compatibility modes. | ||
else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) { | ||
// We're in compatibility mode when the Trident version + 4 doesn't | ||
// equal the document mode. | ||
version = [version, doc.documentMode]; | ||
if ((data = +data[1] + 4) != version[1]) { | ||
description.push('IE ' + version[1] + ' mode'); | ||
layout && (layout[1] = ''); | ||
version[1] = data; | ||
} | ||
version = name == 'IE' ? String(version[1].toFixed(1)) : version[0]; | ||
} | ||
// Detect IE 11 masking as other browsers. | ||
else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) { | ||
description.push('masking as ' + name + ' ' + version); | ||
name = 'IE'; | ||
version = '11.0'; | ||
layout = ['Trident']; | ||
os = 'Windows'; | ||
} | ||
os = os && format(os); | ||
} | ||
// Detect prerelease phases. | ||
if (version && (data = | ||
/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || | ||
/(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || | ||
/\bMinefield\b/i.test(ua) && 'a' | ||
)) { | ||
prerelease = /b/i.test(data) ? 'beta' : 'alpha'; | ||
version = version.replace(RegExp(data + '\\+?$'), '') + | ||
(prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); | ||
} | ||
// Detect Firefox Mobile. | ||
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) { | ||
name = 'Firefox Mobile'; | ||
} | ||
// Obscure Maxthon's unreliable version. | ||
else if (name == 'Maxthon' && version) { | ||
version = version.replace(/\.[\d.]+/, '.x'); | ||
} | ||
// Detect Xbox 360 and Xbox One. | ||
else if (/\bXbox\b/i.test(product)) { | ||
if (product == 'Xbox 360') { | ||
os = null; | ||
} | ||
if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) { | ||
description.unshift('mobile mode'); | ||
} | ||
} | ||
// Add mobile postfix. | ||
else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && | ||
(os == 'Windows CE' || /Mobi/i.test(ua))) { | ||
name += ' Mobile'; | ||
} | ||
// Detect IE platform preview. | ||
else if (name == 'IE' && useFeatures) { | ||
try { | ||
if (context.external === null) { | ||
description.unshift('platform preview'); | ||
} | ||
} catch(e) { | ||
description.unshift('embedded'); | ||
} | ||
} | ||
// Detect BlackBerry OS version. | ||
// http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp | ||
else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = | ||
(RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || | ||
version | ||
)) { | ||
data = [data, /BB10/.test(ua)]; | ||
os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0]; | ||
version = null; | ||
} | ||
// Detect Opera identifying/masking itself as another browser. | ||
// http://www.opera.com/support/kb/view/843/ | ||
else if (this != forOwn && product != 'Wii' && ( | ||
(useFeatures && opera) || | ||
(/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) || | ||
(name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) || | ||
(name == 'IE' && ( | ||
(os && !/^Win/.test(os) && version > 5.5) || | ||
/\bWindows XP\b/.test(os) && version > 8 || | ||
version == 8 && !/\bTrident\b/.test(ua) | ||
)) | ||
) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) { | ||
// When "identifying", the UA contains both Opera and the other browser's name. | ||
data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : ''); | ||
if (reOpera.test(name)) { | ||
if (/\bIE\b/.test(data) && os == 'Mac OS') { | ||
os = null; | ||
} | ||
data = 'identify' + data; | ||
} | ||
// When "masking", the UA contains only the other browser's name. | ||
else { | ||
data = 'mask' + data; | ||
if (operaClass) { | ||
name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2')); | ||
} else { | ||
name = 'Opera'; | ||
} | ||
if (/\bIE\b/.test(data)) { | ||
os = null; | ||
} | ||
if (!useFeatures) { | ||
version = null; | ||
} | ||
} | ||
layout = ['Presto']; | ||
description.push(data); | ||
} | ||
// Detect WebKit Nightly and approximate Chrome/Safari versions. | ||
if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { | ||
// Correct build number for numeric comparison. | ||
// (e.g. "532.5" becomes "532.05") | ||
data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data]; | ||
// Nightly builds are postfixed with a "+". | ||
if (name == 'Safari' && data[1].slice(-1) == '+') { | ||
name = 'WebKit Nightly'; | ||
prerelease = 'alpha'; | ||
version = data[1].slice(0, -1); | ||
} | ||
// Clear incorrect browser versions. | ||
else if (version == data[1] || | ||
version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { | ||
version = null; | ||
} | ||
// Use the full Chrome version when available. | ||
data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1]; | ||
// Detect Blink layout engine. | ||
if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') { | ||
layout = ['Blink']; | ||
} | ||
// Detect JavaScriptCore. | ||
// http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi | ||
if (!useFeatures || (!likeChrome && !data[1])) { | ||
layout && (layout[1] = 'like Safari'); | ||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8'); | ||
} else { | ||
layout && (layout[1] = 'like Chrome'); | ||
data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28'); | ||
} | ||
// Add the postfix of ".x" or "+" for approximate versions. | ||
layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+')); | ||
// Obscure version for some Safari 1-2 releases. | ||
if (name == 'Safari' && (!version || parseInt(version) > 45)) { | ||
version = data; | ||
} | ||
} | ||
// Detect Opera desktop modes. | ||
if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) { | ||
name += ' '; | ||
description.unshift('desktop mode'); | ||
if (data == 'zvav') { | ||
name += 'Mini'; | ||
version = null; | ||
} else { | ||
name += 'Mobile'; | ||
} | ||
os = os.replace(RegExp(' *' + data + '$'), ''); | ||
} | ||
// Detect Chrome desktop mode. | ||
else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) { | ||
description.unshift('desktop mode'); | ||
name = 'Chrome Mobile'; | ||
version = null; | ||
if (/\bOS X\b/.test(os)) { | ||
manufacturer = 'Apple'; | ||
os = 'iOS 4.3+'; | ||
} else { | ||
os = null; | ||
} | ||
} | ||
// Strip incorrect OS versions. | ||
if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 && | ||
ua.indexOf('/' + data + '-') > -1) { | ||
os = trim(os.replace(data, '')); | ||
} | ||
// Add layout engine. | ||
if (layout && !/\b(?:Avant|Nook)\b/.test(name) && ( | ||
/Browser|Lunascape|Maxthon/.test(name) || | ||
name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || | ||
/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) { | ||
// Don't add layout details to description if they are falsey. | ||
(data = layout[layout.length - 1]) && description.push(data); | ||
} | ||
// Combine contextual information. | ||
if (description.length) { | ||
description = ['(' + description.join('; ') + ')']; | ||
} | ||
// Append manufacturer to description. | ||
if (manufacturer && product && product.indexOf(manufacturer) < 0) { | ||
description.push('on ' + manufacturer); | ||
} | ||
// Append product to description. | ||
if (product) { | ||
description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product); | ||
} | ||
// Parse the OS into an object. | ||
if (os) { | ||
data = / ([\d.+]+)$/.exec(os); | ||
isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/'; | ||
os = { | ||
'architecture': 32, | ||
'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os, | ||
'version': data ? data[1] : null, | ||
'toString': function() { | ||
var version = this.version; | ||
return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); | ||
} | ||
}; | ||
} | ||
// Add browser/OS architecture. | ||
if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) { | ||
if (os) { | ||
os.architecture = 64; | ||
os.family = os.family.replace(RegExp(' *' + data), ''); | ||
} | ||
if ( | ||
name && (/\bWOW64\b/i.test(ua) || | ||
(useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) | ||
) { | ||
description.unshift('32-bit'); | ||
} | ||
} | ||
// Chrome 39 and above on OS X is always 64-bit. | ||
else if ( | ||
os && /^OS X/.test(os.family) && | ||
name == 'Chrome' && parseFloat(version) >= 39 | ||
) { | ||
os.architecture = 64; | ||
} | ||
ua || (ua = null); | ||
/*------------------------------------------------------------------------*/ | ||
/** | ||
* The platform object. | ||
* | ||
* @name platform | ||
* @type Object | ||
*/ | ||
var platform = {}; | ||
/** | ||
* The platform description. | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.description = ua; | ||
/** | ||
* The name of the browser's layout engine. | ||
* | ||
* The list of common layout engines include: | ||
* "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit" | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.layout = layout && layout[0]; | ||
/** | ||
* The name of the product's manufacturer. | ||
* | ||
* The list of manufacturers include: | ||
* "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry", | ||
* "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo", | ||
* "Nokia", "Samsung" and "Sony" | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.manufacturer = manufacturer; | ||
/** | ||
* The name of the browser/environment. | ||
* | ||
* The list of common browser names include: | ||
* "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE", | ||
* "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk", | ||
* "Opera Mini" and "Opera" | ||
* | ||
* Mobile versions of some browsers have "Mobile" appended to their name: | ||
* eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile" | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.name = name; | ||
/** | ||
* The alpha/beta release indicator. | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.prerelease = prerelease; | ||
/** | ||
* The name of the product hosting the browser. | ||
* | ||
* The list of common products include: | ||
* | ||
* "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle", | ||
* "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer" | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.product = product; | ||
/** | ||
* The browser's user agent string. | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.ua = ua; | ||
/** | ||
* The browser/environment version. | ||
* | ||
* @memberOf platform | ||
* @type string|null | ||
*/ | ||
platform.version = name && version; | ||
/** | ||
* The name of the operating system. | ||
* | ||
* @memberOf platform | ||
* @type Object | ||
*/ | ||
platform.os = os || { | ||
/** | ||
* The CPU architecture the OS is built for. | ||
* | ||
* @memberOf platform.os | ||
* @type number|null | ||
*/ | ||
'architecture': null, | ||
/** | ||
* The family of the OS. | ||
* | ||
* Common values include: | ||
* "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", | ||
* "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE", | ||
* "Android", "iOS" and "Windows Phone" | ||
* | ||
* @memberOf platform.os | ||
* @type string|null | ||
*/ | ||
'family': null, | ||
/** | ||
* The version of the OS. | ||
* | ||
* @memberOf platform.os | ||
* @type string|null | ||
*/ | ||
'version': null, | ||
/** | ||
* Returns the OS string. | ||
* | ||
* @memberOf platform.os | ||
* @returns {string} The OS string. | ||
*/ | ||
'toString': function() { return 'null'; } | ||
}; | ||
platform.parse = parse; | ||
platform.toString = toStringPlatform; | ||
if (platform.version) { | ||
description.unshift(version); | ||
} | ||
if (platform.name) { | ||
description.unshift(name); | ||
} | ||
if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) { | ||
description.push(product ? '(' + os + ')' : 'on ' + os); | ||
} | ||
if (description.length) { | ||
platform.description = description.join(' '); | ||
} | ||
return platform; | ||
} | ||
/*--------------------------------------------------------------------------*/ | ||
// Export platform. | ||
var platform = parse(); | ||
// Some AMD build optimizers, like r.js, check for condition patterns like the following: | ||
if (true) { | ||
// Expose platform on the global object to prevent errors when platform is | ||
// loaded by a script tag in the presence of an AMD loader. | ||
// See http://requirejs.org/docs/errors.html#mismatch for more details. | ||
root.platform = platform; | ||
// Define as an anonymous module so platform can be aliased through path mapping. | ||
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { | ||
return platform; | ||
}).call(exports, __webpack_require__, exports, module), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} | ||
// Check for `exports` after `define` in case a build optimizer adds an `exports` object. | ||
else {} | ||
}.call(this)); | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module), __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) | ||
/***/ }), | ||
/***/ "./node_modules/webpack/buildin/global.js": | ||
/*!***********************************!*\ | ||
!*** (webpack)/buildin/global.js ***! | ||
\***********************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports) { | ||
var g; | ||
// This works in non-strict mode | ||
g = (function() { | ||
return this; | ||
})(); | ||
try { | ||
// This works if eval is allowed (see CSP) | ||
g = g || new Function("return this")(); | ||
} catch (e) { | ||
// This works if the window reference is available | ||
if (typeof window === "object") g = window; | ||
} | ||
// g can still be undefined, but nothing to do about it... | ||
// We return undefined, instead of nothing here, so it's | ||
// easier to handle this case. if(!global) { ...} | ||
module.exports = g; | ||
/***/ }), | ||
/***/ "./node_modules/webpack/buildin/module.js": | ||
/*!***********************************!*\ | ||
!*** (webpack)/buildin/module.js ***! | ||
\***********************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports) { | ||
module.exports = function(module) { | ||
if (!module.webpackPolyfill) { | ||
module.deprecate = function() {}; | ||
module.paths = []; | ||
// module.parent = undefined by default | ||
if (!module.children) module.children = []; | ||
Object.defineProperty(module, "loaded", { | ||
enumerable: true, | ||
get: function() { | ||
return module.l; | ||
} | ||
}); | ||
Object.defineProperty(module, "id", { | ||
enumerable: true, | ||
get: function() { | ||
return module.i; | ||
} | ||
}); | ||
module.webpackPolyfill = 1; | ||
} | ||
return module; | ||
}; | ||
/***/ }), | ||
/***/ "./src/index.js": | ||
@@ -141,3 +1426,3 @@ /*!**********************!*\ | ||
var _platform = _interopRequireDefault(__webpack_require__(/*! platform */ "platform")); | ||
var _platform = _interopRequireDefault(__webpack_require__(/*! platform */ "./node_modules/platform/platform.js")); | ||
@@ -540,13 +1825,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
/***/ }), | ||
/***/ "platform": | ||
/*!***************************!*\ | ||
!*** external "platform" ***! | ||
\***************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_platform__; | ||
/***/ }) | ||
@@ -553,0 +1827,0 @@ |
@@ -1,1 +0,7 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("platform")):"function"==typeof define&&define.amd?define("UniversalTilt",["platform"],t):"object"==typeof exports?exports.UniversalTilt=t(require("platform")):e.UniversalTilt=t(e.platform)}("object"!=typeof window?global.window=global:window,function(e){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,s=(i=n(1))&&i.__esModule?i:{default:i};var o=s.default;t.default=o,t.default=s.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,s=(i=n(2))&&i.__esModule?i:{default:i};function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"onMouseEnter",function(){n.updateElementPosition(),n.transitions(),"function"==typeof n.callbacks.onMouseEnter&&n.callbacks.onMouseEnter(n.element)}),a(this,"onMouseMove",function(e){null!==n.updateCall&&cancelAnimationFrame(n.updateCall),n.event=e,n.updateElementPosition(),n.updateCall=requestAnimationFrame(function(){return n.update()}),"function"==typeof n.callbacks.onMouseMove&&n.callbacks.onMouseMove(n.element)}),a(this,"onMouseLeave",function(){n.transitions(),requestAnimationFrame(function(){return n.reset()}),"function"==typeof n.callbacks.onMouseLeave&&n.callbacks.onMouseLeave(n.element)}),a(this,"onDeviceMove",function(e){n.event=e,n.update(),n.updateElementPosition(),n.transitions(),"function"==typeof n.callbacks.onDeviceMove&&n.callbacks.onDeviceMove(n.element)}),this.element=t,this.callbacks=s,this.settings=this.extendSettings(i),"function"==typeof this.callbacks.onInit&&this.callbacks.onInit(this.element),this.reverse=this.settings.reverse?-1:1,this.settings.shine&&this.shine(),this.element.style.transform="perspective(".concat(this.settings.perspective,"px)"),this.addEventListeners()}var t,n,i;return t=e,i=[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.elements,i=t.settings,s=t.callbacks;n instanceof Node&&(n=[n]),n instanceof NodeList&&(n=[].slice.call(n));var o=!0,a=!1,l=void 0;try{for(var r,c=n[Symbol.iterator]();!(o=(r=c.next()).done);o=!0){var u=r.value;"universalTilt"in u||(u.universalTilt=new e(u,i,s))}}catch(e){a=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw l}}}}],(n=[{key:"isMobile",value:function(){return window.DeviceMotionEvent&&"ontouchstart"in document.documentElement}},{key:"addEventListeners",value:function(){var e;s.default.name.match(this.settings.exclude)||(null===(e=s.default.product)||void 0===e?void 0:e.match(this.settings.exclude))||(this.isMobile()?window.addEventListener("devicemotion",this.onDeviceMove):("element"===this.settings.base?this.base=this.element:"window"===this.settings.base&&(this.base=window),this.base.addEventListener("mouseenter",this.onMouseEnter),this.base.addEventListener("mousemove",this.onMouseMove),this.base.addEventListener("mouseleave",this.onMouseLeave)))}},{key:"removeEventListeners",value:function(){window.removeEventListener("devicemotion",this.onDeviceMove),this.base.removeEventListener("mouseenter",this.onMouseEnter),this.base.removeEventListener("mousemove",this.onMouseMove),this.base.removeEventListener("mouseleave",this.onMouseLeave)}},{key:"destroy",value:function(){clearTimeout(this.timeout),null!==this.updateCall&&cancelAnimationFrame(this.updateCall),"function"==typeof this.callbacks.onDestroy&&this.callbacks.onDestroy(this.element),this.reset(),this.removeEventListeners(),this.element.universalTilt=null,delete this.element.universalTilt,this.element=null}},{key:"reset",value:function(){this.event={pageX:this.left+this.width/2,pageY:this.top+this.height/2},this.settings.reset&&(this.element.style.transform="perspective(".concat(this.settings.perspective,"px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)")),this.settings.shine&&!this.settings["shine-save"]&&Object.assign(this.shineElement.style,{transform:"rotate(180deg) translate3d(-50%, -50%, 0)",opacity:"0"})}},{key:"getValues",value:function(){var e,t,n;this.isMobile()?(e=this.event.accelerationIncludingGravity.x/4,t=this.event.accelerationIncludingGravity.y/4,90===window.orientation?(n=(1-t)/2,t=(1+e)/2,e=n):-90===window.orientation?(n=(1+t)/2,t=(1-e)/2,e=n):0===window.orientation?(t=n=(1+t)/2,e=(1+e)/2):180===window.orientation&&(t=n=(1-t)/2,e=(1-e)/2)):"element"===this.settings.base?(e=(this.event.clientX-this.left)/this.width,t=(this.event.clientY-this.top)/this.height):"window"===this.settings.base&&(e=this.event.clientX/window.innerWidth,t=this.event.clientY/window.innerHeight);e=Math.min(Math.max(e,0),1),t=Math.min(Math.max(t,0),1);var i=(this.settings.max/2-e*this.settings.max).toFixed(2),s=(t*this.settings.max-this.settings.max/2).toFixed(2),o=Math.atan2(e-.5,.5-t)*(180/Math.PI);return{tiltX:this.reverse*i,tiltY:this.reverse*s,angle:o}}},{key:"updateElementPosition",value:function(){var e=this.element.getBoundingClientRect();this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.left=e.left,this.top=e.top}},{key:"update",value:function(){var e=this.getValues();this.element.style.transform="perspective(".concat(this.settings.perspective,"px)\n rotateX(").concat(this.settings.disabled&&"X"===this.settings.disabled.toUpperCase()?0:e.tiltY,"deg)\n rotateY(").concat(this.settings.disabled&&"Y"===this.settings.disabled.toUpperCase()?0:e.tiltX,"deg)\n scale3d(").concat(this.settings.scale,", ").concat(this.settings.scale,", ").concat(this.settings.scale,")"),this.settings.shine&&Object.assign(this.shineElement.style,{transform:"rotate(".concat(e.angle,"deg) translate3d(-50%, -50%, 0)"),opacity:"".concat(this.settings["shine-opacity"])}),this.element.dispatchEvent(new CustomEvent("tiltChange",{detail:e})),this.updateCall=null}},{key:"shine",value:function(){var e=document.createElement("div"),t=document.createElement("div");e.classList.add("shine"),t.classList.add("shine-inner"),e.appendChild(t),this.element.appendChild(e),this.shineWrapper=this.element.querySelector(".shine"),this.shineElement=this.element.querySelector(".shine-inner"),Object.assign(this.shineWrapper.style,{position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden"}),Object.assign(this.shineElement.style,{position:"absolute",top:"50%",left:"50%","pointer-events":"none","background-image":"linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%)",width:"".concat(2*this.element.offsetWidth,"px"),height:"".concat(2*this.element.offsetWidth,"px"),transform:"rotate(180deg) translate3d(-50%, -50%, 0)","transform-origin":"0% 0%",opacity:"0"})}},{key:"transitions",value:function(){var e=this;clearTimeout(this.timeout),this.element.style.transition="all ".concat(this.settings.speed,"ms ").concat(this.settings.easing),this.settings.shine&&(this.shineElement.style.transition="opacity ".concat(this.settings.speed,"ms ").concat(this.settings.easing)),this.timeout=setTimeout(function(){e.element.style.transition="",e.settings.shine&&(e.shineElement.style.transition="")},this.settings.speed)}},{key:"extendSettings",value:function(e){var t={base:"element",disabled:null,easing:"cubic-bezier(.03, .98, .52, .99)",exclude:null,max:35,perspective:1e3,reset:!0,reverse:!1,scale:1,shine:!1,"shine-opacity":0,"shine-save":!1,speed:300},n={};for(var i in t)if(i in e)n[i]=e[i];else if(this.element.getAttribute("data-".concat(i))){var s=this.element.getAttribute("data-".concat(i));try{n[i]=JSON.parse(s)}catch(e){n[i]=s}}else n[i]=t[i];return n}}])&&o(t.prototype,n),i&&o(t,i),e}();if(t.default=l,"undefined"!=typeof document){window.UniversalTilt=l;var r=document.querySelectorAll("[data-tilt]");r.length&&l.init({elements:r})}window.jQuery&&(window.jQuery.fn.universalTilt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l.init({elements:this,settings:e.settings||{},callbacks:e.callbacks||{}})})},function(t,n){t.exports=e}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("UniversalTilt",[],t):"object"==typeof exports?exports.UniversalTilt=t():e.UniversalTilt=t()}("object"!=typeof window?global.window=global:window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,o=(i=n(1))&&i.__esModule?i:{default:i};var a=o.default;t.default=a,t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,o=(i=n(2))&&i.__esModule?i:{default:i};function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"onMouseEnter",function(){n.updateElementPosition(),n.transitions(),"function"==typeof n.callbacks.onMouseEnter&&n.callbacks.onMouseEnter(n.element)}),s(this,"onMouseMove",function(e){null!==n.updateCall&&cancelAnimationFrame(n.updateCall),n.event=e,n.updateElementPosition(),n.updateCall=requestAnimationFrame(function(){return n.update()}),"function"==typeof n.callbacks.onMouseMove&&n.callbacks.onMouseMove(n.element)}),s(this,"onMouseLeave",function(){n.transitions(),requestAnimationFrame(function(){return n.reset()}),"function"==typeof n.callbacks.onMouseLeave&&n.callbacks.onMouseLeave(n.element)}),s(this,"onDeviceMove",function(e){n.event=e,n.update(),n.updateElementPosition(),n.transitions(),"function"==typeof n.callbacks.onDeviceMove&&n.callbacks.onDeviceMove(n.element)}),this.element=t,this.callbacks=o,this.settings=this.extendSettings(i),"function"==typeof this.callbacks.onInit&&this.callbacks.onInit(this.element),this.reverse=this.settings.reverse?-1:1,this.settings.shine&&this.shine(),this.element.style.transform="perspective(".concat(this.settings.perspective,"px)"),this.addEventListeners()}var t,n,i;return t=e,i=[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.elements,i=t.settings,o=t.callbacks;n instanceof Node&&(n=[n]),n instanceof NodeList&&(n=[].slice.call(n));var a=!0,s=!1,r=void 0;try{for(var l,c=n[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var u=l.value;"universalTilt"in u||(u.universalTilt=new e(u,i,o))}}catch(e){s=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(s)throw r}}}}],(n=[{key:"isMobile",value:function(){return window.DeviceMotionEvent&&"ontouchstart"in document.documentElement}},{key:"addEventListeners",value:function(){var e;o.default.name.match(this.settings.exclude)||(null===(e=o.default.product)||void 0===e?void 0:e.match(this.settings.exclude))||(this.isMobile()?window.addEventListener("devicemotion",this.onDeviceMove):("element"===this.settings.base?this.base=this.element:"window"===this.settings.base&&(this.base=window),this.base.addEventListener("mouseenter",this.onMouseEnter),this.base.addEventListener("mousemove",this.onMouseMove),this.base.addEventListener("mouseleave",this.onMouseLeave)))}},{key:"removeEventListeners",value:function(){window.removeEventListener("devicemotion",this.onDeviceMove),this.base.removeEventListener("mouseenter",this.onMouseEnter),this.base.removeEventListener("mousemove",this.onMouseMove),this.base.removeEventListener("mouseleave",this.onMouseLeave)}},{key:"destroy",value:function(){clearTimeout(this.timeout),null!==this.updateCall&&cancelAnimationFrame(this.updateCall),"function"==typeof this.callbacks.onDestroy&&this.callbacks.onDestroy(this.element),this.reset(),this.removeEventListeners(),this.element.universalTilt=null,delete this.element.universalTilt,this.element=null}},{key:"reset",value:function(){this.event={pageX:this.left+this.width/2,pageY:this.top+this.height/2},this.settings.reset&&(this.element.style.transform="perspective(".concat(this.settings.perspective,"px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)")),this.settings.shine&&!this.settings["shine-save"]&&Object.assign(this.shineElement.style,{transform:"rotate(180deg) translate3d(-50%, -50%, 0)",opacity:"0"})}},{key:"getValues",value:function(){var e,t,n;this.isMobile()?(e=this.event.accelerationIncludingGravity.x/4,t=this.event.accelerationIncludingGravity.y/4,90===window.orientation?(n=(1-t)/2,t=(1+e)/2,e=n):-90===window.orientation?(n=(1+t)/2,t=(1-e)/2,e=n):0===window.orientation?(t=n=(1+t)/2,e=(1+e)/2):180===window.orientation&&(t=n=(1-t)/2,e=(1-e)/2)):"element"===this.settings.base?(e=(this.event.clientX-this.left)/this.width,t=(this.event.clientY-this.top)/this.height):"window"===this.settings.base&&(e=this.event.clientX/window.innerWidth,t=this.event.clientY/window.innerHeight);e=Math.min(Math.max(e,0),1),t=Math.min(Math.max(t,0),1);var i=(this.settings.max/2-e*this.settings.max).toFixed(2),o=(t*this.settings.max-this.settings.max/2).toFixed(2),a=Math.atan2(e-.5,.5-t)*(180/Math.PI);return{tiltX:this.reverse*i,tiltY:this.reverse*o,angle:a}}},{key:"updateElementPosition",value:function(){var e=this.element.getBoundingClientRect();this.width=this.element.offsetWidth,this.height=this.element.offsetHeight,this.left=e.left,this.top=e.top}},{key:"update",value:function(){var e=this.getValues();this.element.style.transform="perspective(".concat(this.settings.perspective,"px)\n rotateX(").concat(this.settings.disabled&&"X"===this.settings.disabled.toUpperCase()?0:e.tiltY,"deg)\n rotateY(").concat(this.settings.disabled&&"Y"===this.settings.disabled.toUpperCase()?0:e.tiltX,"deg)\n scale3d(").concat(this.settings.scale,", ").concat(this.settings.scale,", ").concat(this.settings.scale,")"),this.settings.shine&&Object.assign(this.shineElement.style,{transform:"rotate(".concat(e.angle,"deg) translate3d(-50%, -50%, 0)"),opacity:"".concat(this.settings["shine-opacity"])}),this.element.dispatchEvent(new CustomEvent("tiltChange",{detail:e})),this.updateCall=null}},{key:"shine",value:function(){var e=document.createElement("div"),t=document.createElement("div");e.classList.add("shine"),t.classList.add("shine-inner"),e.appendChild(t),this.element.appendChild(e),this.shineWrapper=this.element.querySelector(".shine"),this.shineElement=this.element.querySelector(".shine-inner"),Object.assign(this.shineWrapper.style,{position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden"}),Object.assign(this.shineElement.style,{position:"absolute",top:"50%",left:"50%","pointer-events":"none","background-image":"linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%)",width:"".concat(2*this.element.offsetWidth,"px"),height:"".concat(2*this.element.offsetWidth,"px"),transform:"rotate(180deg) translate3d(-50%, -50%, 0)","transform-origin":"0% 0%",opacity:"0"})}},{key:"transitions",value:function(){var e=this;clearTimeout(this.timeout),this.element.style.transition="all ".concat(this.settings.speed,"ms ").concat(this.settings.easing),this.settings.shine&&(this.shineElement.style.transition="opacity ".concat(this.settings.speed,"ms ").concat(this.settings.easing)),this.timeout=setTimeout(function(){e.element.style.transition="",e.settings.shine&&(e.shineElement.style.transition="")},this.settings.speed)}},{key:"extendSettings",value:function(e){var t={base:"element",disabled:null,easing:"cubic-bezier(.03, .98, .52, .99)",exclude:null,max:35,perspective:1e3,reset:!0,reverse:!1,scale:1,shine:!1,"shine-opacity":0,"shine-save":!1,speed:300},n={};for(var i in t)if(i in e)n[i]=e[i];else if(this.element.getAttribute("data-".concat(i))){var o=this.element.getAttribute("data-".concat(i));try{n[i]=JSON.parse(o)}catch(e){n[i]=o}}else n[i]=t[i];return n}}])&&a(t.prototype,n),i&&a(t,i),e}();if(t.default=r,"undefined"!=typeof document){window.UniversalTilt=r;var l=document.querySelectorAll("[data-tilt]");l.length&&r.init({elements:l})}window.jQuery&&(window.jQuery.fn.universalTilt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.init({elements:this,settings:e.settings||{},callbacks:e.callbacks||{}})})},function(e,t,n){(function(e,i){var o; | ||
/*! | ||
* Platform.js <https://mths.be/platform> | ||
* Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/> | ||
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/> | ||
* Available under MIT license <https://mths.be/mit> | ||
*/(function(){"use strict";var a={function:!0,object:!0},s=a[typeof window]&&window||this,r=a[typeof t]&&t,l=a[typeof e]&&e&&!e.nodeType&&e,c=r&&l&&"object"==typeof i&&i;!c||c.global!==c&&c.window!==c&&c.self!==c||(s=c);var u=Math.pow(2,53)-1,d=/\bOpera/,b=Object.prototype,h=b.hasOwnProperty,p=b.toString;function f(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function m(e){return e=S(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:f(e)}function v(e,t){for(var n in e)h.call(e,n)&&t(e[n],n,e)}function g(e){return null==e?f(e):p.call(e).slice(8,-1)}function y(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function x(e,t){var n=null;return function(e,t){var n=-1,i=e?e.length:0;if("number"==typeof i&&i>-1&&i<=u)for(;++n<i;)t(e[n],n,e);else v(e,t)}(e,function(i,o){n=t(n,i,o,e)}),n}function S(e){return String(e).replace(/^ +| +$/g,"")}var w=function e(t){var n=s,i=t&&"object"==typeof t&&"String"!=g(t);i&&(n=t,t=null);var o=n.navigator||{},a=o.userAgent||"";t||(t=a);var r,l,c,u,b,h=i?!!o.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(p.toString()),f=i?"Object":"ScriptBridgingProxyObject",w=i?"Object":"Environment",M=i&&n.java?"JavaPackage":g(n.java),O=i?"Object":"RuntimeObject",E=/\bJava/.test(M)&&n.java,k=E&&g(n.environment)==w,P=E?"a":"α",C=E?"b":"β",T=n.document||{},W=n.operamini||n.opera,j=d.test(j=i&&W?W["[[Class]]"]:g(W))?j:W=null,A=t,B=[],I=null,F=t==a,R=F&&W&&"function"==typeof W.version&&W.version(),G=x([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],function(e,n){return e||RegExp("\\b"+(n.pattern||y(n))+"\\b","i").exec(t)&&(n.label||n)}),L=function(e){return x(e,function(e,n){return e||RegExp("\\b"+(n.pattern||y(n))+"\\b","i").exec(t)&&(n.label||n)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),X=N([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),$=function(e){return x(e,function(e,n,i){return e||(n[X]||n[/^[a-z]+(?: +[a-z]+\b)*/i.exec(X)]||RegExp("\\b"+y(i)+"(?:\\b|\\w*\\d)","i").exec(t))&&i})}({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),_=function(e){return x(e,function(e,n){var i=n.pattern||y(n);return!e&&(e=RegExp("\\b"+i+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(e=function(e,t,n){var i={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&n&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(i=i[/[\d.]+$/.exec(e)])&&(e="Windows "+i),e=String(e),t&&n&&(e=e.replace(RegExp(t,"i"),n)),e=m(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,i,n.label||n)),e})}(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function N(e){return x(e,function(e,n){var i=n.pattern||y(n);return!e&&(e=RegExp("\\b"+i+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+i+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+i+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((e=String(n.label&&!RegExp(i,"i").test(n.label)?n.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),n=n.label||n,e=m(e[0].replace(RegExp(i,"i"),n).replace(RegExp("; *(?:"+n+"[_-])?","i")," ").replace(RegExp("("+n+")[-_.]?(\\w)","i"),"$1 $2"))),e})}if(G&&(G=[G]),$&&!X&&(X=N([$])),(r=/\bGoogle TV\b/.exec(X))&&(X=r[0]),/\bSimulator\b/i.test(t)&&(X=(X?X+" ":"")+"Simulator"),"Opera Mini"==L&&/\bOPiOS\b/.test(t)&&B.push("running in Turbo/Uncompressed mode"),"IE"==L&&/\blike iPhone OS\b/.test(t)?($=(r=e(t.replace(/like iPhone OS/,""))).manufacturer,X=r.product):/^iP/.test(X)?(L||(L="Safari"),_="iOS"+((r=/ OS ([\d_]+)/i.exec(t))?" "+r[1].replace(/_/g,"."):"")):"Konqueror"!=L||/buntu/i.test(_)?$&&"Google"!=$&&(/Chrome/.test(L)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(X))||/\bAndroid\b/.test(_)&&/^Chrome/.test(L)&&/\bVersion\//i.test(t)?(L="Android Browser",_=/\bAndroid\b/.test(_)?_:"Android"):"Silk"==L?(/\bMobi/i.test(t)||(_="Android",B.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&B.unshift("accelerated")):"PaleMoon"==L&&(r=/\bFirefox\/([\d.]+)\b/.exec(t))?B.push("identifying as Firefox "+r[1]):"Firefox"==L&&(r=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(_||(_="Firefox OS"),X||(X=r[1])):!L||(r=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(L))?(L&&!X&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(r+"/")+8))&&(L=null),(r=X||$||_)&&(X||$||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(_))&&(L=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(_)?_:r)+" Browser")):"Electron"==L&&(r=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&B.push("Chromium "+r):_="Kubuntu",R||(R=x(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",y(L),"(?:Firefox|Minefield|NetFront)"],function(e,n){return e||(RegExp(n+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null})),(r=("iCab"==G&&parseFloat(R)>3?"WebKit":/\bOpera\b/.test(L)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(G)&&"WebKit"||!G&&/\bMSIE\b/i.test(t)&&("Mac OS"==_?"Tasman":"Trident")||"WebKit"==G&&/\bPlayStation\b(?! Vita\b)/i.test(L)&&"NetFront")&&(G=[r]),"IE"==L&&(r=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(L+=" Mobile",_="Windows Phone "+(/\+$/.test(r)?r:r+".x"),B.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(L="IE Mobile",_="Windows Phone 8.x",B.unshift("desktop mode"),R||(R=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=L&&"Trident"==G&&(r=/\brv:([\d.]+)/.exec(t))&&(L&&B.push("identifying as "+L+(R?" "+R:"")),L="IE",R=r[1]),F){if(u="global",b=null!=(c=n)?typeof c[u]:"number",/^(?:boolean|number|string|undefined)$/.test(b)||"object"==b&&!c[u])g(r=n.runtime)==f?(L="Adobe AIR",_=r.flash.system.Capabilities.os):g(r=n.phantom)==O?(L="PhantomJS",R=(r=r.version||null)&&r.major+"."+r.minor+"."+r.patch):"number"==typeof T.documentMode&&(r=/\bTrident\/(\d+)/i.exec(t))?(R=[R,T.documentMode],(r=+r[1]+4)!=R[1]&&(B.push("IE "+R[1]+" mode"),G&&(G[1]=""),R[1]=r),R="IE"==L?String(R[1].toFixed(1)):R[0]):"number"==typeof T.documentMode&&/^(?:Chrome|Firefox)\b/.test(L)&&(B.push("masking as "+L+" "+R),L="IE",R="11.0",G=["Trident"],_="Windows");else if(E&&(A=(r=E.lang.System).getProperty("os.arch"),_=_||r.getProperty("os.name")+" "+r.getProperty("os.version")),k){try{R=n.require("ringo/engine").version.join("."),L="RingoJS"}catch(e){(r=n.system)&&r.global.system==n.system&&(L="Narwhal",_||(_=r[0].os||null))}L||(L="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(r=n.process)&&("object"==typeof r.versions&&("string"==typeof r.versions.electron?(B.push("Node "+r.versions.node),L="Electron",R=r.versions.electron):"string"==typeof r.versions.nw&&(B.push("Chromium "+R,"Node "+r.versions.node),L="NW.js",R=r.versions.nw)),L||(L="Node.js",A=r.arch,_=r.platform,R=(R=/[\d.]+/.exec(r.version))?R[0]:null));_=_&&m(_)}if(R&&(r=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(R)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(F&&o.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(I=/b/i.test(r)?"beta":"alpha",R=R.replace(RegExp(r+"\\+?$"),"")+("beta"==I?C:P)+(/\d+\+?/.exec(r)||"")),"Fennec"==L||"Firefox"==L&&/\b(?:Android|Firefox OS)\b/.test(_))L="Firefox Mobile";else if("Maxthon"==L&&R)R=R.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(X))"Xbox 360"==X&&(_=null),"Xbox 360"==X&&/\bIEMobile\b/.test(t)&&B.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(L)&&(!L||X||/Browser|Mobi/.test(L))||"Windows CE"!=_&&!/Mobi/i.test(t))if("IE"==L&&F)try{null===n.external&&B.unshift("platform preview")}catch(e){B.unshift("embedded")}else(/\bBlackBerry\b/.test(X)||/\bBB10\b/.test(t))&&(r=(RegExp(X.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||R)?(_=((r=[r,/BB10/.test(t)])[1]?(X=null,$="BlackBerry"):"Device Software")+" "+r[0],R=null):this!=v&&"Wii"!=X&&(F&&W||/Opera/.test(L)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==L&&/\bOS X (?:\d+\.){2,}/.test(_)||"IE"==L&&(_&&!/^Win/.test(_)&&R>5.5||/\bWindows XP\b/.test(_)&&R>8||8==R&&!/\bTrident\b/.test(t)))&&!d.test(r=e.call(v,t.replace(d,"")+";"))&&r.name&&(r="ing as "+r.name+((r=r.version)?" "+r:""),d.test(L)?(/\bIE\b/.test(r)&&"Mac OS"==_&&(_=null),r="identify"+r):(r="mask"+r,L=j?m(j.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(r)&&(_=null),F||(R=null)),G=["Presto"],B.push(r));else L+=" Mobile";(r=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(r=[parseFloat(r.replace(/\.(\d)$/,".0$1")),r],"Safari"==L&&"+"==r[1].slice(-1)?(L="WebKit Nightly",I="alpha",R=r[1].slice(0,-1)):R!=r[1]&&R!=(r[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(R=null),r[1]=(/\bChrome\/([\d.]+)/i.exec(t)||0)[1],537.36==r[0]&&537.36==r[2]&&parseFloat(r[1])>=28&&"WebKit"==G&&(G=["Blink"]),F&&(h||r[1])?(G&&(G[1]="like Chrome"),r=r[1]||((r=r[0])<530?1:r<532?2:r<532.05?3:r<533?4:r<534.03?5:r<534.07?6:r<534.1?7:r<534.13?8:r<534.16?9:r<534.24?10:r<534.3?11:r<535.01?12:r<535.02?"13+":r<535.07?15:r<535.11?16:r<535.19?17:r<536.05?18:r<536.1?19:r<537.01?20:r<537.11?"21+":r<537.13?23:r<537.18?24:r<537.24?25:r<537.36?26:"Blink"!=G?"27":"28")):(G&&(G[1]="like Safari"),r=(r=r[0])<400?1:r<500?2:r<526?3:r<533?4:r<534?"4+":r<535?5:r<537?6:r<538?7:r<601?8:"8"),G&&(G[1]+=" "+(r+="number"==typeof r?".x":/[.+]/.test(r)?"":"+")),"Safari"==L&&(!R||parseInt(R)>45)&&(R=r)),"Opera"==L&&(r=/\bzbov|zvav$/.exec(_))?(L+=" ",B.unshift("desktop mode"),"zvav"==r?(L+="Mini",R=null):L+="Mobile",_=_.replace(RegExp(" *"+r+"$"),"")):"Safari"==L&&/\bChrome\b/.exec(G&&G[1])&&(B.unshift("desktop mode"),L="Chrome Mobile",R=null,/\bOS X\b/.test(_)?($="Apple",_="iOS 4.3+"):_=null),R&&0==R.indexOf(r=/[\d.]+$/.exec(_))&&t.indexOf("/"+r+"-")>-1&&(_=S(_.replace(r,""))),G&&!/\b(?:Avant|Nook)\b/.test(L)&&(/Browser|Lunascape|Maxthon/.test(L)||"Safari"!=L&&/^iOS/.test(_)&&/\bSafari\b/.test(G[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(L)&&G[1])&&(r=G[G.length-1])&&B.push(r),B.length&&(B=["("+B.join("; ")+")"]),$&&X&&X.indexOf($)<0&&B.push("on "+$),X&&B.push((/^on /.test(B[B.length-1])?"":"on ")+X),_&&(r=/ ([\d.+]+)$/.exec(_),l=r&&"/"==_.charAt(_.length-r[0].length-1),_={architecture:32,family:r&&!l?_.replace(r[0],""):_,version:r?r[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(r=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(A))&&!/\bi686\b/i.test(A)?(_&&(_.architecture=64,_.family=_.family.replace(RegExp(" *"+r),"")),L&&(/\bWOW64\b/i.test(t)||F&&/\w(?:86|32)$/.test(o.cpuClass||o.platform)&&!/\bWin64; x64\b/i.test(t))&&B.unshift("32-bit")):_&&/^OS X/.test(_.family)&&"Chrome"==L&&parseFloat(R)>=39&&(_.architecture=64),t||(t=null);var K={};return K.description=t,K.layout=G&&G[0],K.manufacturer=$,K.name=L,K.prerelease=I,K.product=X,K.ua=t,K.version=L&&R,K.os=_||{architecture:null,family:null,version:null,toString:function(){return"null"}},K.parse=e,K.toString=function(){return this.description||""},K.version&&B.unshift(R),K.name&&B.unshift(L),_&&L&&(_!=String(_).split(" ")[0]||_!=L.split(" ")[0]&&!X)&&B.push(X?"("+_+")":"on "+_),B.length&&(K.description=B.join(" ")),K}();s.platform=w,void 0===(o=function(){return w}.call(t,n,t,e))||(e.exports=o)}).call(this)}).call(this,n(3)(e),n(4))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}])}); |
{ | ||
"name": "universal-tilt.js", | ||
"version": "2.0.5", | ||
"version": "2.0.6-beta.1", | ||
"description": "Parallax tilt effect library", | ||
@@ -48,12 +48,12 @@ "author": "Jakub Biesiada", | ||
"eslint": "^5.16.0", | ||
"eslint-config-prettier": "^4.3.0", | ||
"eslint-config-prettier": "^5.0.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"gh-pages": "^2.0.1", | ||
"husky": "^2.3.0", | ||
"husky": "^2.4.1", | ||
"jest": "^24.8.0", | ||
"jquery": "^3.4.1", | ||
"lint-staged": "^8.1.7", | ||
"prettier": "^1.17.1", | ||
"webpack": "^4.32.2", | ||
"webpack-cli": "^3.3.2" | ||
"lint-staged": "^8.2.1", | ||
"prettier": "^1.18.2", | ||
"webpack": "^4.34.0", | ||
"webpack-cli": "^3.3.4" | ||
}, | ||
@@ -60,0 +60,0 @@ "husky": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
171609
1695
1