Revert "Load Tegaki from rawgit.com if loading from s.4cdn.org fails or is blocked."
This reverts commits 6027d94364fb1f70f9229aafb11d9696d34450e7 and d20e918c22cd1f361b91b67c5f340d6557fcf04e.
This commit is contained in:
parent
91777a1a59
commit
08c967ece5
@ -60,34 +60,19 @@ QR.oekaki =
|
|||||||
document.querySelector('#qr .oekaki').hidden = false
|
document.querySelector('#qr .oekaki').hidden = false
|
||||||
|
|
||||||
load: (cb) ->
|
load: (cb) ->
|
||||||
n = 0
|
if $ 'script[src^="//s.4cdn.org/js/painter"]', d.head
|
||||||
onload = ->
|
cb()
|
||||||
cb() if ++n is 2
|
|
||||||
onerror = ->
|
|
||||||
$.rm @
|
|
||||||
script = $.el 'script',
|
|
||||||
src: 'https://rawgit.com/desuwa/tegaki/master/tegaki.js'
|
|
||||||
$.on script, 'load', onload
|
|
||||||
$.add d.head, script
|
|
||||||
script = $ 'script[src^="//s.4cdn.org/js/painter"], script[src="https://rawgit.com/desuwa/tegaki/master/tegaki.js"]', d.head
|
|
||||||
if script
|
|
||||||
if !script.dataset.success
|
|
||||||
$.global ->
|
|
||||||
document.querySelector('script[src^="//s.4cdn.org/js/painter"], script[src="https://rawgit.com/desuwa/tegaki/master/tegaki.js"]').dataset.success = !!window.Tegaki
|
|
||||||
if script.dataset.success is 'true'
|
|
||||||
cb()
|
|
||||||
else
|
|
||||||
n = 1
|
|
||||||
onerror.call script
|
|
||||||
else
|
else
|
||||||
style = $.el 'link',
|
style = $.el 'link',
|
||||||
rel: 'stylesheet'
|
rel: 'stylesheet'
|
||||||
href: "//s.4cdn.org/css/painter.#{Date.now()}.css"
|
href: "//s.4cdn.org/css/painter.#{Date.now()}.css"
|
||||||
script = $.el 'script',
|
script = $.el 'script',
|
||||||
src: "//s.4cdn.org/js/painter.min.#{Date.now()}.js"
|
src: "//s.4cdn.org/js/painter.min.#{Date.now()}.js"
|
||||||
|
n = 0
|
||||||
|
onload = ->
|
||||||
|
cb() if ++n is 2
|
||||||
$.on style, 'load', onload
|
$.on style, 'load', onload
|
||||||
$.on script, 'load', onload
|
$.on script, 'load', onload
|
||||||
$.on script, 'error', onerror
|
|
||||||
$.add d.head, [style, script]
|
$.add d.head, [style, script]
|
||||||
|
|
||||||
draw: ->
|
draw: ->
|
||||||
|
|||||||
@ -862,7 +862,6 @@ Config =
|
|||||||
http://cdn.mathjax.org
|
http://cdn.mathjax.org
|
||||||
https://cdn.mathjax.org
|
https://cdn.mathjax.org
|
||||||
https://cdnjs.cloudflare.com
|
https://cdnjs.cloudflare.com
|
||||||
https://rawgit.com
|
|
||||||
'self'
|
'self'
|
||||||
'unsafe-inline'
|
'unsafe-inline'
|
||||||
'unsafe-eval'
|
'unsafe-eval'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user