User:MACH-59330/wikia.js

// ChatConnect.2.js // Script styling mw.hook('dev.chatconnect.init').add(function(cc) {   cc.util.addCSS('/* ChatConnect.2.js (w:c:internal-community) */');    cc.util.addCSS( '.chatconnect__is-active .chatconnect__is-banned {' + 'background: hsla(0, 100%, 50%, 0.14);' + 'color: #8b0000;' + '}' +       '.chatconnect__is-active .chatconnect__is-banned:after {' + 'content: " [banned]";' + 'font-weight: bold;' + '}' +       '.chatconnect__is-active .chatconnect__is-in-chat {' + 'background: hsla(196, 56%, 50%, 0.14);' + 'color: #01579b;' + '}' +       '.chatconnect__is-active .chatconnect__is-in-chat:after {' + 'content: " [in chat]";' + 'font-weight: bold;' + '}'   ); }); // Script utilities mw.hook('dev.chatconnect.load').add(function(cc) {   if (Object.keys(cc.models.duplicates).length === 0) {        return;    }    var ip = {            'whois': 'http://myip.ms/info/whois/',            'block': '/wiki/Special:Block/',            'range64': '/wiki/Special:Block/'        },        user = {            'wall': '/wiki/Message Wall:',            'contribs': '/wiki/Special:Contributions/',            'check': '/wiki/Special:CheckUser?user=',            'ban': '/wiki/Special:Log/chatban?page=User:',            'blocks': '/wiki/Special:Log/block?user='        };    cc.ui.createLog({ name: 'duplicates', header: 'Duplicate results log' }).append( Object.keys(cc.models.duplicates).map(function(addr) {           return $('')                .html(addr + ' (' +                 Object.keys(ip).map(function(l) { var u = (l.substring(0, 5) === 'range') ? addr.replace(/\.(\d{1,3})$/, '') + '.0/' + l.substr(5) : addr; return '' + l + '' }).join(' | ') +               ')')                .append($('').append(                    cc.models.duplicates[addr].map(function(obj) { var u = obj.name, e = obj.$el, l = $('') .html(                                       e[0].firstChild.nodeValue +                                        e[0].childNodes[1].outerHTML +                                        ' (' + Object.keys(user).map(function(l) {                                           return '' + l + ''                                        }).join(' | ') + ')'                                   )                                    .attr('class', function {                                        if ( cc.models.chatlist.indexOf(u) > -1 || cc.models.banlist.indexOf(u) > -1 ) {                                           if (cc.models.banlist.indexOf(u) > -1) {                                                return 'chatconnect__is-banned';                                            } else if (cc.models.chatlist.indexOf(u) > -1) {                                                return 'chatconnect__is-in-chat';                                            }                                        }                                    }); return l;                   })                ))        }) ); }); // Chatconnect library (bootloader) importArticle({ type: 'script', article: 'u:dev:Chatconnect-js/code.js' }); console.log('this script has been shilo\'d');