From dd98af0775856fddef48d09b8a88b20de8352385 Mon Sep 17 00:00:00 2001 From: Haocen Xu Date: Sat, 30 May 2020 06:07:47 -0400 Subject: [PATCH] Avoid recreation of existing pasteurl element when calling URL shortener --- js/privatebin.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index b9f25b9..47aa248 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -1991,15 +1991,11 @@ jQuery.PrivateBin = (function($, RawDeflate) { return a.length - b.length; })[0]; if (typeof shortUrl === 'string' && shortUrl.length > 0) { - I18n._( - $('#pastelink'), - 'Your paste is %s (Hit [Ctrl]+[c] to copy)', - shortUrl, shortUrl - ); // we disable the button to avoid calling shortener again $shortenButton.addClass('buttondisabled'); - // save newly created element - $pasteUrl = $('#pasteurl'); + // update link + $pasteUrl.text(shortUrl); + $pasteUrl.prop('href', shortUrl); // we pre-select the link so that the user only has to [Ctrl]+[c] the link Helper.selectText($pasteUrl[0]); return;