Skip to content

Commit c90d532

Browse files
committed
extra tagger settings
1 parent 21ce62a commit c90d532

8 files changed

Lines changed: 103 additions & 67 deletions

File tree

source/config/trans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ trans = {
101101

102102
activatePackageWithCompatibility: "Sangu Package (v{version}) mogelijk incompatibel met huidige TW versie",
103103
firstTimeRun: "<b>Welkom!</b> Het Sangu Package is momenteel inactief. Klik op de nieuwe {img} naast de opslagplaats hierboven om het package aan en uit te schakelen.",
104+
firstTimeRunEditSettings: "Klik op de nieuwe 'Sangu Package' link om het package naar jouw smaak in te stellen!",
104105
removeScriptWarning: "Niet meer tonen"
105106
},
106107
all: {
@@ -156,7 +157,6 @@ trans = {
156157
slowestTip: "Traagste eenheid in het dorp",
157158
allAbove: "Alle vroegere aanvallen aanvinken",
158159
allBelow: "Alle latere aanvallen aanvinken",
159-
prefix: "Prefix? ",
160160
renameTo: "Hernoemen naar: ",
161161
switchModus: "&raquo; Alle aanvallen openen/sluiten",
162162
checkAllAttacks: "Aanvinken van alle zichtbare aanvallen",

source/config/user_data.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,14 @@ if (user_data !== '') {
107107
autoOpen: true,
108108
inputBoxWidth: 300,
109109
defaultDescription: "OK",
110-
otherDescriptions:
110+
otherDescs:
111111
[
112-
{ name: "DODGE THIS", prefix: true },
113-
{ name: "NIGHTBONUS", prefix: false },
114-
{ name: "CHECK STACK", prefix: true },
115-
{ name: "TIME IT!", prefix: true },
116-
{ name: "NOBLE!!", prefix: true }
112+
{ active: true, name: "Dodgen", renameTo: "----------------------------------------- DODGE THIS" },
113+
{ active: true, name: "Nacht", renameTo: "NIGHTBONUS" },
114+
{ active: true, name: "Check stack", renameTo: "----------------------------------------- CHECK STACK" },
115+
{ active: true, name: "Timen!", renameTo: "***************************************** TIME IT!" },
116+
{ active: true, name: "Edelen!", renameTo: "----------------------------------------- NOBLE!!" }
117117
],
118-
prefix: "-----------------------------------------",
119118
autoOpenCommands: false,
120119
minutesDisplayDodgeTimeOnMap: 3,
121120
minutesWithoutAttacksDottedLine: 3 * 60,

source/global/activator.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ $("#storage").parent()
4040

4141
// First time run message - Position beneath resource/storage display
4242
if (!isSanguActive) {
43-
var position = $("#storage").position();
44-
var options = {
45-
left: position.left - 150,
46-
top: position.top + 35
47-
};
48-
var content = {body: trans.sp.sp.firstTimeRun.replace("{img}", "<img src='graphic/dots/red.png' />")};
49-
createFixedTooltip("sanguActivatorTooltip", content, options);
43+
(function() {
44+
var position = $("#storage").position(),
45+
options = {
46+
left: position.left - 150,
47+
top: position.top + 35
48+
},
49+
content = {body: trans.sp.sp.firstTimeRun.replace("{img}", "<img src='graphic/dots/red.png' />")};
50+
51+
createFixedTooltip("sanguActivatorTooltip", content, options);
52+
}());
5053
}

source/page/overview_mainvillage/tagger.js

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ if (incomingTable.size() == 1 || outgoingTable.size() == 1) {
3636
dodgeMenu += '<img src="graphic/command/support.png" alt="" id="checkSupport" title="' + trans.sp.tagger.checkAllSupport + '" />';
3737
dodgeMenu += "&nbsp;";
3838
dodgeMenu += '<img src="graphic/command/return.png" alt="" id="uncheckSupport" title="' + trans.sp.tagger.uncheckAllSupport + '" />';
39-
dodgeMenu += "<th colspan=3><input type=checkbox id=prefixInput>" + trans.sp.tagger.prefix;
40-
dodgeMenu += " | ";
41-
dodgeMenu += trans.sp.tagger.renameTo + "<input type=textbox doPrefix='false' size=30 id=commandInput value='" + user_data.mainTagger.defaultDescription + "'></th>";
39+
dodgeMenu += "<th colspan=3>";
40+
dodgeMenu += trans.sp.tagger.renameTo + "<input type=textbox size=30 id=commandInput value='" + user_data.mainTagger.defaultDescription + "'></th>";
4241
dodgeMenu += "<th>" + trans.sp.tagger.slowest + "</th>";
4342
dodgeMenu += "</td>";
4443
dodgeMenu += "<td colspan=1 id=slowestUnitCell>";
@@ -47,9 +46,6 @@ if (incomingTable.size() == 1 || outgoingTable.size() == 1) {
4746
}
4847
dodgeMenu += "</td></tr>";
4948
incomingTable.find("tbody:first").prepend(dodgeMenu);
50-
$("#prefixInput").change(function () {
51-
$("#commandInput").attr("doPrefix", $(this).attr("checked") == "checked");
52-
});
5349

5450
// checkbox manipulation
5551
$("#uncheckSupport").click(function () {
@@ -60,31 +56,8 @@ if (incomingTable.size() == 1 || outgoingTable.size() == 1) {
6056
$("input.incSupport", incomingTable).attr("checked", true);
6157
});
6258

63-
function isDefaultTagName(currentDesc) {
64-
if (user_data.mainTagger.defaultDescription == currentDesc) {
65-
return true;
66-
}
67-
else if (user_data.mainTagger.otherDescriptions != null && user_data.mainTagger.otherDescriptions != false) {
68-
var isDefault = false;
69-
$.each(user_data.mainTagger.otherDescriptions,function (index, val) {
70-
if (val.name == currentDesc || user_data.mainTagger.prefix + val.name == currentDesc) {
71-
isDefault = true;
72-
}
73-
});
74-
return isDefault;
75-
}
76-
return false;
77-
}
78-
7959
var buttonParent = $("#commandInput").parent();
80-
function renameCommand(commandName, addPrefix) {
81-
if (addPrefix == "true") {
82-
commandName = user_data.mainTagger.prefix + commandName;
83-
}
84-
else if (addPrefix != "false") {
85-
commandName = prefix + commandName;
86-
}
87-
60+
function renameCommand(commandName) {
8861
var dodgeCell = null;
8962
$("input.taggerCheckbox", incomingTable).each(function () {
9063
if ($(this).attr("checked")) {
@@ -112,23 +85,23 @@ if (incomingTable.size() == 1 || outgoingTable.size() == 1) {
11285
button.click(function () {
11386
trackClickEvent("MainTagger-CustomRename");
11487
var tagName = $("#commandInput").val();
115-
var pref = $("#commandInput").attr("doPrefix");
116-
renameCommand(tagName, pref);
88+
renameCommand(tagName);
11789
});
11890
buttonParent.append(button);
11991

120-
if (user_data.mainTagger.otherDescriptions != null && user_data.mainTagger.otherDescriptions != false) {
92+
if (user_data.mainTagger.otherDescs != null && user_data.mainTagger.otherDescs != false) {
12193
// custom buttons
122-
$.each(user_data.mainTagger.otherDescriptions, function (index, val) {
123-
var button = $("<input type=button doPrefix='" + val.prefix + "' value='" + val.name + "'>").click(
124-
function () {
125-
// Cannot use input:checked : this works for Firefox but there is a bug in Opera
126-
trackClickEvent("MainTagger-ConfigRename");
127-
var tagName = $(this).attr("value");
128-
var prefix = $(this).attr("doPrefix");
129-
renameCommand(tagName, prefix);
130-
});
131-
buttonParent.append(button);
94+
$.each(user_data.mainTagger.otherDescs, function (index, val) {
95+
if (val.active) {
96+
var button = $("<input type=button data-rename-to='" + val.renameTo + "' value='" + val.name + "'>").click(
97+
function () {
98+
// Cannot use input:checked : this works for Firefox but there is a bug in Opera
99+
trackClickEvent("MainTagger-ConfigRename");
100+
renameCommand($(this).data("rename-to"));
101+
});
102+
103+
buttonParent.append(button);
104+
}
132105
});
133106
}
134107

source/page/settings/sangu/sangu_config.js

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,8 @@ var user_data_configs = (function() {
273273
}
274274

275275
if (showConfigs) {
276-
user_data_configs.push({
277-
id: "mainTagger",
278-
title: sangu_trans.mainTagger.title,
279-
save: sangu_saver,
280-
properties: {
276+
(function() {
277+
var properties = {
281278
activate: {
282279
label: sangu_trans.global.resources.activate,
283280
propUI: {
@@ -342,13 +339,59 @@ var user_data_configs = (function() {
342339
setter: function(value) { user_data.mainTagger.defaultDescription = value; },
343340
editor: "text"
344341
}
342+
},
343+
otherButtonsTitle: {
344+
type: "subtitle",
345+
label: sangu_trans.mainTagger.otherButtons.title
345346
}
347+
};
346348

349+
for (var i = 0; i < user_data.mainTagger.otherDescs.length; i++) {
350+
(function() {
351+
var otherDescription = user_data.mainTagger.otherDescs[i];
347352

353+
properties['otherButton'+i] = {
354+
type: "subtitle",
355+
label: sangu_trans.mainTagger.otherButtons.title + ": " + otherDescription.name
356+
}
348357

358+
properties['otherButtonActive'+i] = {
359+
label: sangu_trans.global.resources.activate,
360+
propUI: {
361+
getter: function() { return otherDescription.active; },
362+
setter: function(value) { otherDescription.active = value; },
363+
editor: "bool"
364+
}
365+
}
349366

367+
properties['otherButtonName'+i] = {
368+
label: sangu_trans.mainTagger.otherButtons.button,
369+
propUI: {
370+
getter: function() { return otherDescription.name; },
371+
setter: function(value) { otherDescription.name = value; },
372+
editor: "text|width=10"
373+
}
374+
}
375+
376+
properties['otherButtonDesc'+i] = {
377+
label: sangu_trans.mainTagger.otherButtons.renameTo,
378+
propUI: {
379+
getter: function() { return otherDescription.renameTo; },
380+
setter: function(value) { otherDescription.renameTo = value; },
381+
editor: "text|width=50"
382+
}
383+
}
384+
}());
350385
}
351-
});
386+
387+
388+
user_data_configs.push({
389+
id: "mainTagger",
390+
title: sangu_trans.mainTagger.title,
391+
save: sangu_saver,
392+
properties: properties
393+
});
394+
}());
352395
}
353396

354397
if (showConfigs) {

source/page/settings/sangu/sangu_trans.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ var sangu_trans = (function() {
166166
minutesDisplayDodgeTimeOnMap: "Aantal minuten dat de laatste dodgetijd op de kaart getoond wordt",
167167
minutesDisplayDodgeTimeOnMapTooltip: "De laatste dodgetijd is de tijd van het laatste bevel, aangeduidt met gewijzigde achtergrondkleur na het herbenoemen van binnenkomende aanvallen.",
168168
minutesWithoutAttacksDottedLine: "Elke zoveel minuten zonder een tussenliggende binnenkomende aanval aanduiden met een stippelijn (180 = 3 uur)",
169-
colorSupport: "Binnenkomende ondersteuning een andere achtergrondkleur geven"
169+
colorSupport: "Binnenkomende ondersteuning een andere achtergrondkleur geven",
170+
otherButtons: {
171+
title: "Andere hernoemings knoppen",
172+
renameTo: "Hernoemen naar",
173+
button: "Tekst knop"
174+
}
170175
},
171176
confirm: {
172177
title: "Bevel comfirmatie pagina",

source/start.user.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,20 @@
202202
//<!--@@INCLUDE "overviews\allpages.js" INDENT=3 //-->
203203
}
204204

205-
$("#footer_left").append(" - <a target='_top' href='"+getUrlString("screen=settings&mode=sangu")+"'>Sangu Package</a>");
205+
$("#footer_left").append(" - <a target='_top' id='sanguPackageEditSettingsLink' href='"+getUrlString("screen=settings&mode=sangu")+"'>Sangu Package</a>");
206+
207+
(function() {
208+
var position = $("#sanguPackageEditSettingsLink").position(),
209+
options = {
210+
left: position.left,
211+
top: ($(window).height() - 100)
212+
},
213+
content = {
214+
body: trans.sp.sp.firstTimeRunEditSettings
215+
};
216+
217+
createFixedTooltip("sanguActivatorSettingsTooltip", content, options);
218+
}());
206219

207220
//<!--@@INCLUDE "global\resourcecoloring.js" INDENT=2 //-->
208221
//<!--@@INCLUDE "global\incomingsindicator.js" INDENT=2 //-->

source/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.126
1+
4.2.10

0 commit comments

Comments
 (0)