X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Fmain.js;h=b8b89cd9dfca3597ceae4ab898663b79ff10ae2a;hb=b795ce4fe7c952600ed3520d6822006a2190d4f8;hp=d5d38062e929009a7b4b9d76f114df4bf2b217ea;hpb=9d2afc2d3c12f6b70eae11487e491e2d8604ed60;p=friendica.git diff --git a/js/main.js b/js/main.js index d5d38062e9..b8b89cd9df 100644 --- a/js/main.js +++ b/js/main.js @@ -42,7 +42,7 @@ if (e.hasClass("ttbottom")) pos="bottom"; if (e.hasClass("ttleft")) pos="left"; if (e.hasClass("ttright")) pos="right"; - e.tipTip({defaultPosition: pos}); + e.tipTip({defaultPosition: pos, edgeOffset: 8}); }); @@ -71,6 +71,7 @@ /* popup menus */ $('a[rel^=#]').click(function(e){ menu = $( $(this).attr('rel') ); + e.preventDefault(); e.stopPropagation(); if (menu.attr('popup')=="false") return false; $(this).parent().toggleClass("selected"); @@ -78,6 +79,11 @@ return false; }); + // fancyboxes + $("a.popupbox").fancybox({ + 'transitionIn' : 'elastic', + 'transitionOut' : 'elastic' + }); /* notifications template */ @@ -94,12 +100,24 @@ if(home == 0) { home = ''; $('#home-update').removeClass('show') } else { $('#home-update').addClass('show') } $('#home-update').html(home); + + + var intro = $(data).find('intro').text(); + if(intro == 0) { intro = ''; $('#intro-update').removeClass('show') } else { $('#intro-update').addClass('show') } + $('#intro-update').html(intro); + + var mail = $(data).find('mail').text(); + if(mail == 0) { mail = ''; $('#mail-update').removeClass('show') } else { $('#mail-update').addClass('show') } + $('#mail-update').html(mail); + var eNotif = $(data).find('notif') notif = eNotif.attr('count'); if (notif>0){ $("#nav-notifications-linkmenu").addClass("on"); nnm = $("#nav-notifications-menu"); - nnm.html(""); + + nnm.html("
  • Show All Notifications
  • "); + //nnm.attr('popup','true'); eNotif.children("note").each(function(){ e = $(this); @@ -107,6 +125,7 @@ html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date')); nnm.append(html); }); + } else { $("#nav-notifications-linkmenu").removeClass("on"); $("#nav-notifications-menu").html(notifications_empty); @@ -121,7 +140,7 @@ }); eSysmsg.children("info").each(function(){ text = $(this).text(); - $.jGrowl(text, { sticky: false, theme: 'info' }); + $.jGrowl(text, { sticky: false, theme: 'info', life: 10000 }); }); }); @@ -149,33 +168,42 @@ } } - }); + }); + + }); function NavUpdate() { - if($('#live-network').length) { src = 'network'; liveUpdate(); } - 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(liking) { - liking = 0; - window.location.href=window.location.href - } - } - if($('#live-photos').length) { - if(liking) { - liking = 0; - window.location.href=window.location.href - } - } - if(! stopped) { $.get("ping",function(data) { $(data).find('result').each(function() { // send nav-update event $('nav').trigger('nav-update', this); + + + // start live update + + if($('#live-network').length) { src = 'network'; liveUpdate(); } + 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(liking) { + liking = 0; + window.location.href=window.location.href + } + } + if($('#live-photos').length) { + if(liking) { + liking = 0; + window.location.href=window.location.href + } + } + + + + }); }) ; } @@ -196,7 +224,7 @@ $.get(update_url,function(data) { in_progress = false; - $('.ccollapse-wrapper',data).each(function() { + $('.collapsed-comments',data).each(function() { var ident = $(this).attr('id'); var is_hidden = $('#' + ident).is(':hidden'); if($('#' + ident).length) { @@ -218,6 +246,7 @@ $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago')); if($('#' + ident + ' ' + '.comment-edit-text-empty').length) $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper')); + $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total')); $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like')); $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike')); $('#' + ident + ' ' + '.my-comment-photo').each(function() { @@ -231,6 +260,8 @@ commentBusy = false; $('body').css('cursor', 'auto'); } + /* autocomplete @nicknames */ + $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl"); }); } @@ -261,17 +292,22 @@ } function dostar(ident) { - $('#like-rotator-' + ident.toString()).show(); - $.get('starred/' + ident.toString(), function(data) { + ident = ident.toString(); + $('#like-rotator-' + ident).show(); + $.get('starred/' + ident, function(data) { if(data.match(/1/)) { - $('#starred-' + ident.toString()).addClass('starred'); - $('#starred-' + ident.toString()).removeClass('unstarred'); + $('#starred-' + ident).addClass('starred'); + $('#starred-' + ident).removeClass('unstarred'); + $('#star-' + ident).addClass('hidden'); + $('#unstar-' + ident).removeClass('hidden'); } else { - $('#starred-' + ident.toString()).addClass('unstarred'); - $('#starred-' + ident.toString()).removeClass('starred'); + $('#starred-' + ident).addClass('unstarred'); + $('#starred-' + ident).removeClass('starred'); + $('#star-' + ident).removeClass('hidden'); + $('#unstar-' + ident).addClass('hidden'); } - $('#like-rotator-' + ident.toString()).hide(); + $('#like-rotator-' + ident).hide(); }); } @@ -426,6 +462,7 @@ function setupFieldRichtext(){ }); } + /** * sprintf in javascript * "{0} and {1}".format('zero','uno');