4,683
edits
(Updated documentation. Added currencies and gamemodes to the output. Changed script to a function so it's a bit easier to run subsequent searches) |
mNo edit summary |
||
Line 3: | Line 3: | ||
The below script will search all current [[Template:Icon|Icon Templates]] in v1.3.1 (except for Synergies) for the given <code>searchTerm</code> then output an array of the results in valid Icon Template format with expansion icons. This may result in some duplicates between ItemIcons and UpdateIcons, such as Iron Sieve which is both an Item and Purchase. | The below script will search all current [[Template:Icon|Icon Templates]] in v1.3.1 (except for Synergies) for the given <code>searchTerm</code> then output an array of the results in valid Icon Template format with expansion icons. This may result in some duplicates between ItemIcons and UpdateIcons, such as Iron Sieve which is both an Item and Purchase. | ||
To use the script, copy and paste the script into the console. The script can then be run with <code>disambiguation(searchTerm, returnEquipmentTemplate)</code> where <code>searchTerm</code> is the disambiguation page you're about to create (with proper capitalization) and <code>returnEquipmentTemplate</code> is a Boolean (true/false) for whether you want to return a template for [[Template:EquipmentTableFromList/doc]] instead. | To use the script, copy and paste the script into the console. The script can then be run with <code>disambiguation(searchTerm, returnEquipmentTemplate)</code> where <code>searchTerm</code> is the disambiguation page you're about to create (with proper capitalization) and <code>returnEquipmentTemplate</code> is a Boolean (true/false) for whether you want to return a template for [[Template:EquipmentTableFromList/doc]] instead, defaulting to false. | ||
Upon running the function, the outputs will be pasted into the console while also being copied to the clipboard. If the results look good (more than a single item) then begin creating the disambiguation page. The results should be manually checked for any erroring or incorrect templates before creating the page. | Upon running the function, the outputs will be pasted into the console while also being copied to the clipboard. If the results look good (more than a single item) then begin creating the disambiguation page. The results should be manually checked for any erroring or incorrect templates before creating the page. | ||
Line 10: | Line 10: | ||
<syntaxhighlight lang="javascript" line> | <syntaxhighlight lang="javascript" line> | ||
function disambiguation(searchTerm, returnEquipmentTemplate) { | function disambiguation(searchTerm, returnEquipmentTemplate=false) { | ||
const search = (item) => !item.isModded && item.name.toLowerCase().includes(searchTerm.toLowerCase()); | const search = (item) => !item.isModded && item.name.toLowerCase().includes(searchTerm.toLowerCase()); | ||
const wikiIcon = (item, icon, extras, postText) => { | const wikiIcon = (item, icon, extras, postText) => { |