blob: 9569593012af1d0859366891bc7768d70b4b8eb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
STUDIP.ready(function() {
jQuery(document).on('click', '#short_url_action', function(event) {
event.preventDefault();
//Get the current path:
let path = jQuery(event.target).data('path');
if (path.length < 1) {
return;
}
//Send a request to create a short-URL:
jQuery.ajax(
{
url: STUDIP.URLHelper.getURL('dispatch.php/u/create'),
data: {
path: path
},
method: 'POST'
}
).done(function (data) {
//Copy the Short-URL into the clipboard:
navigator.clipboard.writeText(data.full_short_url);
//Open the dialog with the short-URL to allow setting an alias:
STUDIP.Dialog.fromURL(STUDIP.URLHelper.getURL('dispatch.php/u/alias/' + data.url_id));
});
});
});
|