Fix IE10-11 IndexedDB

pull/602/head
Thibaut Courouble 8 years ago
parent c97458880c
commit b31f18857d

@ -3,6 +3,7 @@ class app.DB
VERSION = 15
constructor: ->
@versionMultipler = if $.isIE() then 1e5 else 1e9
@useIndexedDB = @useIndexedDB()
@callbacks = []
@ -13,12 +14,12 @@ class app.DB
try
@open = true
req = indexedDB.open(NAME, VERSION * 1e9 + @userVersion())
req = indexedDB.open(NAME, VERSION * @versionMultipler + @userVersion())
req.onsuccess = @onOpenSuccess
req.onerror = @onOpenError
req.onupgradeneeded = @onUpgradeNeeded
catch error
@fail 'error', error
@fail 'exception', error
return
onOpenSuccess: (event) =>
@ -79,10 +80,10 @@ class app.DB
return
handleVersionMismatch: (actualVersion) ->
if Math.floor(actualVersion / 1e9) isnt VERSION
if Math.floor(actualVersion / @versionMultipler) isnt VERSION
@fail 'version'
else
@setUserVersion actualVersion - VERSION * 1e9
@setUserVersion actualVersion - VERSION * @versionMultipler
@db()
return

@ -339,6 +339,9 @@ $.popup = (value) ->
$.isMac = ->
navigator.userAgent?.indexOf('Mac') >= 0
$.isIE = ->
navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0
HIGHLIGHT_DEFAULTS =
className: 'highlight'
delay: 1000

Loading…
Cancel
Save