WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 NumberCount on inbox Mails on Sat Apr 30, 2011 4:04 pm

Emilio

avatar
Registered Member
Registered Member
Well i want something like when you have 2 new Mails , theres a square or something with "2" on it on the Navigation " inbox" , Is this possible ? maybe with some Js?

http://www.graphilicious.forumotion.Com

2 Re: NumberCount on inbox Mails on Tue May 03, 2011 12:46 am

Sir Saxaca


Registered Member
Registered Member
Here is some jQuery AJAX to check the length of the default PunBB new PM image:
Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mainmenu[href="/privmsg?folder=inbox"]').html('Messages');
    }

    else {
      $('a.mainmenu[href="/privmsg?folder=inbox"]').html('Messages ('+count+')');
    }
  }
});

I'll leave you up for the editing. Host it the Dion way.

3 Re: NumberCount on inbox Mails on Tue May 03, 2011 1:14 am

Emilio

avatar
Registered Member
Registered Member
This is my code in overall header from the Navigation.

Code:
<li><a href="/privmsg?folder=inbox">INBOX</a></li>

Can you add cause i ain't understand a word of it

http://www.graphilicious.forumotion.Com

4 Re: NumberCount on inbox Mails on Tue May 03, 2011 1:24 am

Gangstar15

avatar
Registered Member
Registered Member
Replace your link with:
Code:
<li><a href="/privmsg?folder=inbox" class="mailbox">INBOX</a></li>
and use this code:
Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1) {
      $('a.mailbox').html('Messages');
    }

    else {
      $('a.mailbox').html('Messages ('+count+')');
    }
  }
});

And replace your "New Subject" icon with this one "http://illiweb.com/fa/punbb/status_unread.png"




Saxy, why i didn't used this before Very Happy lol its a nice script Wink

5 Re: NumberCount on inbox Mails on Tue May 03, 2011 1:57 am

Emilio

avatar
Registered Member
Registered Member
Thanks this is solved. Thanks for the support Gangstarr and Saxaca!

http://www.graphilicious.forumotion.Com

6 Re: NumberCount on inbox Mails on Tue May 03, 2011 2:16 am

Sir Saxaca


Registered Member
Registered Member
Gangstar - no need for your way.
Emilio's running with two navbars - the Forumotion one, with all links but the PM hidden, and his custom drop-down one, located over the navbar template tag.

Assuming you want to use the PM image, host this script in a HTML page, and link it globally:
Code:
$.ajax({
  url: '/privmsg?folder=inbox',
  success: function(ajax) {
    count = $('img[src="http://illiweb.com/fa/punbb/status_unread.png"]', ajax).length;
 
    if (count < 1 ) { }
    else {
      $('a.mainmenu[href="/privmsg?folder=inbox"]').after('<span class="saxPM">'+count+'</span>');
    }
  }
});

The reason I left the "if" in place, is in case you want to add something more.

Style the .saxPM rule as you want. I'd suggest you to position the navbar relative, and the .saxPM absolute.

What this script does, is really simple. It sends an AJAX request to the server, which returns the DOM of the inbox folder page. The count variable searches for matches of the new PM image, and returns the length of them. Based on the length of the image, code is executed to modify the navbar on all pages.

Good luck!

7 Re: NumberCount on inbox Mails on Thu May 05, 2011 2:04 pm

Dion

avatar
Registered Member
Registered Member
First time I visited here in a few weeks, and this topic got me to re-join.

Using AJAX for this application is like using a flamethrower to light a candle...simple is always best:

Code:
var x = document.getElementById('i_icon_mini_new_message');
if (x) {
$('ul.topnav a[href="/privmsg?folder=inbox"]').after('<span class="dionPM">' + x.title.split(' ')[2] + '</span>');
}

(A version of this code was on my IPBDion™️ board. How did you miss it? Razz)

http://diondesigns.forumotion.com

8 Re: NumberCount on inbox Mails on Thu May 05, 2011 8:03 pm

Sir Saxaca


Registered Member
Registered Member
Damn.. never thought about the split. Damnit!
I never noticed the IPBDion code, I was away in the weekend, and when I came back, IPBDion was deleted Razz

But hey, a flamethrower will certainly light the candle Very Happy

I'm feeling flattened Razz

9 Re: NumberCount on inbox Mails on Fri May 06, 2011 1:21 pm

Dion

avatar
Registered Member
Registered Member
Oh, IPBDion is still around...it will be making a return public appearance in the near future. Very Happy

http://diondesigns.forumotion.com

10 Re: NumberCount on inbox Mails on Fri May 06, 2011 6:37 pm

Spudster


Registered Member
Registered Member
This should be possible gangstar is allreaddy shown you

11 Re: NumberCount on inbox Mails on Fri May 06, 2011 8:10 pm

Sir Saxaca


Registered Member
Registered Member
Spudster wrote:This should be possible gangstar is allreaddy shown you
It IS possible:
http://www.webartzforum.com/t2442-numbercount-on-inbox-mails#35996

IPBDion reminds me more of.. hmm.. the domain redirection explains Very Happy

12 Re: NumberCount on inbox Mails on Mon May 09, 2011 8:41 pm

RockerMan

avatar
Technician
Technician
Since this topic appears to be solved multiple times, I will now lock and mark as solved.

Sir Saxaca, If you have any further questions please create a new thread.

~RockerMan


_________________


No support via. PM, as they will just be deleted
http://www.graphics-post.com/

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum