Add <pokemonicon> and <itemicon> (#944)

This commit is contained in:
Bär Halberkamp
2017-06-15 22:32:24 -04:00
committed by Guangcong Luo
parent 5c5c57870e
commit 41a9c54cfc

View File

@@ -786,7 +786,16 @@ var Tools = {
return {attribs: attribs};
};
return function (input) {
return html.sanitizeWithPolicy(getString(input), tagPolicy);
// Implement <pokemonicon> and <itemicon>
input = getString(input).replace(/<(pokemon|item)icon>([^<]*)<\/\1icon>/g, function (match, p1, p2) {
if (p1 === 'pokemon') {
return '<span class="picon" style="display:inline-block;' + Tools.getPokemonIcon(p2) + '"></span>';
} else if (p1 === 'item') {
return '<span class="itemicon" style="display:inline-block;' + Tools.getItemIcon(p2) + '"></span>';
}
});
return html.sanitizeWithPolicy(input, tagPolicy);
};
})(),