Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
04daedf2
Commit
04daedf2
authored
Oct 14, 2016
by
Robert Hitt
Browse files
Moved inline JS. Also added Tooltip for copy btn.
parent
5c990d2b
Pipeline
#390
passed with stage
in 3 minutes and 34 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
go/go/templates/link_box.html
View file @
04daedf2
...
...
@@ -23,16 +23,9 @@
<div
class=
"col-md-8"
>
<h3>
Go Address:
</h3>
<a
id=
"link"
href=
"{{url.short}}"
>
{{domain}}{{url.short}}
</a>
<br></br>
<button
type=
"button"
class=
"button btn btn-default btn-xs fa"
role=
"button"
id=
"btn"
data-clipboard-target=
"#link"
>
<i
class=
"fa fa-clipboard"
aria-hidden=
"true"
></i>
Copy to clipboard
</button>
<script
src=
"../../static/js/clipboard.min.js"
></script>
<script>
var
btn
=
document
.
getElementById
(
'
btn
'
);
var
clipboard
=
new
Clipboard
(
btn
);
</script>
<button
id=
"btn"
type=
"button"
class=
"button btn btn-default btn-xs fa"
role=
"button"
data-clipboard-target=
"#link"
>
<i
class=
"fa fa-clipboard"
aria-hidden=
"true"
></i></button>
<br></br>
<h3>
Address Details:
</h3>
...
...
@@ -104,6 +97,8 @@
</div>
</div>
<script
src=
"../../static/js/clipboard.min.js"
></script>
<script
src=
"../../static/js/copy.js"
></script>
<script>
$
(
function
()
{
var
option
=
{
'
trigger
'
:
'
hover
'
};
...
...
go/static/js/copy.js
0 → 100644
View file @
04daedf2
/*
* Script for copying text and displaying a tooltip.
*/
$
(
'
#btn
'
).
tooltip
({
trigger
:
'
click
'
,
placement
:
'
bottom
'
});
function
setTooltip
(
button
,
message
)
{
$
(
button
).
tooltip
(
'
hide
'
).
attr
(
'
data-original-title
'
,
message
)
.
tooltip
(
'
show
'
);
}
function
hideTooltip
(
button
)
{
window
.
setTimeout
(
function
()
{
$
(
button
).
tooltip
(
'
hide
'
);
},
700
);
}
var
clipboard
=
new
Clipboard
(
'
#btn
'
);
clipboard
.
on
(
'
success
'
,
function
(
e
)
{
e
.
clearSelection
();
setTooltip
(
e
.
trigger
,
'
Copied!
'
);
hideTooltip
(
e
.
trigger
);
});
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