3.0 source code
This commit is contained in:
353
OfficeWeb/vendor/touch/src/env/Browser.js
vendored
Normal file
353
OfficeWeb/vendor/touch/src/env/Browser.js
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
//@tag dom,core
|
||||
//@require Ext-more
|
||||
|
||||
/**
|
||||
* Provides information about browser.
|
||||
*
|
||||
* Should not be manually instantiated unless for unit-testing.
|
||||
* Access the global instance stored in {@link Ext.browser} instead.
|
||||
* @private
|
||||
*/
|
||||
Ext.define('Ext.env.Browser', {
|
||||
requires: ['Ext.Version'],
|
||||
|
||||
statics: {
|
||||
browserNames: {
|
||||
ie: 'IE',
|
||||
firefox: 'Firefox',
|
||||
safari: 'Safari',
|
||||
chrome: 'Chrome',
|
||||
opera: 'Opera',
|
||||
dolfin: 'Dolfin',
|
||||
webosbrowser: 'webOSBrowser',
|
||||
chromeMobile: 'ChromeMobile',
|
||||
silk: 'Silk',
|
||||
other: 'Other'
|
||||
},
|
||||
engineNames: {
|
||||
webkit: 'WebKit',
|
||||
gecko: 'Gecko',
|
||||
presto: 'Presto',
|
||||
trident: 'Trident',
|
||||
other: 'Other'
|
||||
},
|
||||
enginePrefixes: {
|
||||
webkit: 'AppleWebKit/',
|
||||
gecko: 'Gecko/',
|
||||
presto: 'Presto/',
|
||||
trident: 'Trident/'
|
||||
},
|
||||
browserPrefixes: {
|
||||
ie: 'MSIE ',
|
||||
firefox: 'Firefox/',
|
||||
chrome: 'Chrome/',
|
||||
safari: 'Version/',
|
||||
opera: 'Opera/',
|
||||
dolfin: 'Dolfin/',
|
||||
webosbrowser: 'wOSBrowser/',
|
||||
chromeMobile: 'CrMo/',
|
||||
silk: 'Silk/'
|
||||
}
|
||||
},
|
||||
|
||||
styleDashPrefixes: {
|
||||
WebKit: '-webkit-',
|
||||
Gecko: '-moz-',
|
||||
Trident: '-ms-',
|
||||
Presto: '-o-',
|
||||
Other: ''
|
||||
},
|
||||
|
||||
stylePrefixes: {
|
||||
WebKit: 'Webkit',
|
||||
Gecko: 'Moz',
|
||||
Trident: 'ms',
|
||||
Presto: 'O',
|
||||
Other: ''
|
||||
},
|
||||
|
||||
propertyPrefixes: {
|
||||
WebKit: 'webkit',
|
||||
Gecko: 'moz',
|
||||
Trident: 'ms',
|
||||
Presto: 'o',
|
||||
Other: ''
|
||||
},
|
||||
|
||||
// scope: Ext.env.Browser.prototype
|
||||
|
||||
/**
|
||||
* A "hybrid" property, can be either accessed as a method call, for example:
|
||||
*
|
||||
* if (Ext.browser.is('IE')) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* Or as an object with Boolean properties, for example:
|
||||
*
|
||||
* if (Ext.browser.is.IE) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* Versions can be conveniently checked as well. For example:
|
||||
*
|
||||
* if (Ext.browser.is.IE6) {
|
||||
* // Equivalent to (Ext.browser.is.IE && Ext.browser.version.equals(6))
|
||||
* }
|
||||
*
|
||||
* __Note:__ Only {@link Ext.Version#getMajor major component} and {@link Ext.Version#getShortVersion simplified}
|
||||
* value of the version are available via direct property checking.
|
||||
*
|
||||
* Supported values are:
|
||||
*
|
||||
* - IE
|
||||
* - Firefox
|
||||
* - Safari
|
||||
* - Chrome
|
||||
* - Opera
|
||||
* - WebKit
|
||||
* - Gecko
|
||||
* - Presto
|
||||
* - Trident
|
||||
* - WebView
|
||||
* - Other
|
||||
*
|
||||
* @param {String} value The OS name to check.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
is: Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* The full name of the current browser.
|
||||
* Possible values are:
|
||||
*
|
||||
* - IE
|
||||
* - Firefox
|
||||
* - Safari
|
||||
* - Chrome
|
||||
* - Opera
|
||||
* - Other
|
||||
* @type String
|
||||
* @readonly
|
||||
*/
|
||||
name: null,
|
||||
|
||||
/**
|
||||
* Refer to {@link Ext.Version}.
|
||||
* @type Ext.Version
|
||||
* @readonly
|
||||
*/
|
||||
version: null,
|
||||
|
||||
/**
|
||||
* The full name of the current browser's engine.
|
||||
* Possible values are:
|
||||
*
|
||||
* - WebKit
|
||||
* - Gecko
|
||||
* - Presto
|
||||
* - Trident
|
||||
* - Other
|
||||
* @type String
|
||||
* @readonly
|
||||
*/
|
||||
engineName: null,
|
||||
|
||||
/**
|
||||
* Refer to {@link Ext.Version}.
|
||||
* @type Ext.Version
|
||||
* @readonly
|
||||
*/
|
||||
engineVersion: null,
|
||||
|
||||
setFlag: function(name, value) {
|
||||
if (typeof value == 'undefined') {
|
||||
value = true;
|
||||
}
|
||||
|
||||
this.is[name] = value;
|
||||
this.is[name.toLowerCase()] = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
constructor: function(userAgent) {
|
||||
/**
|
||||
* @property {String}
|
||||
* Browser User Agent string.
|
||||
*/
|
||||
this.userAgent = userAgent;
|
||||
|
||||
is = this.is = function(name) {
|
||||
return is[name] === true;
|
||||
};
|
||||
|
||||
var statics = this.statics(),
|
||||
browserMatch = userAgent.match(new RegExp('((?:' + Ext.Object.getValues(statics.browserPrefixes).join(')|(?:') + '))([\\w\\._]+)')),
|
||||
engineMatch = userAgent.match(new RegExp('((?:' + Ext.Object.getValues(statics.enginePrefixes).join(')|(?:') + '))([\\w\\._]+)')),
|
||||
browserNames = statics.browserNames,
|
||||
browserName = browserNames.other,
|
||||
engineNames = statics.engineNames,
|
||||
engineName = engineNames.other,
|
||||
browserVersion = '',
|
||||
engineVersion = '',
|
||||
isWebView = false,
|
||||
is, i, name;
|
||||
|
||||
if (browserMatch) {
|
||||
browserName = browserNames[Ext.Object.getKey(statics.browserPrefixes, browserMatch[1])];
|
||||
|
||||
browserVersion = new Ext.Version(browserMatch[2]);
|
||||
}
|
||||
|
||||
if (engineMatch) {
|
||||
engineName = engineNames[Ext.Object.getKey(statics.enginePrefixes, engineMatch[1])];
|
||||
engineVersion = new Ext.Version(engineMatch[2]);
|
||||
}
|
||||
|
||||
// Facebook changes the userAgent when you view a website within their iOS app. For some reason, the strip out information
|
||||
// about the browser, so we have to detect that and fake it...
|
||||
if (userAgent.match(/FB/) && browserName == "Other") {
|
||||
browserName = browserNames.safari;
|
||||
engineName = engineNames.webkit;
|
||||
}
|
||||
|
||||
if (userAgent.match(/Android.*Chrome/g)) {
|
||||
browserName = 'ChromeMobile';
|
||||
}
|
||||
|
||||
Ext.apply(this, {
|
||||
engineName: engineName,
|
||||
engineVersion: engineVersion,
|
||||
name: browserName,
|
||||
version: browserVersion
|
||||
});
|
||||
|
||||
this.setFlag(browserName);
|
||||
|
||||
if (browserVersion) {
|
||||
this.setFlag(browserName + (browserVersion.getMajor() || ''));
|
||||
this.setFlag(browserName + browserVersion.getShortVersion());
|
||||
}
|
||||
|
||||
for (i in browserNames) {
|
||||
if (browserNames.hasOwnProperty(i)) {
|
||||
name = browserNames[i];
|
||||
|
||||
this.setFlag(name, browserName === name);
|
||||
}
|
||||
}
|
||||
|
||||
this.setFlag(name);
|
||||
|
||||
if (engineVersion) {
|
||||
this.setFlag(engineName + (engineVersion.getMajor() || ''));
|
||||
this.setFlag(engineName + engineVersion.getShortVersion());
|
||||
}
|
||||
|
||||
for (i in engineNames) {
|
||||
if (engineNames.hasOwnProperty(i)) {
|
||||
name = engineNames[i];
|
||||
|
||||
this.setFlag(name, engineName === name);
|
||||
}
|
||||
}
|
||||
|
||||
this.setFlag('Standalone', !!navigator.standalone);
|
||||
|
||||
if (typeof window.PhoneGap != 'undefined' || typeof window.Cordova != 'undefined' || typeof window.cordova != 'undefined') {
|
||||
isWebView = true;
|
||||
this.setFlag('PhoneGap');
|
||||
}
|
||||
else if (!!window.isNK) {
|
||||
isWebView = true;
|
||||
this.setFlag('Sencha');
|
||||
}
|
||||
|
||||
// Check if running in UIWebView
|
||||
if (/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)(?!.*FBAN)/i.test(userAgent)) {
|
||||
isWebView = true;
|
||||
}
|
||||
|
||||
// Flag to check if it we are in the WebView
|
||||
this.setFlag('WebView', isWebView);
|
||||
|
||||
/**
|
||||
* @property {Boolean}
|
||||
* `true` if browser is using strict mode.
|
||||
*/
|
||||
this.isStrict = document.compatMode == "CSS1Compat";
|
||||
|
||||
/**
|
||||
* @property {Boolean}
|
||||
* `true` if page is running over SSL.
|
||||
*/
|
||||
this.isSecure = /^https/i.test(window.location.protocol);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getStyleDashPrefix: function() {
|
||||
return this.styleDashPrefixes[this.engineName];
|
||||
},
|
||||
|
||||
getStylePrefix: function() {
|
||||
return this.stylePrefixes[this.engineName];
|
||||
},
|
||||
|
||||
getVendorProperyName: function(name) {
|
||||
var prefix = this.propertyPrefixes[this.engineName];
|
||||
|
||||
if (prefix.length > 0) {
|
||||
return prefix + Ext.String.capitalize(name);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
}, function() {
|
||||
/**
|
||||
* @class Ext.browser
|
||||
* @extends Ext.env.Browser
|
||||
* @singleton
|
||||
* Provides useful information about the current browser.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if (Ext.browser.is.IE) {
|
||||
* // IE specific code here
|
||||
* }
|
||||
*
|
||||
* if (Ext.browser.is.WebKit) {
|
||||
* // WebKit specific code here
|
||||
* }
|
||||
*
|
||||
* console.log("Version " + Ext.browser.version);
|
||||
*
|
||||
* For a full list of supported values, refer to {@link #is} property/method.
|
||||
*
|
||||
* @aside guide environment_package
|
||||
*/
|
||||
var browserEnv = Ext.browser = new this(Ext.global.navigator.userAgent);
|
||||
|
||||
//<deprecated product=touch since=2.0>
|
||||
var flags = browserEnv.is,
|
||||
name;
|
||||
|
||||
if (!Ext.is) {
|
||||
Ext.is = {};
|
||||
}
|
||||
|
||||
for (name in flags) {
|
||||
if (flags.hasOwnProperty(name)) {
|
||||
Ext.deprecatePropertyValue(Ext.is, name, flags[name], "Ext.is." + name + " is deprecated, " +
|
||||
"please use Ext.browser.is." + name + " instead");
|
||||
}
|
||||
}
|
||||
|
||||
Ext.deprecatePropertyValue(Ext, 'isStrict', browserEnv.isStrict, "Ext.isStrict is deprecated, " +
|
||||
"please use Ext.browser.isStrict instead");
|
||||
Ext.deprecatePropertyValue(Ext, 'userAgent', browserEnv.userAgent, "Ext.userAgent is deprecated, " +
|
||||
"please use Ext.browser.userAgent instead");
|
||||
//</deprecated>
|
||||
});
|
||||
342
OfficeWeb/vendor/touch/src/env/Feature.js
vendored
Normal file
342
OfficeWeb/vendor/touch/src/env/Feature.js
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
//@tag dom,core
|
||||
|
||||
/**
|
||||
* Provides information about browser.
|
||||
*
|
||||
* Should not be manually instantiated unless for unit-testing.
|
||||
* Access the global instance stored in {@link Ext.browser} instead.
|
||||
* @private
|
||||
*/
|
||||
Ext.define('Ext.env.Feature', {
|
||||
|
||||
requires: ['Ext.env.Browser', 'Ext.env.OS'],
|
||||
|
||||
constructor: function() {
|
||||
this.testElements = {};
|
||||
|
||||
this.has = function(name) {
|
||||
return !!this.has[name];
|
||||
};
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getTestElement: function(tag, createNew) {
|
||||
if (tag === undefined) {
|
||||
tag = 'div';
|
||||
}
|
||||
else if (typeof tag !== 'string') {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (createNew) {
|
||||
return document.createElement(tag);
|
||||
}
|
||||
|
||||
if (!this.testElements[tag]) {
|
||||
this.testElements[tag] = document.createElement(tag);
|
||||
}
|
||||
|
||||
return this.testElements[tag];
|
||||
},
|
||||
|
||||
isStyleSupported: function(name, tag) {
|
||||
var elementStyle = this.getTestElement(tag).style,
|
||||
cName = Ext.String.capitalize(name);
|
||||
|
||||
if (typeof elementStyle[name] !== 'undefined'
|
||||
|| typeof elementStyle[Ext.browser.getStylePrefix(name) + cName] !== 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
isEventSupported: function(name, tag) {
|
||||
if (tag === undefined) {
|
||||
tag = window;
|
||||
}
|
||||
|
||||
var element = this.getTestElement(tag),
|
||||
eventName = 'on' + name.toLowerCase(),
|
||||
isSupported = (eventName in element);
|
||||
|
||||
if (!isSupported) {
|
||||
if (element.setAttribute && element.removeAttribute) {
|
||||
element.setAttribute(eventName, '');
|
||||
isSupported = typeof element[eventName] === 'function';
|
||||
|
||||
if (typeof element[eventName] !== 'undefined') {
|
||||
element[eventName] = undefined;
|
||||
}
|
||||
|
||||
element.removeAttribute(eventName);
|
||||
}
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
},
|
||||
|
||||
getSupportedPropertyName: function(object, name) {
|
||||
var vendorName = Ext.browser.getVendorProperyName(name);
|
||||
|
||||
if (vendorName in object) {
|
||||
return vendorName;
|
||||
}
|
||||
else if (name in object) {
|
||||
return name;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
registerTest: Ext.Function.flexSetter(function(name, fn) {
|
||||
this.has[name] = fn.call(this);
|
||||
|
||||
return this;
|
||||
})
|
||||
|
||||
}, function() {
|
||||
|
||||
/**
|
||||
* @class Ext.feature
|
||||
* @extend Ext.env.Feature
|
||||
* @singleton
|
||||
*
|
||||
* A simple class to verify if a browser feature exists or not on the current device.
|
||||
*
|
||||
* if (Ext.feature.has.Canvas) {
|
||||
* // do some cool things with canvas here
|
||||
* }
|
||||
*
|
||||
* See the {@link #has} property/method for details of the features that can be detected.
|
||||
*
|
||||
* @aside guide environment_package
|
||||
*/
|
||||
Ext.feature = new this;
|
||||
|
||||
var has = Ext.feature.has;
|
||||
|
||||
/**
|
||||
* @method has
|
||||
* @member Ext.feature
|
||||
* Verifies if a browser feature exists or not on the current device.
|
||||
*
|
||||
* A "hybrid" property, can be either accessed as a method call, i.e:
|
||||
*
|
||||
* if (Ext.feature.has('Canvas')) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* or as an object with boolean properties, i.e:
|
||||
*
|
||||
* if (Ext.feature.has.Canvas) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* Possible properties/parameter values:
|
||||
*
|
||||
* - Canvas
|
||||
* - Svg
|
||||
* - Vml
|
||||
* - Touch - supports touch events (`touchstart`).
|
||||
* - Orientation - supports different orientations.
|
||||
* - OrientationChange - supports the `orientationchange` event.
|
||||
* - DeviceMotion - supports the `devicemotion` event.
|
||||
* - Geolocation
|
||||
* - SqlDatabase
|
||||
* - WebSockets
|
||||
* - Range - supports [DOM document fragments.][1]
|
||||
* - CreateContextualFragment - supports HTML fragment parsing using [range.createContextualFragment()][2].
|
||||
* - History - supports history management with [history.pushState()][3].
|
||||
* - CssTransforms
|
||||
* - Css3dTransforms
|
||||
* - CssAnimations
|
||||
* - CssTransitions
|
||||
* - Audio - supports the `<audio>` tag.
|
||||
* - Video - supports the `<video>` tag.
|
||||
* - ClassList - supports the HTML5 classList API.
|
||||
* - LocalStorage - LocalStorage is supported and can be written to.
|
||||
*
|
||||
* [1]: https://developer.mozilla.org/en/DOM/range
|
||||
* [2]: https://developer.mozilla.org/en/DOM/range.createContextualFragment
|
||||
* [3]: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#The_pushState().C2.A0method
|
||||
*
|
||||
* @param {String} value The feature name to check.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Ext.feature.registerTest({
|
||||
Canvas: function() {
|
||||
var element = this.getTestElement('canvas');
|
||||
return !!(element && element.getContext && element.getContext('2d'));
|
||||
},
|
||||
|
||||
Svg: function() {
|
||||
var doc = document;
|
||||
|
||||
return !!(doc.createElementNS && !!doc.createElementNS("http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect);
|
||||
},
|
||||
|
||||
Vml: function() {
|
||||
var element = this.getTestElement(),
|
||||
ret = false;
|
||||
|
||||
element.innerHTML = "<!--[if vml]><br><![endif]-->";
|
||||
ret = (element.childNodes.length === 1);
|
||||
element.innerHTML = "";
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
Touch: function() {
|
||||
return this.isEventSupported('touchstart') && !(Ext.os && Ext.os.name.match(/Windows|MacOS|Linux/) && !Ext.os.is.BlackBerry6);
|
||||
},
|
||||
|
||||
Orientation: function() {
|
||||
return ('orientation' in window) && this.isEventSupported('orientationchange');
|
||||
},
|
||||
|
||||
OrientationChange: function() {
|
||||
return this.isEventSupported('orientationchange');
|
||||
},
|
||||
|
||||
DeviceMotion: function() {
|
||||
return this.isEventSupported('devicemotion');
|
||||
},
|
||||
|
||||
Geolocation: function() {
|
||||
return 'geolocation' in window.navigator;
|
||||
},
|
||||
|
||||
SqlDatabase: function() {
|
||||
return 'openDatabase' in window;
|
||||
},
|
||||
|
||||
WebSockets: function() {
|
||||
return 'WebSocket' in window;
|
||||
},
|
||||
|
||||
Range: function() {
|
||||
return !!document.createRange;
|
||||
},
|
||||
|
||||
CreateContextualFragment: function() {
|
||||
var range = !!document.createRange ? document.createRange() : false;
|
||||
return range && !!range.createContextualFragment;
|
||||
},
|
||||
|
||||
History: function() {
|
||||
return ('history' in window && 'pushState' in window.history);
|
||||
},
|
||||
|
||||
CssTransforms: function() {
|
||||
return this.isStyleSupported('transform');
|
||||
},
|
||||
|
||||
Css3dTransforms: function() {
|
||||
// See https://sencha.jira.com/browse/TOUCH-1544
|
||||
return this.has('CssTransforms') && this.isStyleSupported('perspective') && !Ext.os.is.Android2;
|
||||
},
|
||||
|
||||
CssAnimations: function() {
|
||||
return this.isStyleSupported('animationName');
|
||||
},
|
||||
|
||||
CssTransitions: function() {
|
||||
return this.isStyleSupported('transitionProperty');
|
||||
},
|
||||
|
||||
Audio: function() {
|
||||
return !!this.getTestElement('audio').canPlayType;
|
||||
},
|
||||
|
||||
Video: function() {
|
||||
return !!this.getTestElement('video').canPlayType;
|
||||
},
|
||||
|
||||
ClassList: function() {
|
||||
return "classList" in this.getTestElement();
|
||||
},
|
||||
|
||||
LocalStorage : function() {
|
||||
var supported = false;
|
||||
|
||||
try {
|
||||
if ('localStorage' in window && window['localStorage'] !== null) {
|
||||
//this should throw an error in private browsing mode in iOS
|
||||
localStorage.setItem('sencha-localstorage-test', 'test success');
|
||||
//clean up if setItem worked
|
||||
localStorage.removeItem('sencha-localstorage-test');
|
||||
supported = true;
|
||||
}
|
||||
} catch ( e ) {}
|
||||
|
||||
return supported;
|
||||
}
|
||||
});
|
||||
|
||||
//<deprecated product=touch since=2.0>
|
||||
/**
|
||||
* @class Ext.supports
|
||||
* Determines information about features are supported in the current environment.
|
||||
* @deprecated 2.0.0
|
||||
* Please use the {@link Ext.browser}, {@link Ext.os} and {@link Ext.feature} classes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @member Ext.supports
|
||||
* @property Transitions
|
||||
* True if current device supports CSS transitions.
|
||||
* @deprecated 2.0.0 Please use {@link Ext.feature#has}.CssTransitions instead
|
||||
*/
|
||||
Ext.deprecatePropertyValue(has, 'Transitions', has.CssTransitions,
|
||||
"Ext.supports.Transitions is deprecated, please use Ext.feature.has.CssTransitions instead");
|
||||
|
||||
/**
|
||||
* @member Ext.supports
|
||||
* @property SVG
|
||||
* True if current device supports SVG.
|
||||
* @deprecated 2.0.0 Please use {@link Ext.feature#has}.Svg instead
|
||||
*/
|
||||
Ext.deprecatePropertyValue(has, 'SVG', has.Svg,
|
||||
"Ext.supports.SVG is deprecated, please use Ext.feature.has.Svg instead");
|
||||
|
||||
/**
|
||||
* @member Ext.supports
|
||||
* @property VML
|
||||
* True if current device supports VML.
|
||||
* @deprecated 2.0.0 Please use {@link Ext.feature#has}.Vml instead
|
||||
*/
|
||||
Ext.deprecatePropertyValue(has, 'VML', has.Vml,
|
||||
"Ext.supports.VML is deprecated, please use Ext.feature.has.Vml instead");
|
||||
|
||||
/**
|
||||
* @member Ext.supports
|
||||
* @property AudioTag
|
||||
* True if current device supports `<audio>` tag.
|
||||
* @deprecated 2.0.0 Please use {@link Ext.feature#has}.Audio instead
|
||||
*/
|
||||
Ext.deprecatePropertyValue(has, 'AudioTag', has.Audio,
|
||||
"Ext.supports.AudioTag is deprecated, please use Ext.feature.has.Audio instead");
|
||||
|
||||
/**
|
||||
* @member Ext.supports
|
||||
* @property GeoLocation
|
||||
* True if current device supports geolocation.
|
||||
* @deprecated 2.0.0 Please use {@link Ext.feature#has}.Geolocation instead
|
||||
*/
|
||||
Ext.deprecatePropertyValue(has, 'GeoLocation', has.Geolocation,
|
||||
"Ext.supports.GeoLocation is deprecated, please use Ext.feature.has.Geolocation instead");
|
||||
var name;
|
||||
|
||||
if (!Ext.supports) {
|
||||
Ext.supports = {};
|
||||
}
|
||||
|
||||
for (name in has) {
|
||||
if (has.hasOwnProperty(name)) {
|
||||
Ext.deprecatePropertyValue(Ext.supports, name, has[name], "Ext.supports." + name + " is deprecated, please use Ext.feature.has." + name + " instead");
|
||||
}
|
||||
}1
|
||||
//</deprecated>
|
||||
});
|
||||
308
OfficeWeb/vendor/touch/src/env/OS.js
vendored
Normal file
308
OfficeWeb/vendor/touch/src/env/OS.js
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
//@tag dom,core
|
||||
//@require Ext.env.Browser
|
||||
|
||||
/**
|
||||
* Provides information about operating system environment.
|
||||
*
|
||||
* Should not be manually instantiated unless for unit-testing.
|
||||
* Access the global instance stored in {@link Ext.os} instead.
|
||||
* @private
|
||||
*/
|
||||
Ext.define('Ext.env.OS', {
|
||||
|
||||
requires: ['Ext.Version'],
|
||||
|
||||
statics: {
|
||||
names: {
|
||||
ios: 'iOS',
|
||||
android: 'Android',
|
||||
webos: 'webOS',
|
||||
blackberry: 'BlackBerry',
|
||||
rimTablet: 'RIMTablet',
|
||||
mac: 'MacOS',
|
||||
win: 'Windows',
|
||||
linux: 'Linux',
|
||||
bada: 'Bada',
|
||||
other: 'Other'
|
||||
},
|
||||
prefixes: {
|
||||
ios: 'i(?:Pad|Phone|Pod)(?:.*)CPU(?: iPhone)? OS ',
|
||||
android: '(Android |HTC_|Silk/)', // Some HTC devices ship with an OSX userAgent by default,
|
||||
// so we need to add a direct check for HTC_
|
||||
blackberry: 'BlackBerry(?:.*)Version\/',
|
||||
rimTablet: 'RIM Tablet OS ',
|
||||
webos: '(?:webOS|hpwOS)\/',
|
||||
bada: 'Bada\/'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* A "hybrid" property, can be either accessed as a method call, i.e:
|
||||
*
|
||||
* if (Ext.os.is('Android')) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* or as an object with boolean properties, i.e:
|
||||
*
|
||||
* if (Ext.os.is.Android) {
|
||||
* // ...
|
||||
* }
|
||||
*
|
||||
* Versions can be conveniently checked as well. For example:
|
||||
*
|
||||
* if (Ext.os.is.Android2) {
|
||||
* // Equivalent to (Ext.os.is.Android && Ext.os.version.equals(2))
|
||||
* }
|
||||
*
|
||||
* if (Ext.os.is.iOS32) {
|
||||
* // Equivalent to (Ext.os.is.iOS && Ext.os.version.equals(3.2))
|
||||
* }
|
||||
*
|
||||
* Note that only {@link Ext.Version#getMajor major component} and {@link Ext.Version#getShortVersion simplified}
|
||||
* value of the version are available via direct property checking. Supported values are:
|
||||
*
|
||||
* - iOS
|
||||
* - iPad
|
||||
* - iPhone
|
||||
* - iPhone5 (also true for 4in iPods).
|
||||
* - iPod
|
||||
* - Android
|
||||
* - WebOS
|
||||
* - BlackBerry
|
||||
* - Bada
|
||||
* - MacOS
|
||||
* - Windows
|
||||
* - Linux
|
||||
* - Other
|
||||
* @param {String} value The OS name to check.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
is: Ext.emptyFn,
|
||||
|
||||
/**
|
||||
* @property {String} [name=null]
|
||||
* @readonly
|
||||
* The full name of the current operating system. Possible values are:
|
||||
*
|
||||
* - iOS
|
||||
* - Android
|
||||
* - WebOS
|
||||
* - BlackBerry,
|
||||
* - MacOS
|
||||
* - Windows
|
||||
* - Linux
|
||||
* - Other
|
||||
*/
|
||||
name: null,
|
||||
|
||||
/**
|
||||
* @property {Ext.Version} [version=null]
|
||||
* Refer to {@link Ext.Version}
|
||||
* @readonly
|
||||
*/
|
||||
version: null,
|
||||
|
||||
setFlag: function(name, value) {
|
||||
if (typeof value == 'undefined') {
|
||||
value = true;
|
||||
}
|
||||
|
||||
this.is[name] = value;
|
||||
this.is[name.toLowerCase()] = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
constructor: function(userAgent, platform) {
|
||||
var statics = this.statics(),
|
||||
names = statics.names,
|
||||
prefixes = statics.prefixes,
|
||||
name,
|
||||
version = '',
|
||||
i, prefix, match, item, is;
|
||||
|
||||
is = this.is = function(name) {
|
||||
return this.is[name] === true;
|
||||
};
|
||||
|
||||
for (i in prefixes) {
|
||||
if (prefixes.hasOwnProperty(i)) {
|
||||
prefix = prefixes[i];
|
||||
|
||||
match = userAgent.match(new RegExp('(?:'+prefix+')([^\\s;]+)'));
|
||||
|
||||
if (match) {
|
||||
name = names[i];
|
||||
|
||||
// This is here because some HTC android devices show an OSX Snow Leopard userAgent by default.
|
||||
// And the Kindle Fire doesn't have any indicator of Android as the OS in its User Agent
|
||||
if (match[1] && (match[1] == "HTC_" || match[1] == "Silk/")) {
|
||||
version = new Ext.Version("2.3");
|
||||
} else {
|
||||
version = new Ext.Version(match[match.length - 1]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
name = names[(userAgent.toLowerCase().match(/mac|win|linux/) || ['other'])[0]];
|
||||
version = new Ext.Version('');
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
|
||||
if (platform) {
|
||||
this.setFlag(platform.replace(/ simulator$/i, ''));
|
||||
}
|
||||
|
||||
this.setFlag(name);
|
||||
|
||||
if (version) {
|
||||
this.setFlag(name + (version.getMajor() || ''));
|
||||
this.setFlag(name + version.getShortVersion());
|
||||
}
|
||||
|
||||
for (i in names) {
|
||||
if (names.hasOwnProperty(i)) {
|
||||
item = names[i];
|
||||
|
||||
if (!is.hasOwnProperty(name)) {
|
||||
this.setFlag(item, (name === item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Detect if the device is the iPhone 5.
|
||||
if (this.name == "iOS" && window.screen.height == 568) {
|
||||
this.setFlag('iPhone5');
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}, function() {
|
||||
|
||||
var navigation = Ext.global.navigator,
|
||||
userAgent = navigation.userAgent,
|
||||
osEnv, osName, deviceType;
|
||||
|
||||
//<deprecated product=touch since=2.0>
|
||||
this.override('constructor', function() {
|
||||
this.callOverridden(arguments);
|
||||
|
||||
var is = this.is;
|
||||
|
||||
if (is.MacOS) {
|
||||
Ext.deprecatePropertyValue(is, 'Mac', true, "Ext.is.Mac is deprecated, please use Ext.os.is.MacOS instead");
|
||||
Ext.deprecatePropertyValue(is, 'mac', true, "Ext.is.Mac is deprecated, please use Ext.os.is.MacOS instead");
|
||||
}
|
||||
|
||||
if (is.BlackBerry) {
|
||||
Ext.deprecatePropertyValue(is, 'Blackberry', true, "Ext.is.Blackberry is deprecated, please use Ext.os.is.BlackBerry instead");
|
||||
}
|
||||
|
||||
return this;
|
||||
});
|
||||
//</deprecated>
|
||||
|
||||
/**
|
||||
* @class Ext.os
|
||||
* @extends Ext.env.OS
|
||||
* @singleton
|
||||
* Provides useful information about the current operating system environment.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if (Ext.os.is.Windows) {
|
||||
* // Windows specific code here
|
||||
* }
|
||||
*
|
||||
* if (Ext.os.is.iOS) {
|
||||
* // iPad, iPod, iPhone, etc.
|
||||
* }
|
||||
*
|
||||
* console.log("Version " + Ext.os.version);
|
||||
*
|
||||
* For a full list of supported values, refer to the {@link #is} property/method.
|
||||
*
|
||||
* @aside guide environment_package
|
||||
*/
|
||||
Ext.os = osEnv = new this(userAgent, navigation.platform);
|
||||
|
||||
osName = osEnv.name;
|
||||
|
||||
var search = window.location.search.match(/deviceType=(Tablet|Phone)/),
|
||||
nativeDeviceType = window.deviceType;
|
||||
|
||||
// Override deviceType by adding a get variable of deviceType. NEEDED FOR DOCS APP.
|
||||
// E.g: example/kitchen-sink.html?deviceType=Phone
|
||||
if (search && search[1]) {
|
||||
deviceType = search[1];
|
||||
}
|
||||
else if (nativeDeviceType === 'iPhone') {
|
||||
deviceType = 'Phone';
|
||||
}
|
||||
else if (nativeDeviceType === 'iPad') {
|
||||
deviceType = 'Tablet';
|
||||
}
|
||||
else {
|
||||
if (!osEnv.is.Android && !osEnv.is.iOS && /Windows|Linux|MacOS/.test(osName)) {
|
||||
deviceType = 'Desktop';
|
||||
|
||||
// always set it to false when you are on a desktop
|
||||
Ext.browser.is.WebView = false;
|
||||
}
|
||||
else if (osEnv.is.iPad || osEnv.is.Android3 || (osEnv.is.Android4 && userAgent.search(/mobile/i) == -1)) {
|
||||
deviceType = 'Tablet';
|
||||
}
|
||||
else {
|
||||
deviceType = 'Phone';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @property {String} deviceType
|
||||
* The generic type of the current device.
|
||||
*
|
||||
* Possible values:
|
||||
*
|
||||
* - Phone
|
||||
* - Tablet
|
||||
* - Desktop
|
||||
*
|
||||
* For testing purposes the deviceType can be overridden by adding
|
||||
* a deviceType parameter to the URL of the page, like so:
|
||||
*
|
||||
* http://localhost/mypage.html?deviceType=Tablet
|
||||
*
|
||||
*/
|
||||
osEnv.setFlag(deviceType, true);
|
||||
osEnv.deviceType = deviceType;
|
||||
|
||||
//<deprecated product=touch since=2.0>
|
||||
var flags = Ext.os.is,
|
||||
name;
|
||||
|
||||
if (!Ext.is) {
|
||||
Ext.is = {};
|
||||
}
|
||||
|
||||
for (name in flags) {
|
||||
if (flags.hasOwnProperty(name)) {
|
||||
Ext.deprecatePropertyValue(Ext.is, name, flags[name], "Ext.is." + name + " is deprecated, please use Ext.os.is." + name + " instead");
|
||||
}
|
||||
}
|
||||
//</deprecated>
|
||||
|
||||
/**
|
||||
* @class Ext.is
|
||||
* Used to detect if the current browser supports a certain feature, and the type of the current browser.
|
||||
* @deprecated 2.0.0
|
||||
* Please refer to the {@link Ext.browser}, {@link Ext.os} and {@link Ext.feature} classes instead.
|
||||
*/
|
||||
});
|
||||
Reference in New Issue
Block a user