FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ionic/js/utils/poly.js at master · Java1024/ionic · GitHub
Java1024
ionic
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ionic
/
js
/
utils
/
poly.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
114 lines (91 loc) · 3.47 KB
Breadcrumbs
ionic
/
js
/
utils
/
poly.js
Copy path
File metadata and controls
114 lines (91 loc) · 3.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
(
function
(
document
,
ionic
)
{
'use strict'
;
// Ionic CSS polyfills
ionic
.
CSS
=
{
}
;
ionic
.
CSS
.
TRANSITION
=
[
]
;
ionic
.
CSS
.
TRANSFORM
=
[
]
;
ionic
.
EVENTS
=
{
}
;
(
function
(
)
{
// transform
var
i
,
keys
=
[
'webkitTransform'
,
'transform'
,
'-webkit-transform'
,
'webkit-transform'
,
'-moz-transform'
,
'moz-transform'
,
'MozTransform'
,
'mozTransform'
,
'msTransform'
]
;
for
(
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
if
(
document
.
documentElement
.
style
[
keys
[
i
]
]
!==
undefined
)
{
ionic
.
CSS
.
TRANSFORM
=
keys
[
i
]
;
break
;
}
}
// transition
keys
=
[
'webkitTransition'
,
'mozTransition'
,
'msTransition'
,
'transition'
]
;
for
(
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
if
(
document
.
documentElement
.
style
[
keys
[
i
]
]
!==
undefined
)
{
ionic
.
CSS
.
TRANSITION
=
keys
[
i
]
;
break
;
}
}
// Fallback in case the keys don't exist at all
ionic
.
CSS
.
TRANSITION
=
ionic
.
CSS
.
TRANSITION
||
'transition'
;
// The only prefix we care about is webkit for transitions.
var
isWebkit
=
ionic
.
CSS
.
TRANSITION
.
indexOf
(
'webkit'
)
>
-
1
;
// transition duration
ionic
.
CSS
.
TRANSITION_DURATION
=
(
isWebkit
?
'-webkit-'
:
''
)
+
'transition-duration'
;
// To be sure transitionend works everywhere, include *both* the webkit and non-webkit events
ionic
.
CSS
.
TRANSITIONEND
=
(
isWebkit
?
'webkitTransitionEnd '
:
''
)
+
'transitionend'
;
}
)
(
)
;
(
function
(
)
{
var
touchStartEvent
=
'touchstart'
;
var
touchMoveEvent
=
'touchmove'
;
var
touchEndEvent
=
'touchend'
;
var
touchCancelEvent
=
'touchcancel'
;
if
(
window
.
navigator
.
pointerEnabled
)
{
touchStartEvent
=
'pointerdown'
;
touchMoveEvent
=
'pointermove'
;
touchEndEvent
=
'pointerup'
;
touchCancelEvent
=
'pointercancel'
;
}
else
if
(
window
.
navigator
.
msPointerEnabled
)
{
touchStartEvent
=
'MSPointerDown'
;
touchMoveEvent
=
'MSPointerMove'
;
touchEndEvent
=
'MSPointerUp'
;
touchCancelEvent
=
'MSPointerCancel'
;
}
ionic
.
EVENTS
.
touchstart
=
touchStartEvent
;
ionic
.
EVENTS
.
touchmove
=
touchMoveEvent
;
ionic
.
EVENTS
.
touchend
=
touchEndEvent
;
ionic
.
EVENTS
.
touchcancel
=
touchCancelEvent
;
}
)
(
)
;
// classList polyfill for them older Androids
// https://gist.github.com/devongovett/1381839
if
(
!
(
"classList"
in
document
.
documentElement
)
&&
Object
.
defineProperty
&&
typeof
HTMLElement
!==
'undefined'
)
{
Object
.
defineProperty
(
HTMLElement
.
prototype
,
'classList'
,
{
get
:
function
(
)
{
var
self
=
this
;
function
update
(
fn
)
{
return
function
(
)
{
var
x
,
classes
=
self
.
className
.
split
(
/
\s
+
/
)
;
for
(
x
=
0
;
x
<
arguments
.
length
;
x
++
)
{
fn
(
classes
,
classes
.
indexOf
(
arguments
[
x
]
)
,
arguments
[
x
]
)
;
}
self
.
className
=
classes
.
join
(
" "
)
;
}
;
}
return
{
add
:
update
(
function
(
classes
,
index
,
value
)
{
~
index
||
classes
.
push
(
value
)
;
}
)
,
remove
:
update
(
function
(
classes
,
index
)
{
~
index
&&
classes
.
splice
(
index
,
1
)
;
}
)
,
toggle
:
update
(
function
(
classes
,
index
,
value
)
{
~
index
?
classes
.
splice
(
index
,
1
)
:
classes
.
push
(
value
)
;
}
)
,
contains
:
function
(
value
)
{
return
!
!
~
self
.
className
.
split
(
/
\s
+
/
)
.
indexOf
(
value
)
;
}
,
item
:
function
(
i
)
{
return
self
.
className
.
split
(
/
\s
+
/
)
[
i
]
||
null
;
}
}
;
}
}
)
;
}
}
)
(
document
,
ionic
)
;
Back
|
FazBrowse Home
|
New Git URL