aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-rw-r--r--view/js/acl.js8
-rw-r--r--view/js/main.js198
-rwxr-xr-xview/tpl/build_query.tpl5
-rwxr-xr-xview/tpl/conv_item.tpl2
-rwxr-xr-xview/tpl/head.tpl2
-rw-r--r--view/tpl/item_filer.tpl2
-rwxr-xr-xview/tpl/jot-header.tpl42
-rwxr-xr-xview/tpl/settings_display.tpl1
8 files changed, 114 insertions, 146 deletions
diff --git a/view/js/acl.js b/view/js/acl.js
index 4597184ea..940fdaa44 100644
--- a/view/js/acl.js
+++ b/view/js/acl.js
@@ -340,7 +340,13 @@ ACL.prototype.update_view = function(value) {
that.list.hide(); //hide acl-list
that.info.hide(); //show acl-info
that.selected_id = that.contact_ids[that.allow_cid[0]];
- that.update_select('\\^' + that.selected_id);
+
+ if(that.acl_select.find('option[id="\\^' + that.selected_id + '"]').length === 0) {
+ that.update_view('custom');
+ }
+ else {
+ that.update_select('\\^' + that.selected_id);
+ }
/* jot acl */
$('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock');
diff --git a/view/js/main.js b/view/js/main.js
index 560868046..ca82e3101 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -20,11 +20,11 @@ var pageHasMoreContent = true;
var divmore_height = 400;
var last_filestorage_id = null;
var mediaPlaying = false;
-var contentHeightDiff = 0;
var liveRecurse = 0;
var savedTitle = '';
var followUpPageLoad = false;
var window_needs_alert = true;
+var expanded_items = [];
var sse_bs_active = false;
var sse_offset = 0;
@@ -69,6 +69,13 @@ $(document).ready(function() {
this.autocomplete_handled = true;
}
+
+ });
+
+ $(document).on('keydown', '.comment-edit-form textarea.expanded', function (e) {
+ if (e.ctrlKey && e.keyCode === 13) {
+ post_comment(this.id.replace('comment-edit-text-',''));
+ }
});
var tf = new Function('n', 's', 'var k = s.split("/")['+aStr['plural_func']+']; return (k ? k : s);');
@@ -95,7 +102,6 @@ $(document).ready(function() {
jQuery.timeago.settings.allowFuture = true;
-
if(sse_enabled) {
if(typeof(window.SharedWorker) === 'undefined') {
// notifications with multiple tabs open will not work very well in this scenario
@@ -208,33 +214,6 @@ $(document).ready(function() {
updateInit();
- // Allow folks to stop the ajax page updates with the pause/break key
- $(document).keydown(function(event) {
- if(event.keyCode == '8') {
- var target = event.target || event.srcElement;
- if (!/input|textarea/i.test(target.nodeName)) {
- return false;
- }
- }
-
- if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) {
- event.preventDefault();
- if(stopped === false) {
- stopped = true;
- if (event.ctrlKey) {
- totStopped = true;
- }
- $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
- } else {
- unpause();
- }
- } else {
- if (!totStopped) {
- unpause();
- }
- }
- });
-
var e = document.getElementById('content-complete');
if(e)
pageHasMoreContent = false;
@@ -244,8 +223,6 @@ $(document).ready(function() {
cache_next_page();
});
-
-
});
function getConversationSettings() {
@@ -310,6 +287,7 @@ function handle_comment_form(e) {
// handle clicked form
var form = $(this);
+
var fields = form.find(':input[type=text], textarea');
var fields_empty = true;
@@ -324,8 +302,9 @@ function handle_comment_form(e) {
form.find(':not(:visible)').show();
}
+
// handle click outside of form (close empty forms)
- $(document).on('click', function(e) {
+ $(document).one('click', function(e) {
fields.each(function() {
if($(this).val() != '')
fields_empty = false;
@@ -344,18 +323,19 @@ function handle_comment_form(e) {
form.find(':button[type=submit]').prop('title', '');
}
});
-
+
var commentSaveTimer = null;
var emptyCommentElm = form.find('.comment-edit-text').attr('id');
var convId = emptyCommentElm.replace('comment-edit-text-','');
- $(document).on('focusout','#' + emptyCommentElm,function(e){
+ $('#' + emptyCommentElm).on('focusout',function(e){
if(commentSaveTimer)
clearTimeout(commentSaveTimer);
commentSaveChanges(convId,true);
commentSaveTimer = null;
+ $('#' + emptyCommentElm).off();
});
- $(document).on('focusin','#' + emptyCommentElm,function(e){
+ $('#' + emptyCommentElm).on('focusin', function (e){
commentSaveTimer = setTimeout(function () {
commentSaveChanges(convId,false);
},10000);
@@ -379,11 +359,13 @@ function handle_comment_form(e) {
}
}
}
+
}
+
+
function commentClose(obj, id) {
if(obj.value === '') {
- obj.value = aStr.comment;
$("#comment-edit-text-" + id).removeClass("expanded");
$("#mod-cmnt-wrap-" + id).hide();
$("#comment-tools-" + id).hide();
@@ -638,7 +620,10 @@ function updatePageItems(mode, data) {
function updateConvItems(mode,data) {
- $(document).trigger('hz:updateConvItems');
+ var scroll_position = $(window).scrollTop();
+
+ if(mode !== 'update')
+ $(document).trigger('hz:updateConvItems');
if(mode === 'update' || mode === 'replace') {
prev = 'threads-begin';
@@ -648,12 +633,11 @@ function updateConvItems(mode,data) {
}
if(mode === 'replace') {
- $('.thread-wrapper').remove(); // clear existing content
+ $('.thread-parent').remove(); // clear existing content
}
$('.thread-wrapper', data).each(function() {
if(this.classList.contains('toplevel_item')) {
-
var ident = this.id;
var convId = ident.replace('thread-wrapper-','');
var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
@@ -768,6 +752,8 @@ function updateConvItems(mode,data) {
});
+ $(window).scrollTop(scroll_position);
+
if(followUpPageLoad)
sse_bs_counts();
else
@@ -863,25 +849,16 @@ function scrollToItem() {
}
function collapseHeight() {
- var origContentHeight = Math.ceil($("#region_2").height());
- var cDiff = 0;
- var i = 0;
- var position = $(window).scrollTop();
$(".wall-item-content, .directory-collapse").each(function() {
var orgHeight = $(this).outerHeight(true);
+ var id = $(this).attr('id')
+ var open = ((expanded_items.indexOf($(this).attr('id')) === -1) ? false : true);
if(orgHeight > divmore_height) {
if(! $(this).hasClass('divmore') && $(this).has('div.no-collapse').length == 0) {
-
- // check if we will collapse some content above the visible content and compensate the diff later
- if($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i) < 65) {
- diff = orgHeight - divmore_height;
- cDiff = cDiff + diff;
- i++;
- }
-
$(this).readmore({
speed: 0,
+ startOpen: open,
heightMargin: 50,
collapsedHeight: divmore_height,
moreLink: '<a href="#" class="divgrow-showmore fakelink">' + aStr.divgrowmore + '</a>',
@@ -891,6 +868,10 @@ function collapseHeight() {
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
$(window).scrollTop($(window).scrollTop() - ($(element).outerHeight(true) - divmore_height));
}
+ expanded_items = expanded_items.filter(expanded_items => expanded_items !== id);
+ }
+ else {
+ expanded_items.push(id);
}
}
});
@@ -899,15 +880,6 @@ function collapseHeight() {
}
});
- var collapsedContentHeight = Math.ceil($("#region_2").height());
- contentHeightDiff = liking ? 0 : origContentHeight - collapsedContentHeight;
- console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
-
- if(i && !liking){
- var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i);
- console.log('collapsed above viewport count: ' + i);
- $(window).scrollTop(sval);
- }
}
function updateInit() {
@@ -942,12 +914,7 @@ function liveUpdate(notify_id) {
if((src === null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
- // if auto updates are enabled and a comment box is open,
- // prevent live updates until the comment is submitted
-
- var lockUpdates = (($('.comment-edit-text.expanded').length && (! bParam_static)) ? true : false);
-
- if(lockUpdates || in_progress || mediaPlaying) {
+ if(in_progress || mediaPlaying) {
if(livetime) {
clearTimeout(livetime);
}
@@ -1049,11 +1016,6 @@ function liveUpdate(notify_id) {
scroll_next = false;
updateConvItems(update_mode,data);
- // adjust scroll position if new content was added above viewport
- if(update_mode === 'update' && !justifiedGalleryActive) {
- $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
- }
-
in_progress = false;
$('#image_counter').html('');
@@ -1184,19 +1146,30 @@ function justifyPhotosAjax(id) {
$('#' + id).justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; });
}
-// Since our ajax calls are asynchronous, we will give a few
-// seconds for the first ajax call (setting like/dislike), then
-// run the updater to pick up any changes and display on the page.
-// The updater will turn any rotators off when it's done.
-// This function will have returned long before any of these
-// events have completed and therefore there won't be any
-// visible feedback that anything changed without all this
-// trickery. This still could cause confusion if the "like" ajax call
-// is delayed and updateInit runs before it completes.
function dolike(ident, verb) {
- unpause();
$('#like-rotator-' + ident.toString()).show();
- $.get('like/' + ident.toString() + '?verb=' + verb, updateInit );
+
+ if(typeof conv_mode == typeof undefined)
+ conv_mode = '';
+
+ $.get('like/' + ident.toString() + '?verb=' + verb + '&conv_mode=' + conv_mode, function (data) {
+ if(data.success) {
+ // this is a bit tricky since the top level thread wrapper wraps the whole thread
+ if($('#thread-wrapper-' + data.orig_id).hasClass('toplevel_item')) {
+ var wrapper = $('<div></div>').html( data.html ).find('#wall-item-outside-wrapper-' + data.id);
+ $('#wall-item-outside-wrapper-' + data.orig_id).html(wrapper[0].innerHTML);
+ // those were not replaced - swap the id
+ $('#thread-wrapper-' + data.orig_id).attr('id', 'thread-wrapper-' + data.id);
+ $('#wall-item-outside-wrapper-' + data.orig_id).attr('id', 'wall-item-outside-wrapper-' + data.id);
+ }
+ else {
+ $('#thread-wrapper-' + data.orig_id).replaceWith(data.html);
+ }
+ $('#wall-item-ago-' + data.id + ' .autotime').timeago();
+ collapseHeight();
+ liking = 0;
+ }
+ });
liking = 1;
}
@@ -1301,14 +1274,12 @@ function dropItem(url, object) {
}
function dosubthread(ident) {
- unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('subthread/sub/' + ident.toString(), updateInit );
liking = 1;
}
function dounsubthread(ident) {
- unpause();
$('#like-rotator-' + ident.toString()).show();
$.get('subthread/unsub/' + ident.toString(), updateInit );
liking = 1;
@@ -1387,44 +1358,53 @@ function submitPoll(id) {
function(data) {
$.jGrowl(data.message, { sticky: false, theme: ((data.success) ? 'info' : 'notice'), life: 10000 });
if(timer) clearTimeout(timer);
- timer = setTimeout(updateInit,1500);
+ timer = setTimeout(updateInit, 500);
}
);
}
-
function post_comment(id) {
- unpause();
+
commentBusy = true;
$('body').css('cursor', 'wait');
$("#comment-preview-inp-" + id).val("0");
+
+ if(typeof conv_mode == typeof undefined)
+ conv_mode = '';
+
+ var form_data = $("#comment-edit-form-" + id).serialize();
+
$.post(
"item",
- $("#comment-edit-form-" + id).serialize(),
+ form_data + '&conv_mode=' + conv_mode,
function(data) {
if(data.success) {
localStorage.removeItem("comment_body-" + id);
$("#comment-edit-preview-" + id).hide();
- $("#comment-edit-wrapper-" + id).hide();
- $("#comment-edit-text-" + id).val('');
+ $("#comment-edit-text-" + id).val('').blur().attr('placeholder', aStr.comment);
+ $('#wall-item-comment-wrapper-' + id).before(data.html);
+ $('#wall-item-ago-' + data.id + ' .autotime').timeago();
+ $('body').css('cursor', 'unset');
+ collapseHeight();
+ commentBusy = false;
+
var tarea = document.getElementById("comment-edit-text-" + id);
if(tarea) {
commentClose(tarea, id);
- $(document).unbind( "click.commentOpen");
+ $(document).off( "click.commentOpen");
}
- if(timer) clearTimeout(timer);
- timer = setTimeout(updateInit,1500);
- }
- if(data.reload) {
- window.location.href=data.reload;
}
},
"json"
);
+
return false;
+
}
+
+
function preview_comment(id) {
$("#comment-preview-inp-" + id).val("1");
$("#comment-edit-preview-" + id).show();
@@ -1492,13 +1472,6 @@ function preview_mail() {
return true;
}
-function unpause() {
- // unpause auto reloads if they are currently stopped
- totStopped = false;
- stopped = false;
- $('#pause').html('');
-}
-
function bin2hex(s) {
// Converts the binary representation of data to hex
//
@@ -1595,7 +1568,6 @@ function zFormError(elm,x) {
}
}
-
$(window).scroll(function () {
if(typeof buildCmd == 'function') {
// This is a content page with items and/or conversations
@@ -1621,22 +1593,6 @@ $(window).scroll(function () {
}
});
-var chanviewFullSize = false;
-
-function chanviewFull() {
- if(chanviewFullSize) {
- chanviewFullSize = false;
- $('#chanview-iframe-border').css({ 'position' : 'relative', 'z-index' : '10' });
- $('#remote-channel').css({ 'position' : 'relative' , 'z-index' : '10' });
- }
- else {
- chanviewFullSize = true;
- $('#chanview-iframe-border').css({ 'position' : 'fixed', 'top' : '0', 'left' : '0', 'z-index' : '150001' });
- $('#remote-channel').css({ 'position' : 'fixed', 'top' : '0', 'left' : '0', 'z-index' : '150000' });
- resize_iframe();
- }
-}
-
function addhtmltext(data) {
data = h2b(data);
addeditortext(data);
@@ -1867,8 +1823,6 @@ function sse_bs_notifications(e, replace, followup) {
}
}
-
-
function sse_handleNotifications(obj, replace, followup) {
var primary_notifications = ['dm', 'home', 'intros', 'register', 'mail', 'notify', 'files'];
diff --git a/view/tpl/build_query.tpl b/view/tpl/build_query.tpl
index bbe0ac7ee..83e756367 100755
--- a/view/tpl/build_query.tpl
+++ b/view/tpl/build_query.tpl
@@ -2,6 +2,9 @@
var bParam_cmd = "{{$baseurl}}/update/{{$pgtype}}";
+ {{if $conv_mode}}
+ var conv_mode = '{{$conv_mode}}';
+ {{/if}}
var bParam_uid = {{$uid}};
var bParam_gid = {{$gid}};
@@ -18,7 +21,6 @@
var bParam_list = {{$list}};
var bParam_fh = {{$fh}};
var bParam_dm = {{$dm}};
- var bParam_static = {{$static}};
var bParam_search = "{{$search}}";
var bParam_xchan = "{{$xchan}}";
@@ -42,7 +44,6 @@
if(bParam_cmax != (-1)) bCmd = bCmd + "&cmax=" + bParam_cmax;
if(bParam_gid != 0) { bCmd = bCmd + "&gid=" + bParam_gid; } else
if(bParam_cid != 0) { bCmd = bCmd + "&cid=" + bParam_cid; }
- if(bParam_static != 0) { bCmd = bCmd + "&static=" + bParam_static; }
if(bParam_star != 0) bCmd = bCmd + "&star=" + bParam_star;
if(bParam_liked != 0) bCmd = bCmd + "&liked=" + bParam_liked;
if(bParam_conv!= 0) bCmd = bCmd + "&conv=" + bParam_conv;
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index d7eaefe7e..78601c40d 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -259,7 +259,7 @@
{{/foreach}}
{{/if}}
{{if $item.comment}}
- <div class="p-2 wall-item-comment-wrapper{{if $item.children}} wall-item-comment-wrapper-wc{{/if}}" >
+ <div id="wall-item-comment-wrapper-{{$item.id}}" class="p-2 wall-item-comment-wrapper{{if $item.children}} wall-item-comment-wrapper-wc{{/if}}" >
{{$item.comment}}
</div>
{{/if}}
diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl
index 0d212e029..ecb30afd3 100755
--- a/view/tpl/head.tpl
+++ b/view/tpl/head.tpl
@@ -14,7 +14,7 @@
var zid = {{if $zid}}'{{$zid}}'{{else}}null{{/if}};
var justifiedGalleryActive = false;
{{if $channel_hash}}var channelHash = '{{$channel_hash}}';{{/if}}
- {{if $channel_id}}var channelId = '{{$channel_id}}';{{/if}}{{* Used in e.g. autocomplete *}}
+ var channelId = {{if $channel_id}}{{$channel_id}}{{else}}false{{/if}};{{* Used in e.g. autocomplete *}}
var preloadImages = {{$preload_images}};
var auto_save_draft = {{$auto_save_draft}};
</script>
diff --git a/view/tpl/item_filer.tpl b/view/tpl/item_filer.tpl
index 4eb621f93..f814b374c 100644
--- a/view/tpl/item_filer.tpl
+++ b/view/tpl/item_filer.tpl
@@ -1,7 +1,7 @@
{{if $categories}}
<!--div class="filesavetags"-->
{{foreach $categories as $cat}}
-<span class="item-category badge badge-pill badge-danger"><i class="fa fa-folder-o"></i>&nbsp;{{$cat.term}}&nbsp;<a href="{{$cat.removelink}}" class="text-white" title="{{$remove}}"><i class="fa fa-close"></i></a></span>
+<span class="item-category badge badge-pill badge-danger"><i class="fa fa-folder-o"></i>&nbsp;{{$cat.term}}&nbsp;<a href="{{$cat.removelink}}" class="text-white" title="{{$remove}}" onClick="itemFilerRm({{$cat.id}}, '{{$cat.term}}'); return false;"><i class="fa fa-close"></i></a></span>
{{/foreach}}
<!--/div-->
{{/if}}
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index d519fd666..2539c1fdf 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -61,13 +61,11 @@ var activeCommentText = '';
$('#jot-add-option').on('click', jotAddOption);
$(document).on('click', '.poll-option-close', jotRemoveOption);
- function jotSetMime() {
- var mtype = $('#id_mimetype').val();
- if(mtype == 'text/bbcode')
- $('#profile-jot-submit-left').show();
- else
- $('#profile-jot-submit-left').hide();
- }
+ $('#profile-jot-form').keydown(function(e) {
+ if (e.ctrlKey && e.keyCode === 13) {
+ $(this).trigger('submit');
+ }
+ });
$('#invisible-wall-file-upload').fileupload({
url: 'wall_attach/{{$nickname}}',
@@ -91,11 +89,10 @@ var activeCommentText = '';
$('#wall-file-upload').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
$('#wall-file-upload-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
- // call initialization file
- if (window.File && window.FileList && window.FileReader) {
- DragDropUploadInit();
- }
-
+ // call initialization file
+ if (window.File && window.FileList && window.FileReader) {
+ DragDropUploadInit();
+ }
$('#invisible-comment-upload').fileupload({
url: 'wall_attach/{{$nickname}}',
@@ -128,6 +125,14 @@ var activeCommentText = '';
});
+ function jotSetMime() {
+ var mtype = $('#id_mimetype').val();
+ if(mtype == 'text/bbcode')
+ $('#profile-jot-submit-left').show();
+ else
+ $('#profile-jot-submit-left').hide();
+ }
+
function deleteCheckedItems() {
var checkedstr = '';
@@ -298,13 +303,9 @@ var activeCommentText = '';
if(reply && reply.length) {
reply = reply.replace('#','');
if(reply.length) {
-
commentBusy = true;
$('body').css('cursor', 'wait');
-
- $.get('{{$baseurl}}/tagger/' + id + '?term=' + reply);
- if(timer) clearTimeout(timer);
- timer = setTimeout(updateInit,3000);
+ $.get('{{$baseurl}}/tagger/' + id + '?term=' + reply, updateInit);
liking = 1;
}
}
@@ -353,6 +354,13 @@ var activeCommentText = '';
}
+ function itemFilerRm(id, term) {
+ commentBusy = true;
+ $('body').css('cursor', 'wait');
+ $.get('{{$baseurl}}/filerm/' + id + '?f=&term=' + term, updateInit);
+ liking = 1;
+ }
+
function itemBookmark(id) {
$.get('{{$baseurl}}/bookmarks?f=&item=' + id);
if(timer) clearTimeout(timer);
diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl
index c93efb4aa..c2dd94175 100755
--- a/view/tpl/settings_display.tpl
+++ b/view/tpl/settings_display.tpl
@@ -63,7 +63,6 @@
{{include file="field_checkbox.tpl" field=$title_tosource}}
{{include file="field_checkbox.tpl" field=$user_scalable}}
{{include file="field_checkbox.tpl" field=$preload_images}}
- {{include file="field_checkbox.tpl" field=$manual_update}}
{{include file="field_checkbox.tpl" field=$start_menu}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>