User:Monster Domosed/common.js: Difference between revisions

No edit summary
No edit summary
Line 110: Line 110:
     }
     }


    // ✅ FIXED: prevents redundant saves but allows infection override
     function selectIcon(iconId, force) {
     function selectIcon(iconId, force) {
         var currentIcon = getCachedIcon() || 'rem';
         var currentIcon = getCachedIcon() || 'rem';
Line 145: Line 144:
         $el.find('span').text('Rem Helper');
         $el.find('span').text('Rem Helper');
         $el.addClass('infected');
         $el.addClass('infected');
        // ✅ FIX: keep selected border synced
        if (getCachedIcon() === 'rem-helper') {
            $('.usericon-option').removeClass('selected');
            $el.addClass('selected');
        }
     }
     }


Line 201: Line 206:
             var iconId = $(this).data('icon');
             var iconId = $(this).data('icon');


            // infection forces helper
             if (isInfected) {
             if (isInfected) {
                 iconId = 'rem-helper';
                 iconId = 'rem-helper';
Line 207: Line 211:
                 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' });
                $('.usericon-option').removeClass('selected');
                $(this).addClass('selected');


                 selectIcon(iconId, true);
                 selectIcon(iconId, true);
Line 212: Line 219:
             }
             }


            // rem click counter
             if (iconId === 'rem') {
             if (iconId === 'rem') {
                 remClickCount++;
                 remClickCount++;