1 // We append the linkPreview to a global Variable to make linkPreview
2 // accessable on other places. Note: search on other places before you
3 // delete or move the variable.
7 * Insert a link into friendica jot.
11 function jotGetLink() {
12 var currentText = $("#profile-jot-text").val();
13 var noAttachment = '';
14 reply = prompt(aStr.linkurl);
15 if(reply && reply.length) {
16 // There should be only one attachment per post.
17 // So we need to remove the old one.
18 $('#jot-attachment-preview').empty();
19 $('#profile-rotator').show();
20 if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
21 noAttachment = '&noAttachment=1';
24 // We use the linkPreview library to have a preview
25 // of the attachments.
26 if (typeof linkPreview === 'object') {
27 linkPreview.crawlText(reply + noAttachment);
29 // Fallback: insert the attachment bbcode directly into the textarea
30 // if the attachment live preview isn't available
32 $.get('parse_url?binurl=' + bin2hex(reply) + noAttachment, function(data) {
34 $('#profile-rotator').hide();
37 autosize.update($("#profile-jot-text"));