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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
2a368021
Commit
2a368021
authored
9 years ago
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a fallback for Safari copy-to-clipboard
Also, hide the tooltip in a less stupid way. Closes #3547
parent
e1780825
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
app/assets/javascripts/copy_to_clipboard.js.coffee
app/assets/javascripts/copy_to_clipboard.js.coffee
+16
-5
No files found.
app/assets/javascripts/copy_to_clipboard.js.coffee
View file @
2a368021
...
...
@@ -9,13 +9,24 @@ $ ->
clipboard
.
on
'success'
,
(
e
)
->
$
(
e
.
trigger
).
tooltip
(
trigger
:
'manual'
,
placement
:
'auto bottom'
,
title
:
'Copied!'
).
tooltip
(
'show'
)
tooltip
(
'show'
).
one
(
'mouseleave'
,
->
$
(
this
).
tooltip
(
'hide'
))
# 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
)
# Safari doesn't support `execCommand`, so instead we inform the user to
# copy manually.
#
# See http://clipboardjs.com/#browser-support
clipboard
.
on
'error'
,
(
e
)
->
if
/Mac/i
.
test
(
navigator
.
userAgent
)
title
=
"Press ⌘-C to copy"
else
title
=
"Press Ctrl-C to copy"
$
(
e
.
trigger
).
tooltip
(
trigger
:
'manual'
,
placement
:
'auto bottom'
,
html
:
true
,
title
:
title
).
tooltip
(
'show'
).
one
(
'mouseleave'
,
->
$
(
this
).
tooltip
(
'hide'
))
This diff is collapsed.
Click to expand it.
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