Skip to content

Instantly share code, notes, and snippets.

@wegorich
Created January 5, 2015 11:17
Show Gist options
  • Save wegorich/8836f461917ceda3e95c to your computer and use it in GitHub Desktop.
Save wegorich/8836f461917ceda3e95c to your computer and use it in GitHub Desktop.
goo.gl format link for dissertation literature
var textToPutOnClipboard = "This is some text";
document.addEventListener('copy', function(e) {
e.clipboardData.setData('text/plain', textToPutOnClipboard);
e.preventDefault();
});
$('#shortenerSubmitButton').on('mousedown',function(){
setTimeout(function(){
var host = new URL($('#shortenerInputText').val()).hostname;
host = host.charAt(0).toUpperCase() + host.substring(1);
console.log(host);
var shortUrl = $('.GJUPD0RBPC').first().find('.GJUPD0RBOC.GJUPD0RBAD:nth-child(4) a').attr('href');
console.log(shortUrl);
textToPutOnClipboard = host + ' [Электронный ресурс] / a. – Режим доступа: ' + shortUrl;
$('#shortener div:nth-child(5)').html(textToPutOnClipboard);
document.execCommand('copy');
window.open(shortUrl,"","width=600,height=300");
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment