Difference between revisions of "Modding:Mod compatibility/barchart"

From Stardew Valley Wiki
Jump to navigation Jump to search
(+ script)
(combine ok + workaround, tweak text)
Line 1: Line 1:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| <div style="display: inline-block; width: {{#expr:{{{ok|0}}} * 2}}px; background: #9F9;">&nbsp;</div>
+
| <div style="display: inline-block; width: {{#expr:({{{ok|0}}} + {{{workaround|0}}}) * 2}}px; background: #9F9;">&nbsp;</div>
| {{{ok}}}% are compatible.
+
| {{#expr:{{{ok|0}}} + {{{workaround|0}}}}}% are compatible or have a working alternative.
|-
 
| <div style="display: inline-block; width: {{#expr:{{{workaround|0}}} * 2}}px; background: #CF9;">&nbsp;</div>
 
| {{{workaround}}}% can be replaced with a working alternative.
 
 
|-
 
|-
 
| <div style="display: inline-block; width: {{#expr:{{{soon|0}}} * 2}}px; background: #FF9;">&nbsp;</div>
 
| <div style="display: inline-block; width: {{#expr:{{{soon|0}}} * 2}}px; background: #FF9;">&nbsp;</div>
| {{{soon}}}% have an update coming soon.
+
| {{{soon|0}}}% have an update coming soon.
 
|-
 
|-
| <div style="display: inline-block; width: {{#expr:{{{broken|0}}} * 2}}px; background: #F99;">&nbsp;</div>
+
| <div style="display: inline-block; width: {{#expr:{{{broken|30}}} * 2}}px; background: #F99;">&nbsp;</div>
| {{{broken}}}% are currently broken (many due to Stardew Valley 1.1 or 1.2) and not open-source. Some of these may be updated by their authors.
+
| {{{broken|0}}}% are broken and not open-source.<br /><small>(Many of these broke in Stardew Valley 1.1 or 1.2. Some may be updated by their authors.)</small>
 
|}<noinclude>
 
|}<noinclude>
  

Revision as of 03:05, 19 July 2017

 
0% are compatible or have a working alternative.
 
0% have an update coming soon.
 
0% are broken and not open-source.
(Many of these broke in Stardew Valley 1.1 or 1.2. Some may be updated by their authors.)

Usage

List the percentage values for each group:

{{/barchart
  |ok         = 52
  |workaround = 23
  |soon       = 10
  |broken     = 15
}}

Script

This tiny script generates the template call when run from the parent page.

var ok = $("#mod-list tr[data-status='ok']").length;
var workaround = $("#mod-list tr[data-status='workaround']").length;
var soon = $("#mod-list tr[data-status='soon']").length;
var broken = $("#mod-list tr[data-status='broken']").length;

`
{{/barchart
  |ok         = ${ok}
  |workaround = ${workaround}
  |soon       = ${soon}
  |broken     = ${broken}
}}
`