Avoid recreation of existing pasteurl element when calling URL shortener
This commit is contained in:
parent
5f0011b0f6
commit
dd98af0775
|
@ -1991,15 +1991,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
return a.length - b.length;
|
return a.length - b.length;
|
||||||
})[0];
|
})[0];
|
||||||
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
|
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
|
||||||
I18n._(
|
|
||||||
$('#pastelink'),
|
|
||||||
'Your paste is <a id="pasteurl" href="%s">%s</a> <span id="copyhint">(Hit [Ctrl]+[c] to copy)</span>',
|
|
||||||
shortUrl, shortUrl
|
|
||||||
);
|
|
||||||
// we disable the button to avoid calling shortener again
|
// we disable the button to avoid calling shortener again
|
||||||
$shortenButton.addClass('buttondisabled');
|
$shortenButton.addClass('buttondisabled');
|
||||||
// save newly created element
|
// update link
|
||||||
$pasteUrl = $('#pasteurl');
|
$pasteUrl.text(shortUrl);
|
||||||
|
$pasteUrl.prop('href', shortUrl);
|
||||||
// we pre-select the link so that the user only has to [Ctrl]+[c] the link
|
// we pre-select the link so that the user only has to [Ctrl]+[c] the link
|
||||||
Helper.selectText($pasteUrl[0]);
|
Helper.selectText($pasteUrl[0]);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue