Remove Notification.permission and page visibility polyfills.
This commit is contained in:
parent
a7b3363d17
commit
271ee9290f
@ -1,21 +1,8 @@
|
|||||||
Polyfill =
|
Polyfill =
|
||||||
init: ->
|
init: ->
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
@notificationPermission()
|
|
||||||
@toBlob()
|
@toBlob()
|
||||||
@visibility()
|
|
||||||
<% } %>
|
<% } %>
|
||||||
notificationPermission: ->
|
|
||||||
return if !window.Notification or 'permission' of Notification or !window.webkitNotifications
|
|
||||||
Object.defineProperty Notification, 'permission',
|
|
||||||
get: ->
|
|
||||||
switch webkitNotifications.checkPermission()
|
|
||||||
when 0
|
|
||||||
'granted'
|
|
||||||
when 1
|
|
||||||
'default'
|
|
||||||
when 2
|
|
||||||
'denied'
|
|
||||||
toBlob: ->
|
toBlob: ->
|
||||||
HTMLCanvasElement::toBlob or= (cb) ->
|
HTMLCanvasElement::toBlob or= (cb) ->
|
||||||
data = atob @toDataURL()[22..]
|
data = atob @toDataURL()[22..]
|
||||||
@ -25,12 +12,3 @@ Polyfill =
|
|||||||
for i in [0...l] by 1
|
for i in [0...l] by 1
|
||||||
ui8a[i] = data.charCodeAt i
|
ui8a[i] = data.charCodeAt i
|
||||||
cb new Blob [ui8a], type: 'image/png'
|
cb new Blob [ui8a], type: 'image/png'
|
||||||
visibility: ->
|
|
||||||
# page visibility API
|
|
||||||
return if 'visibilityState' of d
|
|
||||||
Object.defineProperties HTMLDocument.prototype,
|
|
||||||
visibilityState:
|
|
||||||
get: -> @webkitVisibilityState
|
|
||||||
hidden:
|
|
||||||
get: -> @webkitHidden
|
|
||||||
$.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange'
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user