Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
Recent Tutorials
Top posting users this month
Top Achievers
Who is online?
In total there are 30 users online :: 0 Registered, 0 Hidden and 30 Guests :: 2 Bots
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
[SOLVED] Script addition for rank and posts
Page 1 of 1 • Share
Hello,
We recently have been working on implementing a new feature where each member, based on their "Crew" rank and their post will have an additional image shown on their profile in the posts.
The script we have so far is this one:
We recently have been working on implementing a new feature where each member, based on their "Crew" rank and their post will have an additional image shown on their profile in the posts.
The script we have so far is this one:
- Code:
$(function() {
var a = $('.user-info'), // all post stats
i = 0, // user-info index
j = a.length, // user-info length
rank,
posts; // posts will be redefined in the loop
for (; i < j; i++) {
posts = $(a[i]).text().replace(/\n/g, '').replace(/.*?Posts.*?: (\d+).*/, '$1');
rank = $(a[i]).html().replace(/\n/g, '').replace(/.*?Crew.*?:\s(.*?)<br>.*/, '$1');
// αρχικά πάντα μπαίνει ο μεγαλύτερος αριθμός και όσο κατεβαίνεις να μικραίνει ο αριθμός.
if (rank == 'Strawhats' && posts > 37) {
$(a[i]).prepend('<div><img src="http://i65.tinypic.com/6f77dh.jpg" alt="zoro"></div>');
}
else if (rank == 'Strawhats' && posts > 1) {
$(a[i]).prepend('<div><img src="http://i68.tinypic.com/jzjzas.jpg" alt="zoro"></div>');
}
}
});
@Luffy thanks for all the information. I think I found the problem, there was a closing span tag in front of the crew rank text. See if this works for you guys :
- Code:
$(function() {
var a = $('.user-info'), // all post stats
i = 0, // user-info index
j = a.length, // user-info length
rank,
posts; // posts will be redefined in the loop
for (; i < j; i++) {
posts = $(a[i]).text().replace(/\n/g, '').replace(/.*?Posts.*?: (\d+).*/, '$1');
rank = $(a[i]).html().replace(/\n/g, '').replace(/.*?Crew.*?:\s.*?<\/span>(.*?)<br>.*/, '$1');
// αρχικά πάντα μπαίνει ο μεγαλύτερος αριθμός και όσο κατεβαίνεις να μικραίνει ο αριθμός.
if (rank == 'Strawhats' && posts > 37) {
$(a[i]).prepend('<div><img src="http://i65.tinypic.com/6f77dh.jpg" alt="zoro"></div>');
}
else if (rank == 'Strawhats' && posts > 1) {
$(a[i]).prepend('<div><img src="http://i68.tinypic.com/jzjzas.jpg" alt="zoro"></div>');
}
}
});
@Ange Tuteur the member said that this didn't actually work, and that he has an avatar displaying to the fa_toolbar and it removes that avatar and the points that he has on a widget..
Did he edit the script at all ? Because I'm seeing this error and I don't see it in the script I posted above :
It should be
not
. One equal sign is used to assign a value to something, such as a variable. Two equal signs are used to compare two objects, and three equal signs are used for type checking. So in short, let him know that if he wants to check if posts is equal to something use two equal signs. ( I know it's confusing for non-programmers ) This is a good list of the comparison operators in JS in case he want's to see the other operators he can use for comparisons :
http://www.w3schools.com/js/js_comparisons.asp
It should be
|
|
http://www.w3schools.com/js/js_comparisons.asp
- Sponsored content
Similar topics
Create an account or log in to leave a reply
You need to be a member in order to leave a reply.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum