With no file selected, oekaki button in QR shows/hides new image controls.

This commit is contained in:
ccd0 2015-10-25 20:34:18 -07:00
parent 6e3658c1b0
commit 673408f5e1
4 changed files with 14 additions and 4 deletions

View File

@ -1248,7 +1248,6 @@ input[name="Default Volume"] {
#qr.reply-to-thread input[data-name="sub"]:not(.force-show),
body:not(.board_f) #qr select[name="filetag"],
#qr.reply-to-thread select[name="filetag"],
body:not(.board_i) .oekaki,
body:not(.board_jp) #sjis-toggle,
body:not(.board_sci) #tex-preview-button,
#qr.tex-preview .textarea > :not(#tex-preview),
@ -1452,7 +1451,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-oekaki-button,
.has-file #paste-area,
.has-file #url-button,
#file-n-submit:not(.custom-cooldown) #custom-cooldown-button {

View File

@ -25,7 +25,7 @@
<div id="dump-list"></div>
<a id="add-post" href="javascript:;" title="Add a post">+</a>
</div>
<div class="oekaki">
<div class="oekaki" hidden>
<input type="button" id="qr-draw-button" value="Draw">
<label><span>Width:</span><input name="oekaki-width" value="400" type="number" class="field" size="1"></label>
<label><span>Height:</span><input name="oekaki-height" value="400" type="number" class="field" size="1"></label>

View File

@ -547,7 +547,7 @@ QR =
$.on nodes.filename, 'focus', -> $.addClass @parentNode, 'focus'
$.on nodes.filename, 'blur', -> $.rmClass @parentNode, 'focus'
$.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click()
$.on nodes.oekakiButton, 'click', QR.oekaki.edit
$.on nodes.oekakiButton, 'click', QR.oekaki.button
$.on nodes.fileRM, 'click', -> QR.selected.rmFile()
$.on nodes.urlButton, 'click', -> QR.handleUrl ''
$.on nodes.customCooldown, 'click', QR.toggleCustomCooldown

View File

@ -42,6 +42,8 @@ QR.oekaki =
document.dispatchEvent new CustomEvent 'QRSetFile',
bubbles: true
detail: {file, name: FCX.oekakiName, source}
if window.Tegaki
document.querySelector('#qr .oekaki').hidden = false
load: (cb) ->
if $ 'script[src^="//s.4cdn.org/js/painter"]', d.head
@ -70,6 +72,12 @@ QR.oekaki =
width: +document.querySelector('#qr [name=oekaki-width]').value
height: +document.querySelector('#qr [name=oekaki-height]').value
button: ->
if QR.selected.file
QR.oekaki.edit()
else
QR.oekaki.toggle()
edit: ->
QR.oekaki.load -> $.global ->
{Tegaki, FCX} = window
@ -102,3 +110,7 @@ QR.oekaki =
else
document.addEventListener 'QRFile', cb, false
document.dispatchEvent new CustomEvent 'QRGetFile', {bubbles: true}
toggle: ->
QR.oekaki.load ->
QR.nodes.oekaki.hidden = !QR.nodes.oekaki.hidden