display live update; don't collapse comments on live update
This commit is contained in:
parent
6effdd570c
commit
c9248b66db
|
@ -436,7 +436,11 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
else if($mode === 'display') {
|
||||
$profile_owner = $a->profile['uid'];
|
||||
$page_writeable = can_write_wall($a,$profile_owner);
|
||||
$live_update_div = '<div id="live-display"></div>' . "\r\n";
|
||||
if(!$update) {
|
||||
$live_update_div = '<div id="live-display"></div>' . "\r\n"
|
||||
. "<script> var profile_uid = " . $_SESSION['uid'] . ";"
|
||||
. " var profile_page = 1; </script>";
|
||||
}
|
||||
}
|
||||
else if($mode === 'community') {
|
||||
$profile_owner = 0;
|
||||
|
|
34
js/main.js
34
js/main.js
|
@ -250,12 +250,13 @@
|
|||
if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
|
||||
if($('#live-community').length) { src = 'community'; liveUpdate(); }
|
||||
if($('#live-notes').length) { src = 'notes'; liveUpdate(); }
|
||||
if($('#live-display').length) {
|
||||
if($('#live-display').length) { src = 'display'; liveUpdate(); }
|
||||
/* if($('#live-display').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
window.location.href=window.location.href
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if($('#live-photos').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
|
@ -313,10 +314,26 @@
|
|||
$('#' + prev).after($(this));
|
||||
}
|
||||
else {
|
||||
// Find out if the hidden comments are open, so we can keep it that way
|
||||
// if a new comment has been posted
|
||||
var id = $('.hide-comments-total', this).attr('id');
|
||||
if(typeof id != 'undefined') {
|
||||
id = id.split('-')[3];
|
||||
var commentsOpen = $("#collapsed-comments-" + id).is(":visible");
|
||||
}
|
||||
|
||||
$('img',this).each(function() {
|
||||
$(this).attr('src',$(this).attr('dst'));
|
||||
});
|
||||
//vScroll = $(document).scrollTop();
|
||||
$('html').height($('html').height());
|
||||
$('#' + ident).replaceWith($(this));
|
||||
|
||||
if(typeof id != 'undefined') {
|
||||
if(commentsOpen) showHideComments(id);
|
||||
}
|
||||
$('html').height('auto');
|
||||
//$(document).scrollTop(vScroll);
|
||||
}
|
||||
prev = ident;
|
||||
});
|
||||
|
@ -503,6 +520,19 @@
|
|||
|
||||
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $("#collapsed-comments-" + id).is(":visible")) {
|
||||
$("#collapsed-comments-" + id).hide();
|
||||
$("#hide-comments-" + id).html(window.showMore);
|
||||
}
|
||||
else {
|
||||
$("#collapsed-comments-" + id).show();
|
||||
$("#hide-comments-" + id).html(window.showFewer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function preview_post() {
|
||||
$("#jot-preview").val("1");
|
||||
$("#jot-preview-content").show();
|
||||
|
|
2
js/main.min.js
vendored
2
js/main.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
function display_content(&$a) {
|
||||
function display_content(&$a, $update = 0) {
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
|
@ -19,10 +19,20 @@ function display_content(&$a) {
|
|||
$a->page['htmlhead'] .= get_markup_template('display-head.tpl');
|
||||
|
||||
|
||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||
if($update) {
|
||||
$nick = $_REQUEST['nick'];
|
||||
}
|
||||
else {
|
||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||
}
|
||||
profile_load($a,$nick);
|
||||
|
||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||
if($update) {
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
}
|
||||
else {
|
||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||
}
|
||||
|
||||
if(! $item_id) {
|
||||
$a->error = 404;
|
||||
|
@ -97,6 +107,18 @@ function display_content(&$a) {
|
|||
|
||||
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
||||
|
||||
if($update) {
|
||||
$r = q("SELECT id FROM item WHERE item.uid = %d
|
||||
AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
|
||||
$sql_extra AND unseen = 1",
|
||||
intval($a->profile['uid']),
|
||||
dbesc($item_id),
|
||||
dbesc($item_id)
|
||||
);
|
||||
if(!$r)
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
|
@ -124,8 +146,10 @@ function display_content(&$a) {
|
|||
}
|
||||
|
||||
$items = conv_sort($r,"`commented`");
|
||||
|
||||
$o .= conversation($a,$items,'display', false);
|
||||
|
||||
if(!$update)
|
||||
$o .= "<script> var netargs = '?f=&nick=" . $nick . "&item_id=" . $item_id . "'; </script>";
|
||||
$o .= conversation($a,$items,'display', $update);
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -14,25 +14,25 @@ function update_network_content(&$a) {
|
|||
echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
|
||||
|
||||
|
||||
$text = network_content($a,$profile_uid);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$text = network_content($a,$profile_uid);
|
||||
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
|
||||
$replace = "<img\${1} dst=\"\${2}\"";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
||||
|
||||
echo str_replace("\t",' ',$text);
|
||||
echo str_replace("\t",' ',$text);
|
||||
echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
|
||||
echo "</body></html>\r\n";
|
||||
killme();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,7 +545,8 @@ class Item extends BaseObject {
|
|||
$comment_box = replace_macros($template,array(
|
||||
'$return_path' => '',
|
||||
'$threaded' => $this->is_threaded(),
|
||||
'$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
|
||||
// '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
|
||||
'$jsreload' => '',
|
||||
'$type' => (($conv->get_mode() === 'profile') ? 'wall-comment' : 'net-comment'),
|
||||
'$id' => $this->get_id(),
|
||||
'$parent' => $this->get_id(),
|
||||
|
|
|
@ -89,16 +89,8 @@
|
|||
$(obj).val('');
|
||||
}
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $('#collapsed-comments-' + id).is(':visible')) {
|
||||
$('#collapsed-comments-' + id).hide();
|
||||
$('#hide-comments-' + id).html('$showmore');
|
||||
}
|
||||
else {
|
||||
$('#collapsed-comments-' + id).show();
|
||||
$('#hide-comments-' + id).html('$showfewer');
|
||||
}
|
||||
}
|
||||
window.showMore = "$showmore";
|
||||
window.showFewer = "$showfewer";
|
||||
|
||||
function showHideCommentBox(id) {
|
||||
if( $('#comment-edit-form-' + id).is(':visible')) {
|
||||
|
|
|
@ -84,16 +84,8 @@
|
|||
$(obj).val('');
|
||||
}
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $('#collapsed-comments-' + id).is(':visible')) {
|
||||
$('#collapsed-comments-' + id).hide();
|
||||
$('#hide-comments-' + id).html('$showmore');
|
||||
}
|
||||
else {
|
||||
$('#collapsed-comments-' + id).show();
|
||||
$('#hide-comments-' + id).html('$showfewer');
|
||||
}
|
||||
}
|
||||
window.showMore = "$showmore";
|
||||
window.showFewer = "$showfewer";
|
||||
|
||||
function showHideCommentBox(id) {
|
||||
if( $('#comment-edit-form-' + id).is(':visible')) {
|
||||
|
|
|
@ -243,12 +243,13 @@
|
|||
if($j('#live-profile').length) { src = 'profile'; liveUpdate(); }
|
||||
if($j('#live-community').length) { src = 'community'; liveUpdate(); }
|
||||
if($j('#live-notes').length) { src = 'notes'; liveUpdate(); }
|
||||
if($j('#live-display').length) {
|
||||
if($j('#live-display').length) { src = 'display'; liveUpdate(); }
|
||||
/*if($j('#live-display').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
window.location.href=window.location.href
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if($j('#live-photos').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
|
@ -307,10 +308,26 @@
|
|||
$j('#' + prev).after($j(this));
|
||||
}
|
||||
else {
|
||||
// Find out if the hidden comments are open, so we can keep it that way
|
||||
// if a new comment has been posted
|
||||
var id = $j('.hide-comments-total', this).attr('id');
|
||||
if(typeof id != 'undefined') {
|
||||
id = id.split('-')[3];
|
||||
var commentsOpen = $j("#collapsed-comments-" + id).is(":visible");
|
||||
}
|
||||
|
||||
$j('img',this).each(function() {
|
||||
$j(this).attr('src',$j(this).attr('dst'));
|
||||
});
|
||||
//vScroll = $j(document).scrollTop();
|
||||
$j('html').height($j('html').height());
|
||||
$j('#' + ident).replaceWith($j(this));
|
||||
|
||||
if(typeof id != 'undefined') {
|
||||
if(commentsOpen) showHideComments(id);
|
||||
}
|
||||
$j('html').height('auto');
|
||||
//$j(document).scrollTop(vScroll);
|
||||
}
|
||||
prev = ident;
|
||||
});
|
||||
|
@ -517,6 +534,17 @@
|
|||
}
|
||||
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $j("#collapsed-comments-" + id).is(":visible")) {
|
||||
$j("#collapsed-comments-" + id).hide();
|
||||
$j("#hide-comments-" + id).html(window.showMore);
|
||||
}
|
||||
else {
|
||||
$j("#collapsed-comments-" + id).show();
|
||||
$j("#hide-comments-" + id).html(window.showFewer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function preview_post() {
|
||||
$j("#jot-preview").val("1");
|
||||
|
|
2
view/theme/frost-mobile/js/main.min.js
vendored
2
view/theme/frost-mobile/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -533,17 +533,6 @@ function qCommentInsert(obj,id) {
|
|||
$j(obj).val("");
|
||||
}
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $j("#collapsed-comments-" + id).is(":visible")) {
|
||||
$j("#collapsed-comments-" + id).hide();
|
||||
$j("#hide-comments-" + id).html(window.showMore);
|
||||
}
|
||||
else {
|
||||
$j("#collapsed-comments-" + id).show();
|
||||
$j("#hide-comments-" + id).html(window.showFewer);
|
||||
}
|
||||
}
|
||||
|
||||
/*function showHideCommentBox(id) {
|
||||
if( $j('#comment-edit-form-' + id).is(':visible')) {
|
||||
$j('#comment-edit-form-' + id).hide();
|
||||
|
|
2
view/theme/frost-mobile/js/theme.min.js
vendored
2
view/theme/frost-mobile/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -236,12 +236,13 @@
|
|||
if($j('#live-profile').length) { src = 'profile'; liveUpdate(); }
|
||||
if($j('#live-community').length) { src = 'community'; liveUpdate(); }
|
||||
if($j('#live-notes').length) { src = 'notes'; liveUpdate(); }
|
||||
if($j('#live-display').length) {
|
||||
if($j('#live-display').length) { src = 'display'; liveUpdate(); }
|
||||
/*if($j('#live-display').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
window.location.href=window.location.href
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if($j('#live-photos').length) {
|
||||
if(liking) {
|
||||
liking = 0;
|
||||
|
@ -300,10 +301,26 @@
|
|||
$j('#' + prev).after($j(this));
|
||||
}
|
||||
else {
|
||||
// Find out if the hidden comments are open, so we can keep it that way
|
||||
// if a new comment has been posted
|
||||
var id = $j('.hide-comments-total', this).attr('id');
|
||||
if(typeof id != 'undefined') {
|
||||
id = id.split('-')[3];
|
||||
var commentsOpen = $j("#collapsed-comments-" + id).is(":visible");
|
||||
}
|
||||
|
||||
$j('img',this).each(function() {
|
||||
$j(this).attr('src',$j(this).attr('dst'));
|
||||
});
|
||||
//vScroll = $j(document).scrollTop();
|
||||
$j('html').height($j('html').height());
|
||||
$j('#' + ident).replaceWith($j(this));
|
||||
|
||||
if(typeof id != 'undefined') {
|
||||
if(commentsOpen) showHideComments(id);
|
||||
}
|
||||
$j('html').height('auto');
|
||||
//$j(document).scrollTop(vScroll);
|
||||
}
|
||||
prev = ident;
|
||||
});
|
||||
|
@ -510,6 +527,17 @@
|
|||
}
|
||||
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $j("#collapsed-comments-" + id).is(":visible")) {
|
||||
$j("#collapsed-comments-" + id).hide();
|
||||
$j("#hide-comments-" + id).html(window.showMore);
|
||||
}
|
||||
else {
|
||||
$j("#collapsed-comments-" + id).show();
|
||||
$j("#hide-comments-" + id).html(window.showFewer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function preview_post() {
|
||||
$j("#jot-preview").val("1");
|
||||
|
|
2
view/theme/frost/js/main.min.js
vendored
2
view/theme/frost/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -584,17 +584,6 @@ function qCommentInsert(obj,id) {
|
|||
$j(obj).val("");
|
||||
}
|
||||
|
||||
function showHideComments(id) {
|
||||
if( $j("#collapsed-comments-" + id).is(":visible")) {
|
||||
$j("#collapsed-comments-" + id).hide();
|
||||
$j("#hide-comments-" + id).html(window.showMore);
|
||||
}
|
||||
else {
|
||||
$j("#collapsed-comments-" + id).show();
|
||||
$j("#hide-comments-" + id).html(window.showFewer);
|
||||
}
|
||||
}
|
||||
|
||||
/*function showHideCommentBox(id) {
|
||||
if( $j('#comment-edit-form-' + id).is(':visible')) {
|
||||
$j('#comment-edit-form-' + id).hide();
|
||||
|
|
2
view/theme/frost/js/theme.min.js
vendored
2
view/theme/frost/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue