MediaWiki:MastheadRightsBadge.js

/** * * @module                  MastheadRightsBadge * @description            Adds WDS avatar badges to user profiles. * @author                 Americhino * @version                0.8.1 * @license                CC-BY-SA 3.0 * */ var groups = (data.query.users[0] || {}).groups || []; new mw.Api.get({ action: 'query',  list: 'users',  usprop: 'groups',  ususers: mw.config.get('wgTitle') }).then(function (data) { // Global Groups    // Staff    if (groups.indexOf('staff') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10030',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-staff.svg' })           )        );    }    // Helpers    else if (groups.indexOf('helper') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10028',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-helper.svg' })           )        );    }    // VSTF    else if (groups.indexOf('vstf') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10026',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-vstf.svg' })           )        );    }    // GDM    else if (groups.indexOf('global-discussions-moderator') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10024',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-global-discussions-moderator.svg' })           )        );    } // Local Groups    // Admins    else if (groups.indexOf('sysop') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10022',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-admin.svg' })           )        );    }    // Content Moderators    else if (groups.indexOf('content-moderator') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10020',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-content-moderator.svg' })           )        );    }    // Discussions Moderators    else if (groups.indexOf('threadmoderator') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10018',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-discussions-moderator.svg' })           )        );    }    // Chat Moderators    else if (groups.indexOf('chatmoderator') !== -1) {        $('.UserProfileMasthead .masthead-avatar').prepend( $(' ', {               'class': 'badge',                css: {                    height: '50px',                    position: 'absolute',                    left: '0',                    top: '0',                    width: '50px',                    zIndex: '10016',                }            }).append(                $(' ', { 'src': '/extensions/wikia/DesignSystem/node_modules/design-system/dist/svg/wds-avatar-badges-discussions-moderator.svg' })           )        );    } })