Page 1 of 2
[CLOSED]Convertir du JQUery en Dojo
Posted: 30 August 2015, 23:06
by Rudolf
petite question:
comment puis-je transformer cette phrase JQuery en DOjo?
Code: Select all
$( "#result" ).load( "http://fr.studio.boardgamearena.com/#!table?table=23830 #active_player_small_infos_block", function() { alert( "Load was performed." );});
eventuellement, la fonction alert n'est pas indispensable)
Code: Select all
$( "#result" ).load( "http://fr.studio.boardgamearena.com/#!table?table=23830 #active_player_small_infos_block");
merci d'avance.
Re: Convertir du JQUery en Dojo
Posted: 31 August 2015, 23:11
by Rudolf
After a long war with code, here is my findGender function:
Code: Select all
findGender:function()
{
var self=this;
this.showMessage('TOTO1','error');
require(["dojo/request", "dojo/dom", "dojo/dom-construct", "dojo/on", "dojo/domReady!"], function(request,dom, domConst, on){
request("http://fr.studio.boardgamearena.com/#!table?table=23855").then(function(data){
domConst.place("<p>response: <code>" + data + "</code>", "gender");
if (dojo.hasClass("gender","icon20")) self.showMessage("icon20 trouvé!",'error')
else self.showMessage("test rudolf: icon20 non trouvé","error");
// do something with handled data
}, function(err){
self.showMessage(err);
// handle an error condition
}, function(evt){
self.showMessage('oops2');
// handle a progress event
});
});
this.showMessage('TOTO2','error');
},
I see correct TOTO1 and TOTO2, but nothing else:
But something is strange: there is an error message: Cannot Load "
http://fr.studio.boardgamearena.com/#!table?table=23855" ... but I can load it via browser ...
So I suppose I have to add something to say "wait when all HTML is given from PHP"??? Or I cannot use this way?
Re: Convertir du JQUery en Dojo
Posted: 01 September 2015, 04:10
by pikiou
Or you could use gameui.players_metadata[playerId].gender
But either way we're not supposed to access this information so when BGA changes, all your real-time and turn-based game tables will become unplayable.
So better ask admins if you can use this data and what's the best way to use it?
Re: Convertir du JQUery en Dojo
Posted: 01 September 2015, 14:42
by Rudolf
Thanks...
by the way... I've learn some tricks maybe usefull in the future doing this...
Re: Convertir du JQUery en Dojo
Posted: 01 September 2015, 19:29
by Rudolf
Are you sure gameui.players_metagamedata exists? Seems not to be present on my project.
Re: Convertir du JQUery en Dojo
Posted: 02 September 2015, 00:46
by pikiou
I don't know about gameui.players_metagamedata, but gameui.players_metadata is available ^^
At least in prod, dunno about the studio.
I looked for it when I saw how complex your solution seemed, otherwise I'd have told you earlier.
Re: Convertir du JQUery en Dojo
Posted: 02 September 2015, 14:58
by Rudolf
Ah ... Ok... maybe in prod ...
But in studio, nothing in gameui begins by "players_meta..."

Re: [CLOSED]Convertir du JQUery en Dojo
Posted: 24 August 2021, 05:45
by JonChambers
Rudolf wrote: ↑01 September 2015, 19:29
Ah ... Ok... maybe in prod ...
But in studio, nothing in gameui begins by "players_meta..."
Ten years later, same issue.
Has anyone written a bug report for this?
I'm not allowed to, as I haven't played enough games yet.
Re: Convertir du JQUery en Dojo
Posted: 24 August 2021, 08:21
by Een
As expressed by pikiou:
pikiou wrote: ↑01 September 2015, 04:10
But either way we're not supposed to access this information so when BGA changes, all your real-time and turn-based game tables will become unplayable.
That's not a bug. This is meta information, outside of the game. It's not meant to be accessible or used by a game module.
Re: [CLOSED]Convertir du JQUery en Dojo
Posted: 25 August 2021, 01:36
by JonChambers
Een wrote: ↑24 August 2021, 08:21
As expressed by pikiou:
pikiou wrote: ↑01 September 2015, 04:10
But either way we're not supposed to access this information so when BGA changes, all your real-time and turn-based game tables will become unplayable.
That's not a bug. This is meta information, outside of the game. It's not meant to be accessible or used by a game module.
Then wouldn't the bug be that it CAN be accessed in production? (Or has that bug been fixed?)
Studio should ideally be a 1:1 simulation of production. When code starts executing one way in one, and another way in the other, that's a failing of studio (or production).
I was hoping to include the player's flag in the game. This data is locked off if I do it in studio, but available (maybe?) if I do it in production. I've already got the 184px avatar, the name, the colour, and the link, but no flag. Should I just leave the flag out for now and maybe add it post-launch? Or is this a banned feature I may not add? It already exists on the player board, so I don't see the harm in using it again on the game itself.