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

View File

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

View File

@ -350,6 +350,9 @@ Settings =
if compareString < '00001.00011.00024.00000' if compareString < '00001.00011.00024.00000'
if data['JSON Navigation']? and not data['JSON Index']? if data['JSON Navigation']? and not data['JSON Index']?
set 'JSON Index', data['JSON Navigation'] 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 changes
loadSettings: (data, cb) -> loadSettings: (data, cb) ->

View File

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