Skip to content

Commit 04edd9d

Browse files
authored
Merge pull request #23 from grcrt/bugfix/island_window_sorting_player_name
Bugfix/island window sorting player name
2 parents 0ebca57 + 74022b5 commit 04edd9d

File tree

7 files changed

+52
-86
lines changed

7 files changed

+52
-86
lines changed

GRCRTMain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function _GRCRTMain(){
4747
this.HelpTabs = {}
4848
this.RepType = ""
4949
this.menu = {
50-
'about' :
50+
99 :
5151
{
5252
'name' : 'HELPTAB1',
5353
'action' : "RepConvGRC.openGRCRT('HELPTAB1')"

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
}

modules/GRCRT_AO.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ function _GRCRT_AO() {
397397
}
398398

399399
// dodanie do menu
400-
RepConv.menu.academy_overview =
400+
RepConv.menu[4] =
401401
{
402402
'name' : 'AO.TITLE',
403403
'action' : "GRCRT_AO.windowOpen();",
404-
'class' : 'aom',
404+
'class' : 'aom'
405405
}
406406

407407
// ikona w menu

modules/GRCRT_Radar.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,16 +1094,6 @@ function _GRCRT_Radar() {
10941094
)
10951095
)
10961096
)
1097-
/*
1098-
<div class="modifier">
1099-
<div class="modifier_icon power power_icon45x45 unit_movement_boost"></div>
1100-
<div class="checkbox_new checked" data-modifierid="unit_movement_boost">
1101-
<div class="cbx_icon"></div><div class="cbx_caption"></div>
1102-
</div>
1103-
</div>
1104-
1105-
*/
1106-
11071097
.append(
11081098
$('<br/>', {'style':'clear: both'})
11091099
)
@@ -1120,7 +1110,7 @@ function _GRCRT_Radar() {
11201110
})
11211111
}
11221112
// dodanie do menu
1123-
RepConv.menu.radar =
1113+
RepConv.menu[1] =
11241114
{
11251115
'name' : 'RADAR.TOWNFINDER',
11261116
'action' : "GRCRT_Radar.windowOpen();",

modules/GRCRT_TSL.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function _GRCRT_TSL() {
1616

1717

1818
// dodanie do menu
19-
RepConv.menu.tsl = {
19+
RepConv.menu[3] = {
2020
'name' : 'TSL.WND.WINDOWTITLE',
2121
'action' : "GRCRT_TSL.createWindow();",
2222
'class' : 'tsl'

modules/RepConvABH.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _RepConvABH(){
1515
}
1616
;
1717
function _btn(){
18-
RepConv.menu.abh =
18+
RepConv.menu[2] =
1919
{
2020
'name' : 'ABH.WND.WINDOWTITLE',
2121
'action' : "RepConvABH.showView()",

modules/RepConvGRC.js

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,9 @@ function _RepConvGRC() {
337337
}
338338
}
339339
function islandBBCode(RCGP){ // info o graczach na wyspie - dodanie listy miast w BBCode
340-
var
341-
WndName = (RCGP).getName(),
342-
WndId = '#' + WndName;
343-
if ((RCGP.getJQElement()).find($(WndId + 'RepConvTownButton')).length == 0) {
344-
// nazwy graczy jako linki
345-
var _towns = JSON.parse(RepConv.requests[RCGP.getController()].responseText).json.json.town_list;
346-
if ((RCGP.getJQElement()).find($('#island_info_towns_left_sorted_by_name li span.player_name a.gp_player_link')).length == 0) {
347-
$.each((RCGP.getJQElement()).find($('#island_info_towns_left_sorted_by_name li span.player_name')), function(ind,elem){
340+
function addDetails(RCGP, itemId){
341+
if ((RCGP.getJQElement()).find($('#'+itemId+' li span.player_name a.gp_player_link')).length == 0) {
342+
$.each((RCGP.getJQElement()).find($('#'+itemId+' li span.player_name')), function(ind,elem){
348343
$.each(_towns,function(itown,etown){
349344
if(etown.player == $(elem).html()){
350345
$(elem).html(
@@ -380,44 +375,16 @@ function _RepConvGRC() {
380375
})
381376
})
382377
}
383-
if ((RCGP.getJQElement()).find($('#island_info_towns_left_sorted_by_score li span.player_name a.gp_player_link')).length == 0) {
384-
$.each((RCGP.getJQElement()).find($('#island_info_towns_left_sorted_by_score li span.player_name')), function(ind,elem){
385-
$.each(_towns,function(itown,etown){
386-
if(etown.player == $(elem).html()){
387-
$(elem)
388-
.html(
389-
hCommon.player(
390-
btoa(
391-
JSON.stringify({"name":etown.player,"id":etown.pid})
392-
.replace(/[\u007f-\uffff]/g,
393-
function(c) {
394-
return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4);
395-
}
396-
)
397-
),
398-
etown.player,
399-
etown.pid
400-
)
401-
)
402-
// alliance
403-
if (etown.player_alliance != null){
404-
$(elem)
405-
.parent()
406-
.append(
407-
$('<span/>',{'class':'small alliance_name grcrt_brackets'})
408-
.html(
409-
hCommon.alliance(
410-
'n',
411-
RepConvTool.getAllianceData(RepConvTool.getPlayerData(etown.pid).alliance_id).name,
412-
RepConvTool.getPlayerData(etown.pid).alliance_id
413-
)
414-
)
415-
)
416-
}
417-
}
418-
})
419-
})
420-
}
378+
}
379+
var
380+
WndName = (RCGP).getName(),
381+
WndId = '#' + WndName;
382+
if ((RCGP.getJQElement()).find($(WndId + 'RepConvTownButton')).length == 0) {
383+
// nazwy graczy jako linki
384+
var _towns = JSON.parse(RepConv.requests[RCGP.getController()].responseText).json.json.town_list;
385+
addDetails(RCGP, 'island_info_towns_left_sorted_by_name');
386+
addDetails(RCGP, 'island_info_towns_left_sorted_by_score');
387+
addDetails(RCGP, 'island_info_towns_left_sorted_by_player');
421388
// /nazwy graczy jako linki
422389
// new bbcode
423390
if ((RCGP.getJQElement()).find($('#BTNVIEWBB' + WndName)).length == 0) {
@@ -2585,7 +2552,7 @@ function _RepConvGRC() {
25852552
}
25862553

25872554
function colorizeMessageList(RCGP){
2588-
var __ally = {};
2555+
var __ally = {}, what;
25892556
if(RepConv.settings[RepConv.Cookie+'_mcol']){
25902557
__ally[Game.alliance_id]='OWN_ALLIANCE';
25912558
$.each(MM.getOnlyCollectionByName("AlliancePact").models, function(ii,ee){
@@ -2630,7 +2597,7 @@ function _RepConvGRC() {
26302597
}
26312598

26322599
function colorizeMessageView(RCGP){
2633-
var __ally = {};
2600+
var __ally = {}, what;
26342601
if(RepConv.settings[RepConv.Cookie+'_mcol']){
26352602
__ally[Game.alliance_id]='OWN_ALLIANCE';
26362603
$.each(MM.getOnlyCollectionByName("AlliancePact").models, function(ii,ee){
@@ -2771,7 +2738,7 @@ function _RepConvGRC() {
27712738
.attr('id','BTNCOMPARE')
27722739
.css({'margin': '0px', 'position': 'absolute', 'top': '0px', 'right': '1px'})
27732740
.click(function() {
2774-
var __ally = {leftAlly:[Game.alliance_id],rightAlly:[]}
2741+
var __ally = {leftAlly:[Game.alliance_id],rightAlly:[]}, what;
27752742
$.each(MM.getOnlyCollectionByName("AlliancePact").models, function(ii,ee){
27762743
if(!ee.getInvitationPending()){
27772744
switch (ee.getRelation()){

0 commit comments

Comments
 (0)