Add Oekaki to Quick Reply on /i/. #510
This commit is contained in:
parent
757812dda4
commit
d5a659ab4f
@ -1346,8 +1346,8 @@ input.field.tripped:not(:hover):not(:focus) {
|
|||||||
position: static !important;
|
position: static !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File Input, Submit Button */
|
/* File Input, Submit Button, Oekaki */
|
||||||
#file-n-submit {
|
#file-n-submit, .oekaki {
|
||||||
display: -webkit-flex;
|
display: -webkit-flex;
|
||||||
display: flex;
|
display: flex;
|
||||||
-webkit-align-items: stretch;
|
-webkit-align-items: stretch;
|
||||||
@ -1355,13 +1355,13 @@ input.field.tripped:not(:hover):not(:focus) {
|
|||||||
height: 25px;
|
height: 25px;
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
#file-n-submit > input {
|
#file-n-submit > input, #qr-draw-button {
|
||||||
background: linear-gradient(to bottom, #F8F8F8, #DCDCDC) no-repeat;
|
background: linear-gradient(to bottom, #F8F8F8, #DCDCDC) no-repeat;
|
||||||
border: 1px solid #BBB;
|
border: 1px solid #BBB;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
#qr-file-button {
|
#qr-file-button, #qr-draw-button {
|
||||||
width: 15%;
|
width: 15%;
|
||||||
}
|
}
|
||||||
#file-n-submit input[type="submit"] {
|
#file-n-submit input[type="submit"] {
|
||||||
@ -1401,6 +1401,28 @@ input#qr-filename {
|
|||||||
#qr-no-file {
|
#qr-no-file {
|
||||||
color: #AAA;
|
color: #AAA;
|
||||||
}
|
}
|
||||||
|
body:not(.board_i) .oekaki {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.oekaki > label {
|
||||||
|
-webkit-flex: 1 1 auto;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: 0;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.oekaki > label > span {
|
||||||
|
margin: 0 3px;
|
||||||
|
}
|
||||||
|
.oekaki > label > input {
|
||||||
|
-webkit-flex: 1 1 auto;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
#qr input[type="file"] {
|
#qr input[type="file"] {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@ -110,7 +110,8 @@
|
|||||||
background: rgb(26, 27, 29);
|
background: rgb(26, 27, 29);
|
||||||
}
|
}
|
||||||
:root.tomorrow #qr select,
|
:root.tomorrow #qr select,
|
||||||
:root.tomorrow #file-n-submit > input {
|
:root.tomorrow #file-n-submit > input,
|
||||||
|
:root.tomorrow #qr-draw-button {
|
||||||
border-color: rgb(40, 41, 42);
|
border-color: rgb(40, 41, 42);
|
||||||
}
|
}
|
||||||
:root.tomorrow #qr-filename {
|
:root.tomorrow #qr-filename {
|
||||||
|
|||||||
@ -23,6 +23,11 @@
|
|||||||
<div id="dump-list"></div>
|
<div id="dump-list"></div>
|
||||||
<a id="add-post" href="javascript:;" title="Add a post">+</a>
|
<a id="add-post" href="javascript:;" title="Add a post">+</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="oekaki">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
<div id="file-n-submit">
|
<div id="file-n-submit">
|
||||||
<input type="button" id="qr-file-button" value="Files">
|
<input type="button" id="qr-file-button" value="Files">
|
||||||
<span id="qr-filename-container" class="field">
|
<span id="qr-filename-container" class="field">
|
||||||
|
|||||||
@ -2,7 +2,8 @@ Polyfill =
|
|||||||
init: ->
|
init: ->
|
||||||
@toBlob()
|
@toBlob()
|
||||||
toBlob: ->
|
toBlob: ->
|
||||||
HTMLCanvasElement::toBlob or= (cb) ->
|
return if HTMLCanvasElement::toBlob
|
||||||
|
HTMLCanvasElement::toBlob = (cb) ->
|
||||||
data = atob @toDataURL()[22..]
|
data = atob @toDataURL()[22..]
|
||||||
# DataUrl to Binary code from Aeosynth's 4chan X repo
|
# DataUrl to Binary code from Aeosynth's 4chan X repo
|
||||||
l = data.length
|
l = data.length
|
||||||
@ -10,3 +11,4 @@ Polyfill =
|
|||||||
for i in [0...l] by 1
|
for i in [0...l] by 1
|
||||||
ui8a[i] = data.charCodeAt i
|
ui8a[i] = data.charCodeAt i
|
||||||
cb new Blob [ui8a], type: 'image/png'
|
cb new Blob [ui8a], type: 'image/png'
|
||||||
|
$.globalEval "HTMLCanvasElement.prototype.toBlob = (#{HTMLCanvasElement::toBlob});"
|
||||||
|
|||||||
@ -200,6 +200,22 @@ QR =
|
|||||||
QR.setCustomCooldown enabled
|
QR.setCustomCooldown enabled
|
||||||
$.set 'customCooldownEnabled', enabled
|
$.set 'customCooldownEnabled', enabled
|
||||||
|
|
||||||
|
oekakiDraw: ->
|
||||||
|
$.globalEval '''
|
||||||
|
Tegaki.open({
|
||||||
|
onDone: function() {
|
||||||
|
Tegaki.flatten().toBlob(function (blob) {
|
||||||
|
var detail = {file: blob, name: 'tegaki.png'};
|
||||||
|
var event = new CustomEvent('QRSetFile', {bubbles: true, detail: detail});
|
||||||
|
document.dispatchEvent(event);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel: function() {},
|
||||||
|
width: +document.querySelector('#qr [name=oekaki-width]').value,
|
||||||
|
height: +document.querySelector('#qr [name=oekaki-height]').value
|
||||||
|
});
|
||||||
|
'''
|
||||||
|
|
||||||
error: (err, focusOverride) ->
|
error: (err, focusOverride) ->
|
||||||
QR.open()
|
QR.open()
|
||||||
if typeof err is 'string'
|
if typeof err is 'string'
|
||||||
@ -470,6 +486,7 @@ QR =
|
|||||||
setNode 'fileInput', '[type=file]'
|
setNode 'fileInput', '[type=file]'
|
||||||
setNode 'customCooldown', '#custom-cooldown-button'
|
setNode 'customCooldown', '#custom-cooldown-button'
|
||||||
setNode 'flashTag', '[name=filetag]'
|
setNode 'flashTag', '[name=filetag]'
|
||||||
|
setNode 'drawButton', '#qr-draw-button'
|
||||||
|
|
||||||
rules = $('ul.rules').textContent.trim()
|
rules = $('ul.rules').textContent.trim()
|
||||||
match_min = rules.match(/.+smaller than (\d+)x(\d+).+/)
|
match_min = rules.match(/.+smaller than (\d+)x(\d+).+/)
|
||||||
@ -530,6 +547,7 @@ QR =
|
|||||||
$.on nodes.fileInput, 'change', QR.handleFiles
|
$.on nodes.fileInput, 'change', QR.handleFiles
|
||||||
$.on nodes.sjisToggle, 'click', QR.toggleSJIS
|
$.on nodes.sjisToggle, 'click', QR.toggleSJIS
|
||||||
$.on nodes.customCooldown, 'click', QR.toggleCustomCooldown
|
$.on nodes.customCooldown, 'click', QR.toggleCustomCooldown
|
||||||
|
$.on nodes.drawButton, 'click', QR.oekakiDraw
|
||||||
|
|
||||||
window.addEventListener 'focus', QR.focus, true
|
window.addEventListener 'focus', QR.focus, true
|
||||||
window.addEventListener 'blur', QR.focus, true
|
window.addEventListener 'blur', QR.focus, true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user