Add links to images to open them in the oekaki painter.
This commit is contained in:
parent
154272ece7
commit
1845c6b033
@ -210,6 +210,10 @@ Config =
|
|||||||
'Show PDF files in gallery.'
|
'Show PDF files in gallery.'
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
|
'Oekaki Links': [
|
||||||
|
true
|
||||||
|
'Add links to edit images in oekaki painter.'
|
||||||
|
]
|
||||||
'Sauce': [
|
'Sauce': [
|
||||||
true
|
true
|
||||||
'Add sauce links to images.'
|
'Add sauce links to images.'
|
||||||
|
|||||||
@ -387,6 +387,7 @@ Main =
|
|||||||
['Strike-through Quotes', QuoteStrikeThrough]
|
['Strike-through Quotes', QuoteStrikeThrough]
|
||||||
['Quick Reply', QR]
|
['Quick Reply', QR]
|
||||||
['Cooldown', QR.cooldown]
|
['Cooldown', QR.cooldown]
|
||||||
|
['Oekaki Links', QR.oekaki]
|
||||||
['Menu', Menu]
|
['Menu', Menu]
|
||||||
['Index Generator (Menu)', Index.menu]
|
['Index Generator (Menu)', Index.menu]
|
||||||
['Report Link', ReportLink]
|
['Report Link', ReportLink]
|
||||||
|
|||||||
@ -273,6 +273,14 @@ QR =
|
|||||||
value
|
value
|
||||||
status.disabled = disabled or false
|
status.disabled = disabled or false
|
||||||
|
|
||||||
|
openPost: ->
|
||||||
|
QR.open()
|
||||||
|
if QR.selected.isLocked
|
||||||
|
index = QR.posts.indexOf QR.selected
|
||||||
|
(QR.posts[index+1] or new QR.post()).select()
|
||||||
|
$.addClass QR.nodes.el, 'dump'
|
||||||
|
QR.cooldown.auto = true
|
||||||
|
|
||||||
quote: (e) ->
|
quote: (e) ->
|
||||||
e?.preventDefault()
|
e?.preventDefault()
|
||||||
return unless QR.postingIsEnabled
|
return unless QR.postingIsEnabled
|
||||||
@ -306,12 +314,7 @@ QR =
|
|||||||
$.rm node
|
$.rm node
|
||||||
text += ">#{frag.textContent.trim()}\n"
|
text += ">#{frag.textContent.trim()}\n"
|
||||||
|
|
||||||
QR.open()
|
QR.openPost()
|
||||||
if QR.selected.isLocked
|
|
||||||
index = QR.posts.indexOf QR.selected
|
|
||||||
(QR.posts[index+1] or new QR.post()).select()
|
|
||||||
$.addClass QR.nodes.el, 'dump'
|
|
||||||
QR.cooldown.auto = true
|
|
||||||
{com, thread} = QR.nodes
|
{com, thread} = QR.nodes
|
||||||
thread.value = Get.threadFromNode @ unless com.value
|
thread.value = Get.threadFromNode @ unless com.value
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,37 @@
|
|||||||
QR.oekaki =
|
QR.oekaki =
|
||||||
|
init: ->
|
||||||
|
return unless Conf['Quick Reply'] and Conf['Oekaki Links']
|
||||||
|
Post.callbacks.push
|
||||||
|
name: 'Oekaki Links'
|
||||||
|
cb: @node
|
||||||
|
|
||||||
|
node: ->
|
||||||
|
return unless @file?.isImage
|
||||||
|
if @isClone
|
||||||
|
link = $ '.file-edit', @file.text
|
||||||
|
else
|
||||||
|
link = $.el 'a',
|
||||||
|
className: 'file-edit'
|
||||||
|
href: 'javascript:;'
|
||||||
|
title: 'Edit image'
|
||||||
|
$.extend link, <%= html('<i class="fa fa-edit"></i>') %>
|
||||||
|
$.add @file.text, [$.tn('\u00A0'), link]
|
||||||
|
$.on link, 'click', QR.oekaki.editFile
|
||||||
|
|
||||||
|
editFile: ->
|
||||||
|
post = Get.postFromNode @
|
||||||
|
CrossOrigin.file post.file.url, (blob) ->
|
||||||
|
QR.openPost()
|
||||||
|
{com, thread} = QR.nodes
|
||||||
|
thread.value = (post.context or post).thread.ID unless com.value
|
||||||
|
QR.selected.save thread
|
||||||
|
if blob
|
||||||
|
blob.name = post.file.name
|
||||||
|
QR.handleFiles [blob]
|
||||||
|
QR.oekaki.edit()
|
||||||
|
else
|
||||||
|
QR.error "Can't load image."
|
||||||
|
|
||||||
load: (cb) ->
|
load: (cb) ->
|
||||||
if $ 'script[src^="//s.4cdn.org/js/painter"]', d.head
|
if $ 'script[src^="//s.4cdn.org/js/painter"]', d.head
|
||||||
cb()
|
cb()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user