Add support for the flag selector on /pol/. #1270
This commit is contained in:
parent
5523d9a6a8
commit
1208e96233
@ -581,7 +581,7 @@ a.hide-announcement {
|
|||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
#qr select {
|
#qr select[data-name=thread] {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
|||||||
@ -522,8 +522,9 @@ QR =
|
|||||||
lock: (lock=true) ->
|
lock: (lock=true) ->
|
||||||
@isLocked = lock
|
@isLocked = lock
|
||||||
return unless @ is QR.selected
|
return unless @ is QR.selected
|
||||||
for name in ['thread', 'name', 'email', 'sub', 'com', 'fileButton', 'filename', 'spoiler']
|
for name in ['thread', 'name', 'email', 'sub', 'com', 'fileButton', 'filename', 'spoiler', 'flag']
|
||||||
QR.nodes[name].disabled = lock
|
continue unless node = QR.nodes[name]
|
||||||
|
node.disabled = lock
|
||||||
@nodes.rm.style.visibility = if lock then 'hidden' else ''
|
@nodes.rm.style.visibility = if lock then 'hidden' else ''
|
||||||
(if lock then $.off else $.on) QR.nodes.filename.previousElementSibling, 'click', QR.openFileInput
|
(if lock then $.off else $.on) QR.nodes.filename.previousElementSibling, 'click', QR.openFileInput
|
||||||
@nodes.spoiler.disabled = lock
|
@nodes.spoiler.disabled = lock
|
||||||
@ -545,8 +546,9 @@ QR =
|
|||||||
$.event 'QRPostSelection', @
|
$.event 'QRPostSelection', @
|
||||||
load: ->
|
load: ->
|
||||||
# Load this post's values.
|
# Load this post's values.
|
||||||
for name in ['thread', 'name', 'email', 'sub', 'com', 'filename']
|
for name in ['thread', 'name', 'email', 'sub', 'com', 'filename', 'flag']
|
||||||
QR.nodes[name].value = @[name] or null
|
continue unless node = QR.nodes[name]
|
||||||
|
node.value = @[name] or node.dataset.default or null
|
||||||
@showFileData()
|
@showFileData()
|
||||||
QR.characterCount()
|
QR.characterCount()
|
||||||
save: (input) ->
|
save: (input) ->
|
||||||
@ -554,7 +556,7 @@ QR =
|
|||||||
@spoiler = input.checked
|
@spoiler = input.checked
|
||||||
return
|
return
|
||||||
{name} = input.dataset
|
{name} = input.dataset
|
||||||
@[name] = input.value
|
@[name] = input.value or input.dataset.default or null
|
||||||
switch name
|
switch name
|
||||||
when 'thread'
|
when 'thread'
|
||||||
QR.status()
|
QR.status()
|
||||||
@ -578,8 +580,9 @@ QR =
|
|||||||
return unless @ is QR.selected
|
return unless @ is QR.selected
|
||||||
# Do this in case people use extensions
|
# Do this in case people use extensions
|
||||||
# that do not trigger the `input` event.
|
# that do not trigger the `input` event.
|
||||||
for name in ['thread', 'name', 'email', 'sub', 'com', 'filename', 'spoiler']
|
for name in ['thread', 'name', 'email', 'sub', 'com', 'filename', 'spoiler', 'flag']
|
||||||
@save QR.nodes[name]
|
continue unless node = QR.nodes[name]
|
||||||
|
@save node
|
||||||
return
|
return
|
||||||
setFile: (@file) ->
|
setFile: (@file) ->
|
||||||
@filename = file.name
|
@filename = file.name
|
||||||
@ -856,7 +859,13 @@ QR =
|
|||||||
<option value=5>Loop</option>
|
<option value=5>Loop</option>
|
||||||
<option value=4 selected>Other</option>
|
<option value=4 selected>Other</option>
|
||||||
"""
|
"""
|
||||||
|
nodes.flashTag.dataset.default = '4'
|
||||||
$.add nodes.form, nodes.flashTag
|
$.add nodes.form, nodes.flashTag
|
||||||
|
if flagSelector = $ '.flagSelector'
|
||||||
|
nodes.flag = flagSelector.cloneNode true
|
||||||
|
nodes.flag.dataset.name = 'flag'
|
||||||
|
nodes.flag.dataset.default = '0'
|
||||||
|
$.add nodes.form, nodes.flag
|
||||||
|
|
||||||
# Make a list of threads.
|
# Make a list of threads.
|
||||||
for thread of g.BOARD.threads
|
for thread of g.BOARD.threads
|
||||||
@ -882,9 +891,11 @@ QR =
|
|||||||
$.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click()
|
$.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click()
|
||||||
$.on nodes.fileInput, 'change', QR.handleFiles
|
$.on nodes.fileInput, 'change', QR.handleFiles
|
||||||
# save selected post's data
|
# save selected post's data
|
||||||
for name in ['name', 'email', 'sub', 'com', 'filename']
|
save = -> QR.selected.save @
|
||||||
$.on nodes[name], 'input', -> QR.selected.save @
|
for name in ['thread', 'name', 'email', 'sub', 'com', 'filename', 'flag']
|
||||||
$.on nodes.thread, 'change', -> QR.selected.save @
|
continue unless node = nodes[name]
|
||||||
|
event = if node.nodeName is 'SELECT' then 'change' else 'input'
|
||||||
|
$.on nodes[name], event, save
|
||||||
|
|
||||||
<% if (type === 'userscript') { %>
|
<% if (type === 'userscript') { %>
|
||||||
if Conf['Remember QR Size']
|
if Conf['Remember QR Size']
|
||||||
@ -965,7 +976,7 @@ QR =
|
|||||||
|
|
||||||
post.lock()
|
post.lock()
|
||||||
|
|
||||||
postData =
|
formData =
|
||||||
resto: threadID
|
resto: threadID
|
||||||
name: post.name
|
name: post.name
|
||||||
email: post.email
|
email: post.email
|
||||||
@ -974,6 +985,7 @@ QR =
|
|||||||
upfile: post.file
|
upfile: post.file
|
||||||
filetag: filetag
|
filetag: filetag
|
||||||
spoiler: post.spoiler
|
spoiler: post.spoiler
|
||||||
|
flag: post.flag
|
||||||
textonly: textOnly
|
textonly: textOnly
|
||||||
mode: 'regist'
|
mode: 'regist'
|
||||||
pwd: QR.persona.pwd
|
pwd: QR.persona.pwd
|
||||||
@ -997,7 +1009,7 @@ QR =
|
|||||||
[<a href="https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean" target=_blank>FAQ</a>]
|
[<a href="https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean" target=_blank>FAQ</a>]
|
||||||
"""
|
"""
|
||||||
extra =
|
extra =
|
||||||
form: $.formData postData
|
form: $.formData formData
|
||||||
upCallbacks:
|
upCallbacks:
|
||||||
onload: ->
|
onload: ->
|
||||||
# Upload done, waiting for server response.
|
# Upload done, waiting for server response.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user