Commit 04daedf2 authored by Robert Hitt's avatar Robert Hitt

Moved inline JS. Also added Tooltip for copy btn.

parent 5c990d2b
Pipeline #390 passed with stage
in 3 minutes and 34 seconds
......@@ -22,17 +22,10 @@
<div class="container">
<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>
<a id="link" href="{{url.short}}">{{domain}}{{url.short}}</a>
<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'};
......
/*
* 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);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment