struggling with dojo
Posted: 18 February 2020, 23:41
hello, i'm been looking for what is wrong for several days...
I can't find it and I always get a
Javascript error:
During notification placeDarkTile
Cannot read property 'ownerDocument' of null
TypeError: Cannot read property 'ownerDocument' of null
at Object.place
...
at Object.placeDarkTile
...
at Object.notif_placeDarkTile
...
TPL :
var jstpl_darktile = '<div id="darknesstile_${id}" class="darktile darktile_${type}"></div>';
CSS :
.darktile {
background-image: url('img/darkness.jpg');
background-size: 1000% 600%;
width: 75px;
position: absolute;
}
.darktile_1 { background-position: -0% -0%; height: 75px; }
.darktile_2 { background-position: -100% -0%; height: 150px; }
...
.darktile_30 { background-position: -200% -0%; height: 225px;}
PHP
function illuminate( $illuminator_id, $x, $y, $dir )
{
$darktile_type = bga_rand(1,30);
self::notifyAllPlayers( 'placeDarkTile', clienttranslate('${player_name}`s ${illuminator_name} illuminates ${x} - ${y} with darktile ${darktile_type}'), array(
'i18n' => array( 'illuminator_name' ),
'player_name' => self::getActivePlayerName(),
'illuminator_name' => $this->token_types[ $illuminator['type'] ]['name'],
'darktile_type' => $darktile_type,
'x' => $x,
'y' => $y
) );
}
JS
notif_placeDarkTile: function( notif )
{
this.placeDarkTile( notif.args.x, notif.args.y, notif.args.darktile_type );
},
placeDarkTile: function( x, y, darktile_type )
{
dojo.place( this.format_block( 'jstpl_darktile', {
id :darktile_type,
type: darktile_type
} ), 'darktiles' );
this.placeOnObject( 'darknesstile_'+id, 'square_'+x+'_'+y );
},
I can't find it and I always get a
Javascript error:
During notification placeDarkTile
Cannot read property 'ownerDocument' of null
TypeError: Cannot read property 'ownerDocument' of null
at Object.place
...
at Object.placeDarkTile
...
at Object.notif_placeDarkTile
...
TPL :
var jstpl_darktile = '<div id="darknesstile_${id}" class="darktile darktile_${type}"></div>';
CSS :
.darktile {
background-image: url('img/darkness.jpg');
background-size: 1000% 600%;
width: 75px;
position: absolute;
}
.darktile_1 { background-position: -0% -0%; height: 75px; }
.darktile_2 { background-position: -100% -0%; height: 150px; }
...
.darktile_30 { background-position: -200% -0%; height: 225px;}
PHP
function illuminate( $illuminator_id, $x, $y, $dir )
{
$darktile_type = bga_rand(1,30);
self::notifyAllPlayers( 'placeDarkTile', clienttranslate('${player_name}`s ${illuminator_name} illuminates ${x} - ${y} with darktile ${darktile_type}'), array(
'i18n' => array( 'illuminator_name' ),
'player_name' => self::getActivePlayerName(),
'illuminator_name' => $this->token_types[ $illuminator['type'] ]['name'],
'darktile_type' => $darktile_type,
'x' => $x,
'y' => $y
) );
}
JS
notif_placeDarkTile: function( notif )
{
this.placeDarkTile( notif.args.x, notif.args.y, notif.args.darktile_type );
},
placeDarkTile: function( x, y, darktile_type )
{
dojo.place( this.format_block( 'jstpl_darktile', {
id :darktile_type,
type: darktile_type
} ), 'darktiles' );
this.placeOnObject( 'darknesstile_'+id, 'square_'+x+'_'+y );
},