mirror of
https://github.com/friendica/friendica
synced 2024-12-23 08:40:16 +00:00
comment preview
This commit is contained in:
parent
53878625f6
commit
b99cb511ca
5 changed files with 31 additions and 3 deletions
|
@ -129,7 +129,7 @@ function localize_item(&$item){
|
||||||
* that are based on unique features of the calling module.
|
* that are based on unique features of the calling module.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function conversation(&$a, $items, $mode, $update) {
|
function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||||
|
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$like' => '',
|
'$like' => '',
|
||||||
'$dislike' => '',
|
'$dislike' => '',
|
||||||
'$comment' => '',
|
'$comment' => '',
|
||||||
'$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')),
|
'$conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
|
||||||
'$wait' => t('Please wait'),
|
'$wait' => t('Please wait'),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -483,6 +483,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$myphoto' => $a->contact['thumb'],
|
'$myphoto' => $a->contact['thumb'],
|
||||||
'$comment' => t('Comment'),
|
'$comment' => t('Comment'),
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
|
'$preview' => t('Preview'),
|
||||||
'$ww' => (($mode === 'network') ? $commentww : '')
|
'$ww' => (($mode === 'network') ? $commentww : '')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
23
js/main.js
23
js/main.js
|
@ -389,6 +389,7 @@
|
||||||
unpause();
|
unpause();
|
||||||
commentBusy = true;
|
commentBusy = true;
|
||||||
$('body').css('cursor', 'wait');
|
$('body').css('cursor', 'wait');
|
||||||
|
$("#comment-preview-inp-" + id).val("0");
|
||||||
$.post(
|
$.post(
|
||||||
"item",
|
"item",
|
||||||
$("#comment-edit-form-" + id).serialize(),
|
$("#comment-edit-form-" + id).serialize(),
|
||||||
|
@ -411,6 +412,28 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function preview_comment(id) {
|
||||||
|
$("#comment-preview-inp-" + id).val("1");
|
||||||
|
$("#comment-edit-preview-" + id).show();
|
||||||
|
$.post(
|
||||||
|
"item",
|
||||||
|
$("#comment-edit-form-" + id).serialize(),
|
||||||
|
function(data) {
|
||||||
|
if(data.preview) {
|
||||||
|
|
||||||
|
$("#comment-edit-preview-" + id).html(data.preview);
|
||||||
|
$("#comment-edit-preview-" + id + " a").removeAttr('href');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function unpause() {
|
function unpause() {
|
||||||
// unpause auto reloads if they are currently stopped
|
// unpause auto reloads if they are currently stopped
|
||||||
totStopped = false;
|
totStopped = false;
|
||||||
|
|
|
@ -588,7 +588,7 @@ function item_post(&$a) {
|
||||||
if($preview) {
|
if($preview) {
|
||||||
$b = prepare_body($datarray,true);
|
$b = prepare_body($datarray,true);
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
$o = conversation(&$a,array(array_merge($datarray,$contact_record)),'search',false);
|
$o = conversation(&$a,array(array_merge($contact_record,$datarray)),'search',false,true);
|
||||||
$json = array('preview' => $o);
|
$json = array('preview' => $o);
|
||||||
echo json_encode($json);
|
echo json_encode($json);
|
||||||
killme();
|
killme();
|
||||||
|
|
|
@ -1203,6 +1203,7 @@ function photos_content(&$a) {
|
||||||
'$myphoto' => $contact['thumb'],
|
'$myphoto' => $contact['thumb'],
|
||||||
'$comment' => t('Comment'),
|
'$comment' => t('Comment'),
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
|
'$preview' => t('Preview'),
|
||||||
'$ww' => ''
|
'$ww' => ''
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<input type="hidden" name="parent" value="$parent" />
|
<input type="hidden" name="parent" value="$parent" />
|
||||||
<input type="hidden" name="return" value="$return_path" />
|
<input type="hidden" name="return" value="$return_path" />
|
||||||
<input type="hidden" name="jsreload" value="$jsreload" />
|
<input type="hidden" name="jsreload" value="$jsreload" />
|
||||||
|
<input type="hidden" name="preview" id="comment-preview-inp-$id" value="0" />
|
||||||
|
|
||||||
<div class="comment-edit-photo" id="comment-edit-photo-$id" >
|
<div class="comment-edit-photo" id="comment-edit-photo-$id" >
|
||||||
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>
|
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>
|
||||||
|
@ -15,6 +16,8 @@
|
||||||
<div class="comment-edit-text-end"></div>
|
<div class="comment-edit-text-end"></div>
|
||||||
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
|
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
|
||||||
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" />
|
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" />
|
||||||
|
<span onclick="preview_comment($id);" id="comment-edit-preview-link-$id" class="fakelink">$preview</span>
|
||||||
|
<div id="comment-edit-preview-$id" style="display:none;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="comment-edit-end"></div>
|
<div class="comment-edit-end"></div>
|
||||||
|
|
Loading…
Reference in a new issue