Board Logo

 Username:    Password:    Stay logged in: Welcome Guest. Please Login or Register.  May 28th, 2017, 01:44am

Coding Forum
Important News
Remember to add where the code goes in the headers/footers.

Also, please check the list of codes on the Hacks board, especially if you have an error. The code may already have been corrected.
Thanks.
Welcome to the Conforums Hacks Board!

Please follow these simple rules.

1. No spamming.
2. Do not advertise your board in here!
3. Keep on topic, or the thread will be locked.
4. No flame wars.
5. No bringing up old topics.

Please note: For codes other than those submitted in the Hacks Forum, please ask for permission to use from the creator. Be aware that coding queries in the Coding Forum become public domain. If you still seek coding help but find it inconvenient to display it publicly then please PM one of the moderators. We encourage all queries to be submitted here in hopes to help other members who might have the same question. Thank you.

Helpful sites
Google
Dynamic Drive

The Staff
Roger
Dave
Gizzy



« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Custom Stars?  (Read 1207 times)
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Custom Stars?
« Thread started on: Jan 26th, 2013, 4:05pm »

I noticed the code for custom stars wasn't working and I thought it would be cool for different members to their own stars. Please let me know if the code works, I'd really appreciate it. Thanks.

Code for custom stars that doesn't work:

Quote:
<script type="text/javascript">
<!--
var td = document.getElementsByTagName('TD');
var userz,starz,imgz;

function star(userz,starz) {
for(itd=0; itd<td.length; itd++){
if(td[itd].rowSpan=="2" && td[itd].width=="20%") {
if(td[itd].innerHTML.match(/username=(\w+)/i)) {
if(RegExp.$1==userz) {
imgz = td[itd].getElementsByTagName('IMG');
for(img=0; img<imgz.length; img++){
if(imgz[img].alt=="") {
imgz[img].src=starz;
}}}}}}}

if(location.href.match(/=display/)) {
star("username","http://www.yoururl.com/image.gif");
// Add more here
}
// -->
</script>
User IP Logged

Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Re: Custom Stars?
« Reply #1 on: Jan 27th, 2013, 3:28pm »

Can you give us a URL where the code is implemented so we can see why it's not working for you?
User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Re: Custom Stars?
« Reply #2 on: Jan 27th, 2013, 3:33pm »

Like

<script type="text/javascript">
<!--
var td = document.getElementsByTagName('TD');
var userz,starz,imgz;

function star(userz,starz) {
for(itd=0; itd<td.length; itd++){
if(td[itd].rowSpan=="2" && td[itd].width=="20%") {
if(td[itd].innerHTML.match(/username=(\w+)/i)) {
if(RegExp.$1==userz) {
imgz = td[itd].getElementsByTagName('IMG');
for(img=0; img<imgz.length; img++){
if(imgz[img].alt=="") {
imgz[img].src=starz;
}}}}}}}

if(location.href.match(/=display/)) {
star("kady","http://www.amperordirect.com/mm5/website_v3/images/flags/ru.png");
}
// -->
</script>


That? Or the actual website?

...Wait... the quotes messes up the url...

Anyway, here... The stars are completely unchanged. I also tried it on a member who isn't a Global Mod but it still didn't work, with or without quotes around the url link...

http://hetaliaworld.conforums.com/index.cgi?action=display&board=general&num=1356318002&start=0#1356318002
« Last Edit: Jan 27th, 2013, 3:44pm by kady » User IP Logged

Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Re: Custom Stars?
« Reply #3 on: Jan 30th, 2013, 2:44pm »

Sorry it's taken so long to get back to you.. Try this instead Code:
<script>
var td = document.getElementById('mainboard').getElementsByTagName('TD');

function stars(userz,oldstar,starz) {
for(itd=0; itd < td.length; itd++) {
if(td[itd].name == "miniprofile_"+userz) {
dt = td[itd].getElementsByTagName('IMG');
for(idt=0; idt<dt.length; idt++){
if(dt[idt].src == oldstar)
dt[idt].src = starz
}}}}

