Private Messages Counting
Posted January 14th 2012, 7:45am
Change this bit
x.title.split(' ')[2]


To this:
x.title.split('have ').substring(0,2)


It's just an alternative I suppose. They both should work fine though.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Private Messages Counting
Posted January 15th 2012, 6:46am
Hmmm... There is the same problem with the script you gave to me, but I thought to change this script:

x.title.split(' ')[2]


into this:

x.title.split(' ')[1]


I did it withought any knowledge ! Image I was lucky and this gives me the just the number.Is this method right ? But Can you tell me now what does the script below exactly ? So as to learn :)

Thanks !

<script type="text/javascript">
var x = document.getElementById('i_icon_mini_new_message');
if (x) {
jQuery('div.testpm').after('<span class="dionPM">' + x.title.split(' ')[1] + '</span>');
}
</script>
φ
Posts: 35
Joined: October 21st 2011, 11:00pm
Likes Given: 4
Likes Received: 2
Private Messages Counting
Posted January 15th 2012, 8:34am
But what do you have to say about my altering and the final result ? (It is working Great !) Please tell me and explain me if you can so as to start learning :)

Thank you !
φ
Posts: 35
Joined: October 21st 2011, 11:00pm
Likes Given: 4
Likes Received: 2
Private Messages Counting
Posted January 16th 2012, 5:45am
T
x.title.split(' ')[1]

This splits the title of the new message icon.

So it would be split at each space.
So when that is 'You have 1 new message' the [0] would mean 'You' a [1] would mean 'have' and [2] would mean '1' ... which is why you issue is very strange.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Private Messages Counting
Posted January 16th 2012, 7:17am
Ok I figured it out xD Hahahaah my forum is not in English and adds the number in the [1] position !

var x = document.getElementById('i_icon_mini_new_message');


Does this part count how many times the element 'i_icon_mini_new_message' appears ?

Thanks !
φ
Posts: 35
Joined: October 21st 2011, 11:00pm
Likes Given: 4
Likes Received: 2

Who is online

Users browsing this forum: No registered users and 0 guests