User:MACH-59330/common.js

/* classification thing */ if (mw.config.get('wgCanonicalNamespace') == 'Template') { require(['mw', 'wikia.nirvana'], function(mw, nirvana) {       var types = {            192: 'infobox', // `            49: 'quote', // 1            50: 'navbox', // 2            51: 'notice', // 3            52: 'context-link', // 4            53: 'infoicon', // 5            54: 'scrollbox', // 6            55: 'references', // 7            56: 'media', // 8            57: 'data', // 9            48: 'design', // 0            189: 'navigation', // -            187: 'nonarticle' // =        };        document.addEventListener('keyup', function(event) { var type = types[event.which || event.keyCode]; nirvana.sendRequest({               controller: 'TemplateClassificationApi',                method: 'classifyTemplate',                data: {                    pageId: mw.config.get('wgArticleId'),                    type: type,                    editToken: mw.user.tokens.values.editToken                },                callback: function {                    document.getElementsByClassName('template-classification-type-label')[0].innerHTML = type;                    var notification = new BannerNotification('Successfully changed template type to: ' + type, 'confirm');                    notification.show;                }            }); });   }); }