Move image editing link into menu. #561

This commit is contained in:
ccd0 2016-02-13 11:43:08 -08:00
parent ff4e1b2330
commit 22fc57ab94
4 changed files with 22 additions and 21 deletions

View File

@ -210,10 +210,6 @@ Config =
'Show PDF files in gallery.'
1
]
'Oekaki Links': [
true
'Add links to edit images in Tegaki, /i/\'s painting program.'
]
'Sauce': [
true
'Add sauce links to images.'
@ -313,6 +309,11 @@ Config =
'Add post and image deletion links to the menu.'
1
]
'Edit Link': [
true
'Add a link to edit the image in Tegaki, /i/\'s painting program. Requires Quick Reply.'
1
]
'Download Link': [
true
'Add a download with original filename link to the menu.'

View File

@ -57,6 +57,7 @@ Main =
# XXX old key names
Conf['Except Archives from Encryption'] = false
Conf['JSON Navigation'] = true
Conf['Oekaki Links'] = true
# Get saved values as items
items = {}
@ -397,7 +398,6 @@ Main =
['Strike-through Quotes', QuoteStrikeThrough]
['Quick Reply', QR]
['Cooldown', QR.cooldown]
['Oekaki Links', QR.oekaki]
['Pass Link', PassLink]
['Menu', Menu]
['Index Generator (Menu)', Index.menu]
@ -406,6 +406,7 @@ Main =
['Reply Hiding (Menu)', PostHiding.menu]
['Delete Link', DeleteLink]
['Filter (Menu)', Filter.menu]
['Edit Link', QR.oekaki]
['Download Link', DownloadLink]
['Archive Link', ArchiveLink]
['Quote Inlining', QuoteInline]

View File

@ -350,6 +350,9 @@ Settings =
if compareString < '00001.00011.00024.00000'
if data['JSON Navigation']? and not data['JSON Index']?
set 'JSON Index', data['JSON Navigation']
if compareString < '00001.00011.00026.00000'
if data['Oekaki Links']? and not data['Edit Link']?
set 'Edit Link', data['Oekaki Links']
changes
loadSettings: (data, cb) ->

View File

@ -1,22 +1,18 @@
QR.oekaki =
init: ->
return unless Conf['Quick Reply'] and Conf['Oekaki Links']
Post.callbacks.push
name: 'Oekaki Links'
cb: @node
return unless Conf['Quick Reply'] and Conf['Edit Link']
node: ->
return unless @file and (@file.isImage or @file.isVideo)
if @isClone
link = $ '.file-oekaki', @file.text
else
link = $.el 'a',
className: 'file-oekaki'
href: 'javascript:;'
title: 'Edit in Tegaki'
$.extend link, <%= html('<i class="fa fa-edit"></i>') %>
$.add @file.text, [$.tn('\u00A0'), link]
$.on link, 'click', QR.oekaki.editFile
a = $.el 'a',
className: 'edit-link'
href: 'javascript:;'
textContent: 'Edit image'
$.on a, 'click', @editFile
Menu.menu.addEntry
el: a
order: 95
open: ({file}) ->
!!file and (file.isImage or file.isVideo)
editFile: ->
return unless QR.postingIsEnabled