diff options
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/view/js/main.js b/view/js/main.js index beedb7f01..85aea9875 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -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,8 @@ var loadingPage = true; var pageHasMoreContent = true; var updateCountsOnly = false; + var divmore_height = 400; + var last_filestorage_id = null; $(function() { $.ajaxSetup({cache: false}); @@ -260,9 +269,9 @@ } // fancyboxes - $("a.popupbox").fancybox({ - 'transitionIn' : 'elastic', - 'transitionOut' : 'elastic' + // Is this actually used anywhere? + $("a.popupbox").colorbox({ + 'transition' : 'elastic' }); @@ -335,7 +344,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 +438,8 @@ function updatePageItems(mode,data) { pageHasMoreContent = false; } + collapseHeight(); + } @@ -457,26 +468,18 @@ function updateConvItems(mode,data) { $('#' + prev).after($(this)); 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 }); + $(".autotime",this).timeago(); } 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 }); - + $(".autotime",this).timeago(); } prev = ident; }); @@ -507,9 +510,7 @@ function updateConvItems(mode,data) { $('#threads-end').before($(this)); if(isVisible) showHideComments(itmId); - $(".autotime").timeago(); - // $("div.wall-item-body").divgrow({ initialHeight: 400 }); - + $(".autotime",this).timeago(); } else { $('img',this).each(function() { @@ -520,8 +521,7 @@ function updateConvItems(mode,data) { $('#' + ident).replaceWith($(this)); if(isVisible) showHideComments(itmId); - $(".autotime").timeago(); - // $("div.wall-item-body").divgrow({ initialHeight: 400 }); + $(".autotime",this).timeago(); } }); @@ -555,9 +555,8 @@ function updateConvItems(mode,data) { $('#' + prev).after($(this)); if(isVisible) showHideComments(itmId); - $(".autotime").timeago(); + $(".autotime",this).timeago(); - // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } prev = ident; }); @@ -596,19 +595,18 @@ 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).readmore({collapsedHeight: divmore_height, moreLink: '<a href="#">'+aStr['divgrowmore']+'</a>', lessLink: '<a href="#">'+aStr['divgrowless']+'</a>'}); $(this).addClass('divmore'); } - } + } }); } - - function liveUpdate() { + if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */ if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; } if(($('.comment-edit-text-full').length) || (in_progress)) { if(livetime) { @@ -749,7 +747,7 @@ function updateConvItems(mode,data) { $("#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){ @@ -846,6 +844,19 @@ function updateConvItems(mode,data) { }); } + function filestorage(event,nick,id) { + $('#cloud-index-' + last_filestorage_id).removeClass('cloud-index-active'); + $('#perms-panel-' + last_filestorage_id).hide().html(''); + $('#file-edit-' + id).spin('tiny'); + delete acl; + $.get('filestorage/' + nick + '/' + id + '/edit', function(data) { + $('#cloud-index-' + id).addClass('cloud-index-active'); + $('#perms-panel-' + id).html(data).show(); + $('#file-edit-' + id).spin(false); + last_filestorage_id = id; + }); + } + function post_comment(id) { unpause(); commentBusy = true; @@ -909,7 +920,7 @@ function updateConvItems(mode,data) { function preview_post() { $("#jot-preview").val("1"); $("#jot-preview-content").show(); - tinyMCE.triggerSave(); +// tinyMCE.triggerSave(); $.post( "item", $("#profile-jot-form").serialize(), @@ -1026,6 +1037,8 @@ function fcFileBrowser (field_name, url, type, win) { } function setupFieldRichtext(){ + return; +/* tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -1049,6 +1062,7 @@ function setupFieldRichtext(){ theme_advanced_path : false, file_browser_callback : "fcFileBrowser", }); +*/ } |