aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorAndrew Manning <andrewmanning@grid.reticu.li>2017-08-27 23:47:14 +0000
committerAndrew Manning <andrewmanning@grid.reticu.li>2017-08-27 23:47:14 +0000
commitacacea5efe76cb56f610ae30c5396e7b63be1e40 (patch)
treecd80b3f52e5a3e54c082c1ef1c3e1fff98341bd9 /view
parent49b38bd71b27427cad1c390d81bda3b7d38d8393 (diff)
parent187f19b1704b8a877b53a3e66c67ec26383a3ee9 (diff)
downloadvolse-hubzilla-acacea5efe76cb56f610ae30c5396e7b63be1e40.tar.gz
volse-hubzilla-acacea5efe76cb56f610ae30c5396e7b63be1e40.tar.bz2
volse-hubzilla-acacea5efe76cb56f610ae30c5396e7b63be1e40.zip
Merge remote-tracking branch 'upstream/dev' into doco
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js165
-rwxr-xr-xview/tpl/jot.tpl2
2 files changed, 57 insertions, 110 deletions
diff --git a/view/js/main.js b/view/js/main.js
index fd3c8b08f..47815d2c6 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -533,133 +533,77 @@ function updatePageItems(mode, data) {
function updateConvItems(mode,data) {
- if(mode === 'update') {
+ if(mode === 'update' || mode === 'replace') {
prev = 'threads-begin';
-
- $('.thread-wrapper.toplevel_item',data).each(function() {
-
- var ident = $(this).attr('id');
- // This should probably use the context argument instead
- var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
- var itmId = 0;
- var isVisible = false;
-
- if(typeof commentWrap !== 'undefined')
- itmId = commentWrap.replace('collapsed-comments-','');
-
- if($('#' + ident).length == 0 && profile_page == 1) {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
- $('#' + prev).after($(this));
- if(isVisible)
- showHideComments(itmId);
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
- }
- else {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
- $('#' + ident).replaceWith($(this));
- if(isVisible)
- showHideComments(itmId);
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
- }
- prev = ident;
- });
}
if(mode === 'append') {
-
next = 'threads-end';
+ }
+
+ if(mode === 'replace') {
+ $('.thread-wrapper').remove(); // clear existing content
+ }
- $('.thread-wrapper.toplevel_item',data).each(function() {
- var ident = $(this).attr('id');
- var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
- var itmId = 0;
- var isVisible = false;
+ $('.thread-wrapper.toplevel_item',data).each(function() {
- if(typeof commentWrap !== 'undefined')
- itmId = commentWrap.replace('collapsed-comments-', '');
+ var ident = $(this).attr('id');
- if($('#' + ident).length == 0) {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
- $('#threads-end').before($(this));
- if(isVisible)
- showHideComments(itmId);
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
- }
- else {
- $('img',this).each(function() {
- $(this).attr('src', $(this).attr('dst'));
- });
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
- $('#' + ident).replaceWith($(this));
- if(isVisible)
- showHideComments(itmId);
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
- }
- });
+ var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
+ var itmId = 0;
+ var isVisible = false;
- if(loadingPage) {
- loadingPage = false;
- }
- }
- if(mode === 'replace') {
- // clear existing content
- $('.thread-wrapper').remove();
+ // figure out the comment state
+ if(typeof commentWrap !== 'undefined')
+ itmId = commentWrap.replace('collapsed-comments-','');
+
+ if($('#collapsed-comments-'+itmId).is(':visible'))
+ isVisible = true;
- prev = 'threads-begin';
+ // insert the content according to the mode and first_page
+ // and whether or not the content exists already (overwrite it)
- $('.thread-wrapper.toplevel_item',data).each(function() {
+ if($('#' + ident).length == 0) {
+ if((mode === 'update' || mode === 'replace') && profile_page == 1) {
+ $('#' + prev).after($(this));
+ prev = ident;
+ }
+ if(mode === 'append') {
+ $('#' + next).before($(this));
+ }
+ }
+ else {
+ $('#' + ident).replaceWith($(this));
+ }
- var ident = $(this).attr('id');
- var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
- var itmId = 0;
- var isVisible = false;
+ // set the comment state to the state we discovered earlier
- if(typeof commentWrap !== 'undefined')
- itmId = commentWrap.replace('collapsed-comments-','');
+ if(isVisible)
+ showHideComments(itmId);
- if($('#' + ident).length == 0 && profile_page == 1) {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
- $('#' + prev).after($(this));
- if(isVisible)
- showHideComments(itmId);
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
- }
- prev = ident;
- });
+ // trigger the autotime function on all newly created content
- if(loadingPage) {
+ $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
+
+ if((mode === 'append' || mode === 'replace') && (loadingPage)) {
loadingPage = false;
}
- if (window.location.search.indexOf("mid=") != -1 || window.location.pathname.indexOf("display") != -1) {
- var title = $(".wall-item-title").text();
- title.replace(/^\s+/, '');
- title.replace(/\s+$/, '');
- if (title)
- document.title = title + " - " + document.title;
+ // if single thread view and the item has a title, display it in the title bar
+
+ if(mode === 'replace') {
+ if (window.location.search.indexOf("mid=") != -1 || window.location.pathname.indexOf("display") != -1) {
+ var title = $(".wall-item-title").text();
+ title.replace(/^\s+/, '');
+ title.replace(/\s+$/, '');
+ if (title) {
+ savedTitle = title + " " + savedTitle;
+ }
+ }
}
- }
+ });
+
+ // reset rotators and cursors we may have set before reaching this place
$('.like-rotator').spin(false);
@@ -668,6 +612,9 @@ function updateConvItems(mode,data) {
$('body').css('cursor', 'auto');
}
+ // Setup to determine if the media player is playing. This affects
+ // some content loading decisions.
+
$('video').off('playing');
$('video').off('pause');
$('audio').off('playing');
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 39ba9e59b..ce17f2f24 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -41,7 +41,7 @@
</div>
{{/if}}
<div id="jot-text-wrap">
- <textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex="2" placeholder="{{$share}}" >{{$content}}</textarea>
+ <textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex="2" placeholder="{{$placeholdtext}}" >{{$content}}</textarea>
</div>
{{if $attachment}}
<div id="jot-attachment-wrap">