Permalink
Browse files

fix: fixes a command list movement bug

troops departure time was not displaying; list could not be closed

closes #14
  • Loading branch information...
Potusek committed Jun 17, 2018
1 parent 0ebca57 commit 1e8ca5ffcfb29b6eeb9b59f63f0e2c354a53ac7c
Showing with 30 additions and 21 deletions.
  1. +30 −21 modules/GRCRTMovedFrames.js
@@ -8,39 +8,42 @@ function _GRCRTMovedFrames(){
},500);
return;
}
var
tacl_id = '#toolbar_activity_commands_list',
tacl_clk = '.activity.commands',
target_tacl = document.querySelector(tacl_id);
// command list
if($('#grcrt_taclWrap').length==0){
$('#toolbar_activity_commands_list').wrap($('<div/>',{'class':'grcrt_taclWrap', 'id':'grcrt_taclWrap'}))
if(RepConv.settings[RepConv.Cookie+'_tacl']){
$('#toolbar_activity_commands_list').addClass('grcrt_tacl')
$('#grcrt_taclWrap').draggable().draggable('enable')
var
observer_tacl = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') && $(target_tacl).css('display')=="none")){
$(tacl_clk).trigger('mouseenter')
}
});
});
if($(tacl_id+">.js-dropdown-list>a.cancel").length == 0){
$(tacl_id+">.js-dropdown-list")
.append(
$('<a/>',{'href':'#n','class':'cancel', 'style':'display:none;'})
.click(function(){
$('#grcrt_taclWrap').removeAttr('style')
})
)
}
observer_tacl.observe(target_tacl, { attributes: true, childList: false, characterData: false });
} else {
$('#toolbar_activity_commands_list').removeClass('grcrt_tacl')
$('#grcrt_taclWrap').draggable().draggable('disable').removeAttr('style')
}
}
var
tacl_id = '#toolbar_activity_commands_list',
tacl_clk = '.activity.commands',
target_tacl = document.querySelector(tacl_id),
observer_tacl = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') && $(target_tacl).css('display')=="none")){
$(tacl_clk).trigger('mouseenter')
}
});
});
if($(tacl_id+">.js-dropdown-list>a.cancel").length == 0){
$(tacl_id+">.js-dropdown-list")
.append(
$('<a/>',{'href':'#n','class':'cancel', 'style':'display:none;'})
.click(function(){
$('#grcrt_taclWrap').removeAttr('style')
})
)
if($(target_tacl).hasClass('grcrt_tacl') && ($('#grcrt_taclWrap').attr('style') /*&& $(target_tacl).css('display')=="none"*/)){
$(tacl_clk).trigger('mouseenter')
}
observer_tacl.observe(target_tacl, { attributes: true, childList: false, characterData: false });
}
// function activity_trades_list(){
@@ -136,4 +139,10 @@ function _GRCRTMovedFrames(){
activity_commands_list();
// activity_trades_list();
});
$.Observer(GameEvents.command.send_unit)
.subscribe('GRCRTMovedFrames_command_send', function() {
activity_commands_list();
// activity_trades_list();
});
}

0 comments on commit 1e8ca5f

Please sign in to comment.