Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c05275a2
Commit
c05275a2
authored
Sep 30, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add copy_to_clipboard JS
parent
20164159
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
app/assets/javascripts/copy_to_clipboard.js.coffee
app/assets/javascripts/copy_to_clipboard.js.coffee
+21
-0
No files found.
app/assets/javascripts/copy_to_clipboard.js.coffee
0 → 100644
View file @
c05275a2
#= require clipboard
$
->
clipboard
=
new
Clipboard
'.js-clipboard-trigger'
,
text
:
(
trigger
)
->
$target
=
$
(
trigger
.
nextElementSibling
||
trigger
.
previousElementSibling
)
$target
.
data
(
'clipboard-text'
)
||
$target
.
text
().
trim
()
clipboard
.
on
'success'
,
(
e
)
->
$
(
e
.
trigger
).
tooltip
(
trigger
:
'manual'
,
placement
:
'auto bottom'
,
title
:
'Copied!'
).
tooltip
(
'show'
)
# Clear the selection and blur the trigger so it loses its border
e
.
clearSelection
()
$
(
e
.
trigger
).
blur
()
# Manually hide the tooltip after 1 second
setTimeout
(
->
$
(
e
.
trigger
).
tooltip
(
'hide'
)
,
1000
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment