Unified · Split
| @@ -29,6 +29,7 @@ class app.DB · 28 unmodified lines | |||
| 29 | @checkedBuggyIDB = true | 29 | @checkedBuggyIDB = true |
| 30 | catch | 30 | catch |
| 31 | try db.close() | 31 | try db.close() |
| 32 | @reason = 'apple' | ||
| 32 | @onOpenError() | 33 | @onOpenError() |
| 33 | return | 34 | return |
| 34 | 35 | ||
| @@ -47,6 +48,7 @@ class app.DB · 12 unmodified lines | |||
| 47 | app.onQuotaExceeded() | 48 | app.onQuotaExceeded() |
| 48 | else | 49 | else |
| 49 | @useIndexedDB = false | 50 | @useIndexedDB = false |
| 51 | @reason or= 'cant_open' | ||
| 50 | @runCallbacks() | 52 | @runCallbacks() |
| 51 | return | 53 | return |
| 52 | 54 | ||
| @@ -251,7 +253,11 @@ class app.DB · 198 unmodified lines | |||
| 251 | 253 | ||
| 252 | useIndexedDB: -> | 254 | useIndexedDB: -> |
| 253 | try | 255 | try |
| 254 | !app.isSingleDoc() and !!window.indexedDB | 256 | if !app.isSingleDoc() and window.indexedDB |
| 257 | true | ||
| 258 | else | ||
| 259 | @reason = 'not_supported' | ||
| 260 | false | ||
| 255 | catch | 261 | catch |
| 256 | false | 262 | false |
| 257 | 263 | ||
| @@ -22,10 +22,19 @@ app.templates.bootError = -> · 21 unmodified lines | |||
| 22 | """ Check your Internet connection and try <a href="javascript:location.reload()">reloading</a>.<br> | 22 | """ Check your Internet connection and try <a href="javascript:location.reload()">reloading</a>.<br> |
| 23 | If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """ | 23 | If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """ |
| 24 | 24 | ||
| 25 | app.templates.offlineError = -> | 25 | app.templates.offlineError = (reason) -> |
| 26 | error """ Oops, the database failed to load. """, | 26 | reason = switch reason |
| 27 | """ DevDocs requires IndexedDB to cache documentations for offline access.<br> | 27 | when 'not_supported' |
| 28 | Unfortunately IndexedDB is either not supported in your browser, disabled, or buggy. """ | 28 | """ Unfortunately your browser either doesn't support it or does not make it available. """ |
| 29 | when 'cant_open' | ||
| 30 | """ Although your browser appears to support it, DevDocs couldn't open the database.<br> | ||
| 31 | This could be because you're browsing in private mode and have disallowed offline storage on the domain. """ | ||
| 32 | when 'apple' | ||
| 33 | """ Unfortunately Safari's implementation of IndexedDB is <a href="https://bugs.webkit.org/show_bug.cgi?id=136937">badly broken</a>.<br> | ||
| 34 | This message will automatically go away when Apple fix their code. """ | ||
| 35 | |||
| 36 | error """ Oops, offline mode is unavailable. """, | ||
| 37 | """ DevDocs requires IndexedDB to cache documentations for offline access.<br>#{reason} """ | ||
| 29 | 38 | ||
| 30 | app.templates.unsupportedBrowser = """ | 39 | app.templates.unsupportedBrowser = """ |
| 31 | <div class="_fail"> | 40 | <div class="_fail"> |
| @@ -14,7 +14,7 @@ class app.views.OfflinePage extends app.View · 13 unmodified lines | |||
| 14 | app.docs.getInstallStatuses (statuses) => | 14 | app.docs.getInstallStatuses (statuses) => |
| 15 | return unless @activated | 15 | return unless @activated |
| 16 | if statuses is false | 16 | if statuses is false |
| 17 | @html @tmpl('offlineError') | 17 | @html @tmpl('offlineError', app.db.reason) |
| 18 | else | 18 | else |
| 19 | html = '' | 19 | html = '' |
| 20 | html += @renderDoc(doc, statuses[doc.slug]) for doc in app.docs.all() | 20 | html += @renderDoc(doc, statuses[doc.slug]) for doc in app.docs.all() |
| @@ -163,8 +163,8 @@ · 162 unmodified lines | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | ._error-title { | 165 | ._error-title { |
| 166 | margin: -5.5rem 0 .5rem; | 166 | margin: -5.5rem 0 1rem; |
| 167 | line-height: 2; | 167 | line-height: 2rem; |
| 168 | font-size: 1.5rem; | 168 | font-size: 1.5rem; |
| 169 | } | 169 | } |
| 170 | 170 | ||