scratch – Blame information for rev 117

Subversion Repositories:
Rev:
Rev Author Line No. Line
117 office 1 /*==================================================
2 Prototype
3 ====================================================*/
4 Swiper.prototype = {
5 isSafari: (function () {
6 var ua = window.navigator.userAgent.toLowerCase();
7 return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
8 })(),
9 isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
10 isArray: function (arr) {
11 return Object.prototype.toString.apply(arr) === '[object Array]';
12 },
13 /*==================================================
14 Browser
15 ====================================================*/
16 browser: {
17 ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
18 ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1),
19 lteIE9: (function() {
20 // create temporary DIV
21 var div = document.createElement('div');
22 // add content to tmp DIV which is wrapped into the IE HTML conditional statement
23 div.innerHTML = '<!--[if lte IE 9]><i></i><![endif]-->';
24 // return true / false value based on what will browser render
25 return div.getElementsByTagName('i').length === 1;
26 })()
27 },
28 /*==================================================
29 Devices
30 ====================================================*/
31 device: (function () {
32 var ua = window.navigator.userAgent;
33 var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
34 var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
35 var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
36 var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
37 return {
38 ios: ipad || iphone || ipod,
39 android: android
40 };
41 })(),
42 /*==================================================
43 Feature Detection
44 ====================================================*/
45 support: {
46 touch : (window.Modernizr && Modernizr.touch === true) || (function () {
47 return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
48 })(),
49  
50 transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
51 var div = document.createElement('div').style;
52 return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);
53 })(),
54  
55 flexbox: (function () {
56 var div = document.createElement('div').style;
57 var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');
58 for (var i = 0; i < styles.length; i++) {
59 if (styles[i] in div) return true;
60 }
61 })(),
62  
63 observer: (function () {
64 return ('MutationObserver' in window || 'WebkitMutationObserver' in window);
65 })(),
66  
67 passiveListener: (function () {
68 var supportsPassive = false;
69 try {
70 var opts = Object.defineProperty({}, 'passive', {
71 get: function() {
72 supportsPassive = true;
73 }
74 });
75 window.addEventListener('testPassiveListener', null, opts);
76 } catch (e) {}
77 return supportsPassive;
78 })(),
79  
80 gestures: (function () {
81 return 'ongesturestart' in window;
82 })()
83 },
84 /*==================================================
85 Plugins
86 ====================================================*/
87 plugins: {}
88 };