Auto Shortening URLs

This commit is contained in:
Karthik Kasturi 2025-08-09 00:01:25 +01:00
parent 08c44cfb05
commit 059e64adb1
7 changed files with 43 additions and 2 deletions

View file

@ -2120,6 +2120,21 @@ jQuery.PrivateBin = (function($) {
Helper.selectText($pasteUrl[0]);
};
/**
* Checks if auto-shortening is enabled and sends the link to the shortener if it is.
*
* @name PasteStatus.checkAutoShorten
* @function
*/
me.checkAutoShorten = function() {
// check if auto-shortening is enabled
if ($shortenButton.data('autoshorten') === true) {
// if so, we send the link to the shortener
// we do not remove the button, in case shortener fails
sendToShortener();
}
}
/**
* extracts URLs from given string
*
@ -5030,6 +5045,8 @@ jQuery.PrivateBin = (function($) {
TopNav.hideDownloadButton();
Editor.hide();
PasteStatus.checkAutoShorten();
// parse and show text
// (preparation already done in me.sendPaste())
PasteViewer.run();