The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Liveracers widget in sidebar/s

View previous topic View next topic Go down

In progress Liveracers widget in sidebar/s

Post by OldCroc on October 12th 2015, 6:43 pm

Hi all,
I have a dedicated server running rFactor and GSC extreme racing sims. I have joined liveracers and followed their instructions to put a different domain key into the dedicated servers of both sims. The html code is very similar for both dedicated servers however I cannot get both to show up at the same time. Only one shows. I had the same problem with the TS3 and Mumble servers. Only one will show in one sidebar. Dunno what happens to the second one lol.
Need a bit of advice, thanks bwi bwi

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 12th 2015, 6:52 pm

This is the different html code for the 2 games.

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by SLGray on October 12th 2015, 9:33 pm

So you are adding both codes to a widget on your forum hosted by Forumotion? One is not appearing?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35634
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 12th 2015, 9:50 pm

Yes. And the moment I put the second code in a new widget, it replaces the other one.

Here is a link to my website. If you scroll down you will see that both widgets shows. One for rFactor and one for Game Stock car. But not on my forum.

http://oldcroc.wix.com/crocodileracing

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by Ange Tuteur on October 12th 2015, 11:35 pm

Hi @OldCroc,

Is the problem occurring on a Forumotion forum you administrate ? If so, it would be best if you provide the link of that forum instead. However.. by examining the codes you posted, they're both utilizing the same id ; lr-servers. Ids, unfortunately are one-of-kind, and when referenced in JavaScript the first node with that id is usually returned. Not to mention, they're both creating the same global variable which means one is going to overwrite the other.

To be honest, both codes look identical aside from the domain.. blackeye

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 13th 2015, 8:15 am

Hi Ange,

Thank you for your reply. The reason I sent the link to the website, was to point out that these codes, although very similar, works well on the website but not on the forum.
The link to the forum is http://crocracing.africamotion.net
Thank you

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by SLGray on October 13th 2015, 12:04 pm

Are you sure that you did not copy the same code twice, because both are the same?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35634
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 13th 2015, 12:09 pm

The only difference seems to be the domain name under liveracers. However this is the way the html code was pasted on the website and it shows both widgets but the same code/s on forum overwrites the other one.

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by Ange Tuteur on October 13th 2015, 12:12 pm

Could you paste both codes here for me to test ? I should have a better idea of what's going on if I can manipulate the code firsthand.

Sorry, and thanks. Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 13th 2015, 12:34 pm

Hi Ange,

I am inserting document showing the two codes as reguested.

Cheers


OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by Ange Tuteur on October 13th 2015, 12:46 pm

I'm sorry, I meant the code you're pasting in the widgets. Otherwise I'm going to have to rewrite everything from the image you posted.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 13th 2015, 12:56 pm

Sorry Ange,

Here is the code for the two widgets. The red coloured not part of the widget code.

1: Rfactor game

<script type="text/javascript">
window._lr = {
url: 'http://crocodileracing.liveracers.com' // where [domain].liveracers.com is the address of the domain you want to monitor
};
(function () {
var lr = document.createElement('script'); lr.type = 'text/javascript'; lr.async = true;
lr.src = window._lr.url + '/Scripts/api.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lr, s);
})();
</script>
<div theme="dark" id="lr-servers">
</div>

02b8ad79-31e2-4e90-981d-2f9898c89d27 Domainkey pasted into game liveracers.ini file.

2: GSC game

<script type="text/javascript">
window._lr = {
url: 'http://crocodilesim.liveracers.com' // where [domain].liveracers.com is the address of the domain you want to monitor
};
(function () {
var lr = document.createElement('script'); lr.type = 'text/javascript'; lr.async = true;
lr.src = window._lr.url + '/Scripts/api.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lr, s);
})();
</script>
<div id="lr-servers" theme="dark">
</div>

887f840-26d7-4a2d-8734-60b7cbab3134 Domainkey pasted into game liveracers.ini file.


OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by Ange Tuteur on October 13th 2015, 1:11 pm

I really think it comes down to using multiple Ids which are the same. For your second widget, try changing id="lr-servers" to id="lr-servers-2" and I assume you can edit the API script, correct ? If so, edit this file : http://crocodilesim.liveracers.com/Scripts/api.js

and change document.getElementById('lr-servers') to document.getElementById('lr-servers-2')

From what I can tell, the latter code is overwriting the former code. The global variable that's being overwritten ( window._lr ) shouldn't be a problem, but the shared ids on the other hand seem to be.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by OldCroc on October 13th 2015, 1:13 pm

Thanks Ange. Will give it a try and come back to you Hello

OldCroc
New Member

Posts : 8
Reputation : 1
Language : English

Back to top Go down

In progress Re: Liveracers widget in sidebar/s

Post by Ange Tuteur on October 13th 2015, 1:13 pm

Sure thing. You only need to do this for one widget, but if you have more widgets like this in the future you may need to do the same thing. That's if it works of course. Razz

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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