if(document.getElementById('stars')) {
stars("USERNAME","URL OF ORIGINAL STAR","URL OF NEW IMAGE");
}
</script> 
Changing the info as required
User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Re: Custom Stars?
« Reply #4 on: Jan 30th, 2013, 3:31pm »

The amount of time is fine, but the code still doesn't work sad

I only replaced USERNAME, URL OF ORIGINAL STAR, and URL OF NEW IMAGE. That's right, right?

I tried this on both mainpage header and footer and Global header and footer.

Got anything else that might work?
« Last Edit: Jan 30th, 2013, 3:35pm by kady » User IP Logged

Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Re: Custom Stars?
« Reply #5 on: Jan 31st, 2013, 01:58am »

You forgot to put the quote marks around the info passed to the function. I've changed that for you and it seems to work ok.

stars("USERNAME","URL OF ORIGINAL STAR","URL OF NEW IMAGE");
User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Re: Custom Stars?
« Reply #6 on: Jan 31st, 2013, 05:55am »

I kept the quotes there, around all three parts. I was trying to show that was something I hadn't replaced. But it still won't work sad

By the way where exactly should the code go? Mainpage or global, header or footer? I'm sick of trying the code in all of these places and I'd like to know where it should go to work. Thank you.
« Last Edit: Jan 31st, 2013, 06:02am by kady » User IP Logged

Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Re: Custom Stars?
« Reply #7 on: Jan 31st, 2013, 12:14pm »

You can put it in the global footers

I've also corrected another error you had - a space at the end of one of the image URL's

Checked it on your board and it appears to be working - http://hetaliaworld.conforums.com/index.cgi?board=story&action=display&num=1359352275
User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Re: Custom Stars?
« Reply #8 on: Jan 31st, 2013, 12:24pm »

*realizes you're seeing it working* OH! Let me guess...

It only works for internet explorer, right? I've been using Chrome all this time.

Plus at the moment I'm on my phone.
« Last Edit: Jan 31st, 2013, 12:29pm by kady » User IP Logged

Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Re: Custom Stars?
« Reply #9 on: Jan 31st, 2013, 3:25pm »

Yeah, you're correct I was checking it using IE - i've now made some changes and it works correctly using IE and Firefox so it should work ok in chrome ( I don't have chrome installed so I can't check it for you ).

Let me know if it works for you now...

Ta

Code:
<script>
var td = document.getElementById('mainboard').getElementsByTagName('TD');

function stars(userz,oldstar,starz) {
for(itd=0; itd < td.length; itd++) {
if(td[itd].id) {
if(td[itd].id == "miniprofile_"+userz) {
dt = td[itd].getElementsByTagName('IMG');
for(idt=0; idt<dt.length; idt++){
if(dt[idt].src == oldstar)
dt[idt].src = starz
}}}}}

if(document.getElementById('stars')) {
stars("USERNAME","URL OF ORIGINAL STAR","URL OF NEW IMAGE");
}
</script> 


http://hetaliaworld.conforums.com/index.cgi?action=display&board=general&num=1356318002&start=0#1356318002
User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
Dalton
Ex-Shiny Gold Star Club Member
Conforums Administrator


member is offline

Avatar



AIM
Homepage PM

Gender: Male
Posts: a whole lot
xx Re: Custom Stars?
« Reply #10 on: Jan 31st, 2013, 5:25pm »

Works in Chrome. Must uninstall that from my computer now.. i can already feel google recording my every movement.
« Last Edit: Jan 31st, 2013, 5:26pm by Dalton » User IP Logged

User Image
kady
Member


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 63
xx Re: Custom Stars?
« Reply #11 on: Jan 31st, 2013, 7:46pm »

THANK YOU SO MUCH! *hugs*

Is there a way you can get the colored usernames to work on chrome too?
User IP Logged

Dalton
Ex-Shiny Gold Star Club Member
Conforums Administrator


member is offline

Avatar



AIM
Homepage PM

Gender: Male
Posts: a whole lot
xx Re: Custom Stars?
« Reply #12 on: Jan 31st, 2013, 11:50pm »

Yeah haha, thats ancient. Ill look in the morning more.
« Last Edit: Feb 1st, 2013, 12:07am by Dalton » User IP Logged

User Image
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Back To Top
Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls