Support editing with oekaki painter on boards other than /i/.

This commit is contained in:
ccd0 2015-10-25 01:34:00 -07:00
parent cb453b068d
commit 58a51cdf3b
2 changed files with 17 additions and 2 deletions

View File

@ -1450,7 +1450,6 @@ input#qr-filename {
#qr:not(.has-spoiler) #qr-spoiler-label,
#file-n-submit:not(.has-file) #qr-spoiler-label,
#file-n-submit:not(.has-file) #qr-edit-button,
body:not(.board_i) #qr-edit-button,
.has-file #paste-area,
.has-file #url-button,
#file-n-submit:not(.custom-cooldown) #custom-cooldown-button {

View File

@ -1,4 +1,20 @@
QR.oekaki =
load: (cb) ->
if $ 'script[src^="//s.4cdn.org/js/painter"]', d.head
cb()
else
style = $.el 'link',
rel: 'stylesheet'
href: "//s.4cdn.org/css/painter.#{Date.now()}.css"
script = $.el 'script',
src: "//s.4cdn.org/js/painter.min.#{Date.now()}.js"
n = 0
onload = ->
cb() if ++n is 2
$.on style, 'load', onload
$.on script, 'load', onload
$.add d.head, [style, script]
draw: ->
$.global ->
{Tegaki} = window
@ -13,7 +29,7 @@ QR.oekaki =
height: +document.querySelector('#qr [name=oekaki-height]').value
edit: ->
$.global ->
QR.oekaki.load -> $.global ->
{Tegaki} = window
name = document.getElementById('qr-filename').value.replace(/\.\w+$/, '') + '.png'
error = (content) ->