Merge remote-tracking branch 'friendlyanon/master'
This commit is contained in:
commit
40fb4fba4c
25
src/Menu/CopyTextLink.coffee
Normal file
25
src/Menu/CopyTextLink.coffee
Normal file
@ -0,0 +1,25 @@
|
||||
CopyTextLink =
|
||||
init: ->
|
||||
return unless g.VIEW in ['index', 'thread'] and Conf['Menu'] and Conf['Copy Text Link']
|
||||
|
||||
a = $.el 'a',
|
||||
className: 'copy-text-link'
|
||||
href: 'javascript:;'
|
||||
textContent: 'Copy Text'
|
||||
$.on a, 'click', CopyTextLink.copy
|
||||
|
||||
Menu.menu.addEntry
|
||||
el: a
|
||||
open: (post) ->
|
||||
CopyTextLink.text = post.nodes.commentClean.innerText
|
||||
true
|
||||
|
||||
copy: ->
|
||||
el = $.el 'textarea',
|
||||
className: 'copy-text-element',
|
||||
value: CopyTextLink.text
|
||||
$.add d.body, el
|
||||
el.select()
|
||||
try
|
||||
d.execCommand 'copy'
|
||||
$.rm el
|
||||
@ -307,6 +307,11 @@ Config =
|
||||
'Add a report link to the menu.'
|
||||
1
|
||||
]
|
||||
'Copy Text Link': [
|
||||
true
|
||||
'Add a link to copy the post\'s text.'
|
||||
1
|
||||
]
|
||||
'Thread Hiding Link': [
|
||||
true
|
||||
'Add a link to hide entire threads.'
|
||||
|
||||
@ -1012,6 +1012,14 @@ div[data-checked="false"] > .suboption-list {
|
||||
left: calc(110px - .5px * var(--tn-w));
|
||||
}
|
||||
|
||||
/* Copy Text Link's textarea element */
|
||||
textarea.copy-text-element {
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
}
|
||||
|
||||
/* Announcement Hiding */
|
||||
:root.hide-announcement #globalMessage {
|
||||
display: none;
|
||||
|
||||
@ -461,6 +461,7 @@ Main =
|
||||
['Menu', Menu]
|
||||
['Index Generator (Menu)', Index.menu]
|
||||
['Report Link', ReportLink]
|
||||
['Copy Text Link', CopyTextLink]
|
||||
['Thread Hiding (Menu)', ThreadHiding.menu]
|
||||
['Reply Hiding (Menu)', PostHiding.menu]
|
||||
['Delete Link', DeleteLink]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user