1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-10 04:02:28 +01:00
polr/public/js/shorten_result.js
2018-03-29 00:01:38 -04:00

42 lines
894 B
JavaScript

var original_link;
function select_text() {
$('.result-box').focus().select();
}
$('.result-box').click(select_text);
$('.result-box').change(function () {
$(this).val(original_link);
});
$('#generate-qr-code').click(function () {
var container = $('.qr-code-container');
container.empty();
new QRCode(container.get(0), {
text: original_link,
width: 280,
height: 280
});
container.find('img').attr('alt', original_link);
container.show();
});
var clipboard = new Clipboard('#clipboard-copy');
clipboard.on('success', function(e) {
e.clearSelection();
$('#clipboard-copy').tooltip('show');
});
$('#clipboard-copy').on('blur',function () {
$(this).tooltip('destroy');
}).on('mouseleave',function () {
$(this).tooltip('destroy');
});
$(function () {
original_link = $('.result-box').val();
select_text();
});