Skip to content

Commit 1e8ca5f

Browse files
committed
fix: fixes a command list movement bug
troops departure time was not displaying; list could not be closed closes #14
1 parent 0ebca57 commit 1e8ca5f

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

modules/GRCRTMovedFrames.js

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,42 @@ function _GRCRTMovedFrames(){
88
},500);
99
return;
1010
}
11+
var
12+
tacl_id = '#toolbar_activity_commands_list',
13+
tacl_clk = '.activity.commands',
14+
target_tacl = document.querySelector(tacl_id);
1115
// command list
1216
if($('#grcrt_taclWrap').length==0){
1317
$('#toolbar_activity_commands_list').wrap($('<div/>',{'class':'grcrt_taclWrap', 'id':'grcrt_taclWrap'}))
1418
if(RepConv.settings[RepConv.Cookie+'_tacl']){
1519
$('#toolbar_activity_commands_list').addClass('grcrt_tacl')
1620
$('#grcrt_taclWrap').draggable().draggable('enable')
21+
var
22+
observer_tacl = new MutationObserver(function(mutations) {
23+
mutations.forEach(function(mutation) {
24+
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') && $(target_tacl).css('display')=="none")){
25+
$(tacl_clk).trigger('mouseenter')
26+
}
27+
});
28+
});
29+
if($(tacl_id+">.js-dropdown-list>a.cancel").length == 0){
30+
$(tacl_id+">.js-dropdown-list")
31+
.append(
32+
$('<a/>',{'href':'#n','class':'cancel', 'style':'display:none;'})
33+
.click(function(){
34+
$('#grcrt_taclWrap').removeAttr('style')
35+
})
36+
)
37+
}
38+
observer_tacl.observe(target_tacl, { attributes: true, childList: false, characterData: false });
1739
} else {
1840
$('#toolbar_activity_commands_list').removeClass('grcrt_tacl')
1941
$('#grcrt_taclWrap').draggable().draggable('disable').removeAttr('style')
2042
}
2143
}
22-
23-
var
24-
tacl_id = '#toolbar_activity_commands_list',
25-
tacl_clk = '.activity.commands',
26-
target_tacl = document.querySelector(tacl_id),
27-
observer_tacl = new MutationObserver(function(mutations) {
28-
mutations.forEach(function(mutation) {
29-
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') && $(target_tacl).css('display')=="none")){
30-
$(tacl_clk).trigger('mouseenter')
31-
}
32-
});
33-
});
34-
if($(tacl_id+">.js-dropdown-list>a.cancel").length == 0){
35-
$(tacl_id+">.js-dropdown-list")
36-
.append(
37-
$('<a/>',{'href':'#n','class':'cancel', 'style':'display:none;'})
38-
.click(function(){
39-
$('#grcrt_taclWrap').removeAttr('style')
40-
})
41-
)
44+
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') /*&& $(target_tacl).css('display')=="none"*/)){
45+
$(tacl_clk).trigger('mouseenter')
4246
}
43-
observer_tacl.observe(target_tacl, { attributes: true, childList: false, characterData: false });
4447
}
4548

4649
// function activity_trades_list(){
@@ -136,4 +139,10 @@ function _GRCRTMovedFrames(){
136139
activity_commands_list();
137140
// activity_trades_list();
138141
});
142+
$.Observer(GameEvents.command.send_unit)
143+
.subscribe('GRCRTMovedFrames_command_send', function() {
144+
activity_commands_list();
145+
// activity_trades_list();
146+
});
147+
139148
}

0 commit comments

Comments
 (0)