aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js88
1 files changed, 59 insertions, 29 deletions
diff --git a/view/js/main.js b/view/js/main.js
index b5b77d473..a851e7e63 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -113,7 +113,7 @@
}
function viewsrc(id) {
- $.colorbox({href: 'viewsrc/' + id });
+ $.colorbox({href: 'viewsrc/' + id, maxWidth: '80%', maxHeight: '80%' });
}
function qCommentInsert(obj,id) {
@@ -180,6 +180,13 @@
timer = setTimeout(NavUpdate,2000);
}
+ function markItemRead(itemId) {
+ $.get('ping?f=&markItemRead='+itemId);
+ $('.unseen-wall-indicator-'+itemId).hide();
+ }
+
+
+
var src = null;
var prev = null;
var livetime = null;
@@ -200,6 +207,7 @@
var loadingPage = true;
var pageHasMoreContent = true;
var updateCountsOnly = false;
+ var divmore_height = 400;
$(function() {
$.ajaxSetup({cache: false});
@@ -285,7 +293,7 @@
scroll_next = true;
loadingPage = true;
- if($('.directory-end').length == 0)
+ if(($('.directory-end').length == 0) && ($('.photos-end').length == 0))
liveUpdate();
else
pageUpdate();
@@ -335,7 +343,7 @@
if($('#live-network').length) { src = 'network'; liveUpdate(); }
if($('#live-channel').length) { src = 'channel'; liveUpdate(); }
- if($('#live-community').length) { src = 'community'; liveUpdate(); }
+ if($('#live-home').length) { src = 'home'; liveUpdate(); }
if($('#live-display').length) { src = 'display'; liveUpdate(); }
if($('#live-search').length) { src = 'search'; liveUpdate(); }
@@ -429,6 +437,8 @@ function updatePageItems(mode,data) {
pageHasMoreContent = false;
}
+ collapseHeight();
+
}
@@ -458,25 +468,17 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$(".autotime").timeago();
- // divgrow doesn't prevent itself from attaching a second (or 500th)
- // "show more" div to a content region - it also has a few other
- // issues related to how we're trying to use it.
- // disable for now.
- // $("div.wall-item-body").divgrow({ initialHeight: 400 });
}
else {
$('img',this).each(function() {
$(this).attr('src',$(this).attr('dst'));
});
- // more FIXME related to expanded comments
if($('#collapsed-comments-'+itmId).is(':visible'))
isVisible = true;
$('#' + ident).replaceWith($(this));
if(isVisible)
showHideComments(itmId);
$(".autotime").timeago();
- // $("div.wall-item-body").divgrow({ initialHeight: 400 });
-
}
prev = ident;
});
@@ -508,8 +510,6 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$(".autotime").timeago();
- // $("div.wall-item-body").divgrow({ initialHeight: 400 });
-
}
else {
$('img',this).each(function() {
@@ -521,7 +521,6 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$(".autotime").timeago();
- // $("div.wall-item-body").divgrow({ initialHeight: 400 });
}
});
@@ -557,7 +556,6 @@ function updateConvItems(mode,data) {
showHideComments(itmId);
$(".autotime").timeago();
- // $("div.wall-item-body").divgrow({ initialHeight: 400 });
}
prev = ident;
});
@@ -575,7 +573,7 @@ function updateConvItems(mode,data) {
}
/* autocomplete @nicknames */
- $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
+ $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl?f=&n=1");
var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
var bimgcount = bimgs.length;
@@ -596,18 +594,16 @@ function updateConvItems(mode,data) {
function collapseHeight() {
- $(".wall-item-body").each(function() {
- if($(this).height() > 410) {
+ $(".wall-item-body, .contact-info").each(function() {
+ if($(this).height() > divmore_height + 10) {
if(! $(this).hasClass('divmore')) {
- $(this).divgrow({ initialHeight: 400, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
+ $(this).divgrow({ initialHeight: divmore_height, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore');
}
}
});
}
-
-
function liveUpdate() {
if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; }
if(($('.comment-edit-text-full').length) || (in_progress)) {
@@ -689,7 +685,7 @@ function updateConvItems(mode,data) {
bParam_page = 1;
}
- update_url = baseurl + '/directory/?f=&aj=1&page=' + bParam_page;
+ update_url = baseurl + '/' + page_query + '/?f=&aj=1&page=' + bParam_page + extra_args ;
$("#page-spinner").spin('small');
update_mode = 'append';
@@ -704,6 +700,25 @@ function updateConvItems(mode,data) {
}
+ function justifyPhotos() {
+ justifiedGalleryActive = true;
+ $('#photo-album-contents').justifiedGallery({
+ margins: 3,
+ sizeRangeSuffixes: {
+ 'lt100': '-2',
+ 'lt240': '-2',
+ 'lt320': '-2',
+ 'lt500': '',
+ 'lt640': '-1',
+ 'lt1024': '-0'
+ }
+ }).on('jg.complete', function(e){ justifiedGalleryActive = false; });
+ }
+
+ function justifyPhotosAjax() {
+ justifiedGalleryActive = true;
+ $('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; });
+ }
function notify_popup_loader(notifyType) {
@@ -724,13 +739,13 @@ function updateConvItems(mode,data) {
if(data.notify.length==0){
- $("#nav-" + notifyType + "-menu").html(notifications_empty);
+ $("#nav-" + notifyType + "-menu").html(aStr[nothingnew]);
} else {
$("#nav-" + notifyType + "-menu").html(notifications_all + notifications_mark);
$(data.notify).each(function() {
- html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.class);
+ html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.message,this.when,this.hclass);
$("#nav-" + notifyType + "-menu").append(html);
});
$(".dropdown-menu img[data-src]").each(function(i, el){
@@ -874,12 +889,23 @@ function updateConvItems(mode,data) {
return true;
}
+ function importElement(elem) {
+ $.post(
+ "impel",
+ { "element" : elem },
+ function(data) {
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(NavUpdate,10);
+ }
+ );
+ return false;
+ }
function preview_post() {
$("#jot-preview").val("1");
$("#jot-preview-content").show();
- tinyMCE.triggerSave();
+// tinyMCE.triggerSave();
$.post(
"item",
$("#profile-jot-form").serialize(),
@@ -956,6 +982,7 @@ function updateConvItems(mode,data) {
$('body').css('cursor', 'wait');
$.get('contactgroup/' + gid + '/' + cid, function(data) {
$('body').css('cursor', 'auto');
+ $('#group-' + gid).toggleClass('icon-check icon-check-empty');
});
}
@@ -995,6 +1022,8 @@ function fcFileBrowser (field_name, url, type, win) {
}
function setupFieldRichtext(){
+ return;
+/*
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
@@ -1018,6 +1047,7 @@ function setupFieldRichtext(){
theme_advanced_path : false,
file_browser_callback : "fcFileBrowser",
});
+*/
}
@@ -1089,7 +1119,7 @@ $(document).ready(function() {
-$(window).scroll(function () {
+$(window).scroll(function () {
if(typeof buildCmd == 'function') {
// This is a content page with items and/or conversations
$('#more').hide();
@@ -1099,7 +1129,7 @@ $(window).scroll(function () {
$('#more').css("top","400");
$('#more').show();
}
-
+
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
if((pageHasMoreContent) && (! loadingPage)) {
$('#more').hide();
@@ -1119,9 +1149,9 @@ $(window).scroll(function () {
$('#more').css("top","400");
$('#more').show();
}
-
+
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
- if((pageHasMoreContent) && (! loadingPage)) {
+ if((pageHasMoreContent) && (! loadingPage) && (! justifiedGalleryActive)) {
$('#more').hide();
$('#no-more').hide();