@@ -530,6 +530,8 @@ function _RepConvGRC() {
530530 'class' : 'button_new square' ,
531531 'style' : 'width:26px; float: left;'
532532 } )
533+ . data ( 'ally_id' , _ally )
534+ . data ( 'ally_name' , _ally_name )
533535 . html ( $ ( '<img/>' , { src :RepConv . Const . staticImg + '/stats.png' } ) )
534536 . mousePopup ( new MousePopup ( RepConvTool . GetLabel ( 'STATS.ALLY' ) ) )
535537 if ( "https:" == window . location . protocol && ( RepConv . active . statsGRCL != 'potusek' ) ) {
@@ -540,7 +542,7 @@ function _RepConvGRC() {
540542 } else {
541543 $ ( _link )
542544 . click ( function ( ) {
543- showStats ( 'alliance' , $ ( this ) . attr ( 'ally_id' ) , $ ( this ) . attr ( 'ally_name' ) ) ;
545+ showStats ( 'alliance' , $ ( this ) . data ( 'ally_id' ) , $ ( this ) . data ( 'ally_name' ) ) ;
544546 } )
545547 }
546548 RCGP . getJQElement ( ) . find ( $ ( '#alliance_points' ) ) . next ( )
@@ -560,12 +562,11 @@ function _RepConvGRC() {
560562 'style' :'width: 23px; height: 23px; float: left;' ,
561563 'class' : 'grcrt radar'
562564 } )
565+ . data ( 'ally_id' , _ally )
566+ . data ( 'ally_name' , _ally_name )
563567 . mousePopup ( new MousePopup ( RepConvTool . GetLabel ( 'RADAR.TOWNFINDER' ) ) )
564568 . click ( function ( ) {
565- GRCRT_Radar . windowOpen ( { alliance :{ 'id' :_ally , 'name' :_ally_name } } )
566- //RepConvRadar.setCurrentTown(),
567- //RepConvRadar.setAlly(_ally, _ally_name);
568- GRCRT_Radar . windowOpen ( ) ;
569+ GRCRT_Radar . windowOpen ( { alliance :{ 'id' :$ ( this ) . data ( 'ally_id' ) , 'name' :$ ( this ) . data ( 'ally_name' ) } } )
569570 } )
570571 ) ;
571572 }
@@ -3452,6 +3453,26 @@ function _RepConvGRC() {
34523453 RepConv . wndArray . push ( _IdS ) ;
34533454 RepConv . wndArray . push ( 'grcrt_stats' ) ;
34543455 RepConv . wndArray . push ( 'grcrt_analysis' ) ;
3456+ function addAttackObserver ( ) {
3457+ if ( $ ( 'div.activity.attack_indicator' ) . length == 0 ) {
3458+ setTimeout ( function ( ) {
3459+ addAttackObserver ( ) ;
3460+ } , 100 )
3461+ } else {
3462+ var MutationObserver = window . MutationObserver || window . WebKitMutationObserver ;
3463+ var observer_attack = new MutationObserver ( function ( mutations ) {
3464+ mutations . forEach ( function ( mutation ) {
3465+ if ( $ ( 'div.activity.attack_indicator' ) . hasClass ( 'active' ) ) {
3466+ attackIncoming ( parseInt ( $ ( 'div.activity.attack_indicator div.count' ) . html ( ) ) )
3467+ } else {
3468+ attackIncoming ( 0 )
3469+ }
3470+ } ) ;
3471+ } ) ;
3472+ observer_attack . observe ( document . querySelector ( 'div.activity.attack_indicator div.count' ) , { attributes : true , childList : true , characterData : true } ) ;
3473+ }
3474+
3475+ }
34553476 this . init = function ( ) {
34563477 "use strict" ;
34573478 try {
@@ -3494,6 +3515,7 @@ function _RepConvGRC() {
34943515 town_groups_list_chg ( ) ;
34953516 // activity_commands_list();
34963517 construction_queue_chg ( ) ;
3518+ addAttackObserver ( ) ;
34973519 }
34983520 // -- okienka
34993521 function _grcrtWindowStats ( ) {
0 commit comments