diff --git a/src/gui/css/mainStyleSheet.tw b/src/gui/css/mainStyleSheet.tw index 3f1a6c542ca8df9f67ffd2098d70d07215464127..656cfc6d1c260d1b3350c1d7795dc6c9985387f8 100644 --- a/src/gui/css/mainStyleSheet.tw +++ b/src/gui/css/mainStyleSheet.tw @@ -99,6 +99,48 @@ object { top: 0; } +span.plusButton { + display: inline-block; + line-height: 25px; + width: 20px; + text-align: center; + border: 1px solid rgba(0, 139, 0, 0.3); + background: rgba(0, 139, 0, 0.2); + margin: 2px 0; +} + +span.minusButton { + display: inline-block; + line-height: 25px; + width: 20px; + text-align: center; + border: 1px solid rgba(184, 0, 0, 0.3); + background: rgba(184, 0, 0, 0.2); + margin: 2px 0; +} + +span.zeroButton { + display: inline-block; + line-height: 25px; + width: 20px; + text-align: center; + border: 1px solid rgba(0, 0, 255, 0.3); + background: rgba(0, 0, 255, 0.2); + margin: 2px 0; +} + +span.plusButton:hover { background: rgba(0, 139, 0, 0.4); } +span.minusButton:hover { background: rgba(184, 0, 0, 0.4); } +span.zeroButton:hover { background: rgba(0, 0, 255, 0.4); } + +span.plusButton > a { display: block; } +span.minusButton > a { display: block; } +span.zeroButton > a { display: block; } + +span.plusButton > a:hover { text-decoration: none; } +span.minusButton > a:hover { text-decoration: none; } +span.zeroButton > a:hover { text-decoration: none; } + /* Colors are made as css classes, to allow them to be changed for a light color scheme (for example). */ .link { color: #68D } /* link color */ diff --git a/src/pregmod/basenationalitiesControls.tw b/src/pregmod/basenationalitiesControls.tw index a8ad1c58c9240cd9becc595b2bfbd5cdda7f05fa..5f333709c3bc9102d485172fc8846d815be1d449 100644 --- a/src/pregmod/basenationalitiesControls.tw +++ b/src/pregmod/basenationalitiesControls.tw @@ -18,13 +18,13 @@ <<set $nationalitiescheck = _.uniq($nationalities, false).sort()>> /* Prints distribution of $nationalities, using $nationalitiescheck to render array */ -<<set _totalPercentage = 0>> +<<set _percentPerPoint = 100.0 / $nationalities.length>> <<for _i = 0; _i < $nationalitiescheck.length; _i++>> - <<set _nation = $nationalitiescheck[_i], _percentage = (($nationalities.count(_nation)/$nationalities.length)*100), _totalPercentage += _percentage>> - <<print _nation>> @@.orange;<<print _percentage.toFixed(2)>>%@@ + <<set _nation = $nationalitiescheck[_i]>> + _nation @@.orange;<<= ($nationalities.count(_nation) * _percentPerPoint).toFixed(2)>>%@@ <<if _i < $nationalitiescheck.length-1>> | <</if>> <</for>> -<<if _totalPercentage != 100>><br>//Percentages add up to _totalPercentage//<</if>> +<<unset _percentPerPoint>> <br><br> /* Fine control tweaking of populations */ @@ -69,35 +69,36 @@ Filter by Region: <</for>> <br style="clear:both" /><hr style="margin:0"> +<div style="white-space: nowrap"> /* Unfiltered pop controls */ <<if $baseControlsFilter == "all">> <<for _i = 0; _i < setup.baseNationalities.length; _i++>> <<set _nation = setup.baseNationalities[_i]>> <<print " _nation - <<link '+'>> + @@.plusButton;<<link '+'>> <<set $nationalities.push(setup.baseNationalities[" + _i + "])>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <<if $nationalitiescheck.includes(_nation) > 0 >> <<print " - <<link '–'>> + @@.minusButton;<<link '–'>> <<set $nationalities.deleteAt(($nationalities.indexOf(setup.baseNationalities[" + _i + "])))>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <</if>> <<if $nationalities.count(_nation) > 1 >> <<print " - <<link '0'>> + @@.zeroButton;<<link '0'>> <<set $nationalities.delete(setup.baseNationalities[" + _i + "])>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <</if>> <<if _i < setup.baseNationalities.length-1>> - | + |<wbr> <</if>> <</for>> <<else>> @@ -107,29 +108,30 @@ Filter by Region: <<set _nation = _controlsNationality[_i]>> <<print " _nation - <<link '+'>> + @@.plusButton;<<link '+'>> <<set $nationalities.push(_controlsNationality[" + _i + "])>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <<if $nationalitiescheck.includes(_nation) > 0 >> <<print " - <<link '–'>> + @@.minusButton;<<link '–'>> <<set $nationalities.deleteAt(($nationalities.indexOf(_controlsNationality[" + _i + "])))>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <</if>> <<if $nationalities.count(_nation) > 1 >> <<print " - <<link '0'>> + @@.zeroButton;<<link '0'>> <<set $nationalities.delete(_controlsNationality[" + _i + "])>> <<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>> - <</link>> + <</link>>@@ ">> <</if>> <<if _i < _controlsNationality.length-1>> - | + |<wbr> <</if>> <</for>> -<</if>> \ No newline at end of file +<</if>> +</div> \ No newline at end of file