Difference between revisions of "Modding:Mod compatibility/barchart"
Jump to navigation
Jump to search
Pathoschild (talk | contribs) (→Script: update for recent changes) |
Pathoschild (talk | contribs) (update script) |
||
Line 27: | Line 27: | ||
This tiny script generates the template call when run from the parent page. | This tiny script generates the template call when run from the parent page. | ||
<source lang="javascript"> | <source lang="javascript"> | ||
− | var entries = $("#mod-list | + | var entries = $("#mod-list .mod:not([data-status='abandoned'], [data-status='obsolete'])"); |
var ok = entries.filter("[data-status='ok'], [data-status='optional']").length; | var ok = entries.filter("[data-status='ok'], [data-status='optional']").length; | ||
− | var workaround = entries.filter("[data-status='workaround'], [data-status=' | + | var workaround = entries.filter("[data-status='workaround'], [data-status='unofficial']").length; |
var soon = entries.filter("[data-status='broken'][data-github], [data-status='broken'][data-custom-source]").length; | var soon = entries.filter("[data-status='broken'][data-github], [data-status='broken'][data-custom-source]").length; | ||
− | var broken = entries.filter("[data-status='broken']:not([data-github], [data-custom-source]) | + | var broken = entries.filter("[data-status='broken']:not([data-github], [data-custom-source])").length; |
var total = ok + workaround + soon + broken; | var total = ok + workaround + soon + broken; | ||
Line 48: | Line 48: | ||
|total = ${total} | |total = ${total} | ||
}} | }} | ||
− | `</source> | + | ` |
+ | </source> | ||
[[Category:Modding]]</noinclude> | [[Category:Modding]]</noinclude> |
Revision as of 05:06, 29 May 2018
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 counts for each group:
{{/barchart |ok = 135 |workaround = 33 |soon = 56 |broken = 33 |total = 257 }}
Script
This tiny script generates the template call when run from the parent page.
var entries = $("#mod-list .mod:not([data-status='abandoned'], [data-status='obsolete'])");
var ok = entries.filter("[data-status='ok'], [data-status='optional']").length;
var workaround = entries.filter("[data-status='workaround'], [data-status='unofficial']").length;
var soon = entries.filter("[data-status='broken'][data-github], [data-status='broken'][data-custom-source]").length;
var broken = entries.filter("[data-status='broken']:not([data-github], [data-custom-source])").length;
var total = ok + workaround + soon + broken;
if (total != entries.length) {
var unknown = entries.filter(":not([data-status='ok'], [data-status='optional'], [data-status='workaround'], [data-status='obsolete'], [data-status='broken'], [data-status='abandoned'])");
console.log("found entries with unknown status:", unknown);
throw 'script failed';
}
`
{{/barchart
|ok = ${ok}
|workaround = ${workaround}
|soon = ${soon}
|broken = ${broken}
|total = ${total}
}}
`