the link icon on comments now calls the link parsing tool (just like the main editor window). Eventually the link specific icons (image, link, audio, video) will all be handled by inserting a link using the link icon (here and in the main editor window) and the separate buttons will go away. We also need to tie this to oembed so that there's one place to insert a link - no matter what kind of link it is, and we'll try to find the best way to render that as content. Similarly upload will upload content, no matter what kind of content; and we'll likewise try and figure out the best way to present whatever content was uploaded (img, file, audio, video, whatever).

This commit is contained in:
friendica 2015-03-04 20:00:54 -08:00
parent 76eb0a7e56
commit 2ea162136e
5 changed files with 39 additions and 2 deletions

View File

@ -20,6 +20,7 @@ function js_strings() {
'$rating_val' => t('Rating'), '$rating_val' => t('Rating'),
'$rating_text' => t('Describe (optional)'), '$rating_text' => t('Describe (optional)'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$linkurl' => t('Please enter a link URL'),
'$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : ''), '$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : ''),
'$t02' => ((t('timeago.prefixFromNow') != 'timeago.prefixFromNow') ? t('timeago.prefixFromNow') : ''), '$t02' => ((t('timeago.prefixFromNow') != 'timeago.prefixFromNow') ? t('timeago.prefixFromNow') : ''),

View File

@ -118,6 +118,34 @@
return true; return true;
} }
function insertCommentURL(comment,id) {
reply = prompt(aStr['linkurl']);
if(reply && reply.length) {
reply = bin2hex(reply);
$('body').css('cursor', 'wait');
$.get('parse_url?binurl=' + reply, function(data) {
var tmpStr = $("#comment-edit-text-" + id).val();
if(tmpStr == comment) {
tmpStr = "";
$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
openMenu("comment-tools-" + id);
$("#comment-edit-text-" + id).val(tmpStr);
}
textarea = document.getElementById("comment-edit-text-" +id);
textarea.value = textarea.value + data;
$('body').css('cursor', 'auto');
});
}
return true;
}
function viewsrc(id) { function viewsrc(id) {
$.colorbox({href: 'viewsrc/' + id, maxWidth: '80%', maxHeight: '80%' }); $.colorbox({href: 'viewsrc/' + id, maxWidth: '80%', maxHeight: '80%' });
} }
@ -1230,6 +1258,13 @@ function chanviewFull() {
addeditortext(data); addeditortext(data);
} }
function loadText(textRegion,data) {
var currentText = $(textRegion).val();
$(textRegion).val(currentText + data);
}
function addeditortext(data) { function addeditortext(data) {
if(plaintext == 'none') { if(plaintext == 'none') {
var currentText = $("#profile-jot-text").val(); var currentText = $("#profile-jot-text").val();

View File

@ -43,7 +43,7 @@
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', {{$id}}); return false;"> <button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', {{$id}}); return false;">
<i class="icon-camera comment-icon"></i> <i class="icon-camera comment-icon"></i>
</button> </button>
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertbbcomment('{{$comment}}','url', {{$id}}); return false;"> <button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertCommentURL('{{$comment}}',{{$id}}); return false;">
<i class="icon-link comment-icon"></i> <i class="icon-link comment-icon"></i>
</button> </button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', {{$id}}); return false;"> <button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', {{$id}}); return false;">

View File

@ -46,7 +46,7 @@
<button id="wall-file-upload" class="btn btn-default btn-sm" title="{{$attach}}" > <button id="wall-file-upload" class="btn btn-default btn-sm" title="{{$attach}}" >
<i id="wall-file-upload-icon" class="icon-paper-clip jot-icons"></i> <i id="wall-file-upload-icon" class="icon-paper-clip jot-icons"></i>
</button> </button>
<button id="profile-link-wrapper" class="btn btn-default btn-sm" title="{{$weblink}}" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;"> <button id="profile-link-wrapper" class="btn btn-default btn-sm" title="{{$weblink}}" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink('#profile-jot-text'); return false;">
<i id="profile-link" class="icon-link jot-icons"></i> <i id="profile-link" class="icon-link jot-icons"></i>
</button> </button>
<button id="profile-video-wrapper" class="btn btn-default btn-sm" title="{{$video}}" onclick="jotVideoURL();return false;"> <button id="profile-video-wrapper" class="btn btn-default btn-sm" title="{{$video}}" onclick="jotVideoURL();return false;">

View File

@ -20,6 +20,7 @@
'rating_val' : "{{$rating_val}}", 'rating_val' : "{{$rating_val}}",
'rating_text' : "{{$rating_text}}", 'rating_text' : "{{$rating_text}}",
'submit' : "{{$submit}}", 'submit' : "{{$submit}}",
'linkurl' : "{{$linkurl}}",
't01' : "{{$t01}}", 't01' : "{{$t01}}",
't02' : "{{$t02}}", 't02' : "{{$t02}}",