User:CanonNi/Scripts/VoteVisualizer.js: Difference between revisions

Content deleted Content added
Created page with 'const shortConfig = { 'support agree endorse accept good_block' : '9/94/Symbol_support_vote.svg', 'keep allow permit' : 'd/d0/Symbol_keep_vote.svg', 'oppose disagree overturn object disallow decline bad_block oppositi...'
 
fix?
 
(2 intermediate revisions by the same user not shown)
Line 56:
Object.entries(shortConfig).forEach(([key, value]) => {
key.split(' ').forEach((keyword) => {
longConfig[keyword.replace('_', ' ')] = value;
});
});
Line 68:
const voteSymbol =
longConfig[
boldWord.toLowerCase().replace(/[.,!:;+]/g, '')
];
if (voteSymbol) {
boldElement.innerHTMLconst imageUrl = `<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/${voteSymbol}/30px-${voteSymbol}${.replace(
voteSymbol/.includes.\/..\/('.svg'*) ? '.png' : ''/,
}" alt="${boldElement} vote" height="15" /> '${boldElement}`;1'
)}`;
const finalUrl = voteSymbol.endsWith('.svg') ? `${imageURL}.png`: imageUrl
boldElement.innerHTML = `<img src="${finalUrl}" alt="${boldElement.textContent} vote" height="15" /> ${boldElement.innerHTML}`;
}
});