mirror of
https://github.com/friendica/friendica
synced 2025-04-25 17:50:11 +00:00
Add multimedia link for jot + enables hover text in jot + autosize in when paste link + renaming / Code Standards
This commit is contained in:
parent
ee006bdc18
commit
d2b5f77be9
8 changed files with 62 additions and 36 deletions
|
@ -24,7 +24,7 @@ function openClose(theID) {
|
|||
}
|
||||
|
||||
function openMenu(theID) {
|
||||
var el = document.getElementById(theID)
|
||||
var el = document.getElementById(theID);
|
||||
|
||||
if (el) {
|
||||
el.style.display = "block";
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* @brief The file contains functions for text editing and commenting
|
||||
*/
|
||||
|
||||
function commentGetLink(id) {
|
||||
reply = prompt("Please enter a link URL:");
|
||||
function commentGetLink(id,prompttext) {
|
||||
reply = prompt(prompttext);
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$.get('parse_url?isComment=1&binurl=' + reply, function(data) {
|
||||
addcommenttext(data, id);
|
||||
});
|
||||
}
|
||||
reply = bin2hex(reply);
|
||||
$.get('parse_url?noAttachment=1&binurl=' + reply, function(data) {
|
||||
addCommentText(data, id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addcommenttext(data, id) {
|
||||
function addCommentText(data, id) {
|
||||
// get the textfield
|
||||
var textfield = document.getElementById("comment-edit-text-" + id);
|
||||
// check if the textfield does have the default-value
|
||||
|
@ -24,19 +24,19 @@ function addcommenttext(data, id) {
|
|||
autosize.update($("#comment-edit-text-" + id));
|
||||
}
|
||||
|
||||
function commentlinkdrop(event, id) {
|
||||
function commentLinkDrop(event, id) {
|
||||
var reply = event.dataTransfer.getData("text/uri-list");
|
||||
event.target.textContent = reply;
|
||||
event.preventDefault();
|
||||
if (reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$.get('parse_url?isComment=1&binurl=' + reply, function(data) {
|
||||
addcommenttext(data, id);
|
||||
$.get('parse_url?noAttachment=1&binurl=' + reply, function(data) {
|
||||
addCommentText(data, id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function commentlinkdropper(event) {
|
||||
function commentLinkDropper(event) {
|
||||
var linkFound = event.dataTransfer.types.contains("text/uri-list");
|
||||
if (linkFound) {
|
||||
event.preventDefault();
|
||||
|
|
|
@ -38,10 +38,15 @@
|
|||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="btn-link icon bb-url" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" ondragenter="return commentlinkdrop(event, {{$id}});" ondragover="return commentlinkdrop(event, {{$id}});" ondrop="commentlinkdropper(event);" onclick="commentGetLink({{$id}});">
|
||||
<button type="button" class="btn-link icon bb-url" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" onclick="insertFormatting('url',{{$id}});">
|
||||
<i class="fa fa-link"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edattach}}" title="{{$edattach}}" ondragenter="return commentLinkDrop(event, {{$id}});" ondragover="return commentLinkDrop(event, {{$id}});" ondrop="commentLinkDropper(event);" onclick="commentGetLink({{$id}}, '{{$prompttext}}');">
|
||||
<i class="fa fa-paperclip"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="btn-link icon underline" style="cursor: pointer;" aria-label="{{$eduline}}" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});">
|
||||
<i class="fa fa-underline"></i>
|
||||
|
|
|
@ -127,14 +127,20 @@
|
|||
}
|
||||
|
||||
function jotGetLink() {
|
||||
var currentText = $("#profile-jot-text").val();
|
||||
var noAttachment = '';
|
||||
reply = prompt("{{$linkurl}}");
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$('#profile-rotator').show();
|
||||
$.get('parse_url?binurl=' + reply, function(data) {
|
||||
if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
|
||||
noAttachment = '&noAttachment=1';
|
||||
}
|
||||
$.get('parse_url?binurl=' + reply + noAttachment, function(data) {
|
||||
addeditortext(data);
|
||||
$('#profile-rotator').hide();
|
||||
});
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,18 +188,23 @@
|
|||
|
||||
function linkdrop(event) {
|
||||
var reply = event.dataTransfer.getData("text/uri-list");
|
||||
var noAttachment = '';
|
||||
event.target.textContent = reply;
|
||||
event.preventDefault();
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$('#profile-rotator').show();
|
||||
$.get('parse_url?binurl=' + reply, function(data) {
|
||||
if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
|
||||
noAttachment = '&noAttachment=1';
|
||||
}
|
||||
$.get('parse_url?binurl=' + reply + noAttachment, function(data) {
|
||||
if (!editor) $("#profile-jot-text").val("");
|
||||
initEditor(function(){
|
||||
addeditortext(data);
|
||||
$('#profile-rotator').hide();
|
||||
});
|
||||
});
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,6 +272,7 @@
|
|||
var currentText = $("#profile-jot-text").val();
|
||||
//insert the data as new value
|
||||
textfield.value = currentText + data;
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
|
||||
{{$geotag}}
|
||||
|
|
|
@ -97,9 +97,8 @@
|
|||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon italic" style="cursor: pointer;" aria-label="{{$editalic}}" title="{{$editalic}}" onclick="insertFormattingToPost('i');"><i class="fa fa-italic"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon bold" style="cursor: pointer;" aria-label="{{$edbold}}" title="{{$edbold}}" onclick="insertFormattingToPost('b');"><i class="fa fa-bold"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon quote" style="cursor: pointer;" aria-label="{{$edquote}}" title="{{$edquote}}" onclick="insertFormattingToPost('quote');"><i class="fa fa-quote-left"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" title="{{$weblink}}"><i class="fa fa-link"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-video" onclick="jotVideoURL();" title="{{$video}}"><i class="fa fa-film" aria-hidden="true"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-audio" onclick="jotAudioURL();" title="{{$audio}}"><i class="fa fa-music" aria-hidden="true"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" onclick="insertFormattingToPost('url');"><i class="fa fa-link"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-attach" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" title="{{$edattach}}"><i class="fa fa-paperclip"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-location" onclick="jotGetLocation();" title="{{$setloc}}"><i class="fa fa-map-marker" aria-hidden="true"></i></button></li>
|
||||
<!-- TODO: waiting for a better placement
|
||||
<li><button type="button" class="btn-link" id="profile-nolocation" onclick="jotClearLocation();" title="{{$noloc}}">{{$shortnoloc}}</button></li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue