Template:Disambiguation/doc: Difference between revisions

Updated script to exclude any non-equipment items when returning equipment table template
m (Swapped version and disam templates in script)
(Updated script to exclude any non-equipment items when returning equipment table template)
Line 9: Line 9:
// Settings //
// Settings //
let searchTerm = 'Siren'; // The proper capitalization of the search term
let searchTerm = 'Siren'; // The proper capitalization of the search term
let returnEquipmentTemplate = false; // returns a template for {{EquipmentTableFromList}} instead
let returnEquipmentTemplate = true; // returns a template for {{EquipmentTableFromList}} instead
// End of Settings //
// End of Settings //
let lcSearchTerm = searchTerm.toLowerCase();
let lcSearchTerm = searchTerm.toLowerCase();
Line 22: Line 22:
if (obj.arr.length > 0 && !returnEquipmentTemplate && obj.header !== '')
if (obj.arr.length > 0 && !returnEquipmentTemplate && obj.header !== '')
results.push(obj.header);
results.push(obj.header);
obj.arr.forEach(item => results.push(wikiIcon(item, obj.iconType, obj.extras || '')));
obj.arr.forEach(item => {
if (!returnEquipmentTemplate || item.validSlots !== undefined)
results.push(wikiIcon(item, obj.iconType, obj.extras || ''))
});
}
}
let results = [];
let results = [];
Line 50: Line 53:
if (returnEquipmentTemplate) outputString += '\n}}';
if (returnEquipmentTemplate) outputString += '\n}}';
copy(outputString);console.log(outputString);
copy(outputString);console.log(outputString);
notifyPlayer(game.attack, `Copied results for ${searchTerm} to clipboard`, 'success', 0)
notifyPlayer(game.attack, `Copied results for ${searchTerm} to clipboard`, 'success', 0);
</syntaxhighlight>
</syntaxhighlight>