User:Monster Domosed/common.js: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| Line 110: | Line 110: | ||
} | } | ||
function selectIcon(iconId) { | // ✅ FIXED: prevents redundant saves but allows infection override | ||
function selectIcon(iconId, force) { | |||
var currentIcon = getCachedIcon() || 'rem'; | |||
if (!force && currentIcon === iconId) { | |||
return; | |||
} | |||
setCachedIcon(iconId); | setCachedIcon(iconId); | ||
applyIcon(iconId); | applyIcon(iconId); | ||
| Line 194: | Line 201: | ||
var iconId = $(this).data('icon'); | var iconId = $(this).data('icon'); | ||
// infection forces helper | |||
if (isInfected) { | if (isInfected) { | ||
iconId = 'rem-helper'; | iconId = 'rem-helper'; | ||
| Line 199: | Line 207: | ||
var msg = buddyMessages[Math.floor(Math.random() * buddyMessages.length)]; | var msg = buddyMessages[Math.floor(Math.random() * buddyMessages.length)]; | ||
mw.notify(msg, { type: 'success' }); | mw.notify(msg, { type: 'success' }); | ||
selectIcon(iconId, true); | |||
return; | |||
} | } | ||
if (iconId === 'rem' | // rem click counter | ||
if (iconId === 'rem') { | |||
remClickCount++; | remClickCount++; | ||