Thread:Gameuser10/@comment-5036232-20140201043728

JS: /** * Chat stuff *  By User:AnimatedCartoons * * RESURRECTED FROM THE DEAD!!! >:D */ // Recent changes notification (part 1 of 3) var notifyChanges = function (d) { var name = d.query.recentchanges[0].user, title = d.query.recentchanges[0].title, comment = d.query.recentchanges[0].comment, revid = d.query.recentchanges[0].revid, title2 = title.replace(/\?/g, '%3F'), comment2 = comment.replace(/"/g, '\''),           name2;

if (name === mw.config.get('wgUserName')) { name2 = 'You'; } else { name2 = '' + name + ''; }

$('.watchlist').html(name2 + ' changed ' + title + ' (diff)'); };

(function ($, mw) {   "use strict";    // Variables    var un = mw.config.get('wgUserName'),        ttl = 'Chat — TAWoG Wiki',        wk = 'http://theamazingworldofgumball.wikia.com',        ytmnthnm = [            'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'        ],        ytname;

if (mw.config.get('wgCanonicalSpecialPageName') === 'Chat') { if (localStorage.getItem('notify') !== 'november') { $.showCustomModal(' Chat stuff is back! :3', ' Additions Notify recent changes from your selected wiki Timestamp now shows seconds

Changes Due to new changes of YouTube comments, embedded comments only show the most popular comments and not the most recent comments Due to new changes of YouTube comments, commenters\' avatars are outdated

#animatedcartoons ', {               id: 'notify', buttons: [ {                       defaultButton: true, message: 'OK', handler: function { $('#notify').closeModal; }                   }                ]            });            localStorage.setItem('notify', 'november');        }

importStylesheet('User:AnimatedCartoons/chat.css');

// Descriptive title document.title = ttl;

// Show own username on the list $('li#user-' + un).attr('style', 'display: block !important');

// Recent changes notification (part 2 of 3) if (!localStorage.getItem('notifyChanges')) { localStorage.setItem('notifyChanges', wk); }

var watchList = function { if (localStorage.getItem('notifyChanges') === wk) { $.getJSON(wk + '/api.php', {                       action: 'query',                        list: 'recentchanges',                        rclimit: 1,                        rcdir: 'older',                        rctype: 'edit',                        rcprop: 'ids|user|title|comment',                        format: 'json'                    }, function (data) {                        var name = data.query.recentchanges[0].user,                            title = data.query.recentchanges[0].title,                            comment = data.query.recentchanges[0].comment,                            revid = data.query.recentchanges[0].revid,                            title2 = title.replace(/\?/g, '%3F'),                            comment2 = comment.replace(/"/g, '\''),                            name2;

if (name === un) { name2 = 'You'; } else { name2 = '' + name + ''; }

$('.watchlist').html(name2 + ' changed ' + title + ' (diff)'); });               } else {                    mw.loader.load(localStorage.getItem('notifyChanges') + '/api.php?action=query&list=recentchanges&rclimit=1&rcprop=ids|user|title|comment&rcdir=older&rctype=edit&format=json&callback=notifyChanges');                }            };

$(function {            $('.ChatHeader').append(' ');            watchList;        });

setInterval(watchList, 20000);

// Messages and users count $('.Rail h1.wordmark').before('         ');

setInterval(function {            // Messages count            $('.messages').html($('#Chat_' + mw.config.get('roomId') + ' .message').length);

// Users count $('.users').html($('.WikiChatList li.User:not(.ui-sortable-placeholder)').length); }, 1);

// Bug fixes var bgfxs = function (chat) { $('.continued:first-child').removeClass('continued'); $('.inline-alert').next('li.continued:not(.inline-alert)').removeClass('continued'); };

mainRoom.model.chats.bind('afteradd', bgfxs);

var rlct = setInterval(function {                if ($('.WikiaSearch').length) {                    $('.WikiaSearch').css('left', '250px');                    clearInterval(rlct);                }            }, 1);

// Removals var rmv = setInterval(function {                if ($('.chattopic').length) {                    $('.chattopic').remove;                    clearInterval(rmv);                }            }, 1);

// Rearrange list of users $('.WikiChatList').wrap(' '); $('.PrivateChatList').wrap(' ');

mw.loader.using('jquery.ui.sortable', function {            $('.WikiChatList').sortable({ revert: true, containment: '#WikiChat', handle: 'img', axis: 'y', cursor: 'ns-resize', start: function (e, ui) { ui.placeholder.height(ui.item.height); }           });

$('.PrivateChatList').sortable({               revert: true,                containment: '#PrivateChat',                handle: 'img',                axis: 'y',                cursor: 'ns-resize',                start: function (e, ui) {                    ui.placeholder.height(ui.item.height);                }            }); });

$('.WikiChatList, .PrivateChatList').on('click', 'li.User', function {            // Link to user's user page            $('.info .username').each(function  { var user = $(this).text, user2 = user.replace(/\?/g, '%3F'); $(this).replaceWith(' ' + user + '</li>'); });

// Link to user's contributions count $('.info .edits').each(function {                var user = $(this).siblings('.username').text,                    user2 = user.replace(/\?/g, '%3F');                $(this).replaceWith(' ' + $(this).text + '</a></li>');            }); });

// Custom actions and links $('.WikiChatList').on('click', 'li#user-' + un, function {            if (!$('.custom').length) {                $(this).children('.UserStatsMenu').children('.actions').prepend(' <li> Ignore users...</a></li><li> Notify changes...</a></li> <li>Recent activity</a></li><li>All activity</a></li><li>Preferences</a></li></ul> ');            }        });

// Ignore users var aa = JSON.parse(localStorage.getItem('block')), bb, i;       if (!localStorage.getItem('block') || localStorage.getItem('block') === 'undefined') { bb = ''; } else { for (i in aa) { if (aa.hasOwnProperty(i)) { $('head').append('<style type="text/css" id="block4">.Chat li[data-user="' + aa[i] + '"]{display: none;}.Rail li[data-user="' + aa[i] + '"] span.username{text-decoration: line-through !important;} '); }           }        }

$('body').on('click', '.ignore', function {            if (localStorage.getItem('block')) {                aa = JSON.parse(localStorage.getItem('block'));                bb = aa.join('\n');            }

$.showCustomModal('Ignore users', ' Please enter the user(s) you want to ignore. Case sensitive; separated by Enter. Ignored users have a strikethrough . <textarea id="block2" autofocus="autofocus" style="height: 300px; width: 400px; resize: none;">' + bb + ' ', {               id: 'block3',                buttons: [                    {                        message: 'Cancel',                        handler: function  {                            $('#block3').closeModal;                        }                    }, {                        message: "Clear",                        handler: function  {                            $('#block2').val('');                        }                    }, {                        defaultButton: true,                        message: 'Ignore',                        handler: function  {                            var a = $('#block2').val, b = a.split('\n'), c;

for (i = b.length; i--;) { if (b[i] === '') { b.splice(i, 1); }

if (b[i] === un) { b.splice(i, 1); }                           }

c = b.filter(function (elem, pos) {                               return b.indexOf(elem) === pos;                            });

localStorage.setItem('block', JSON.stringify(c));

$('head #block4').each(function {                                $(this).remove;                            });

for (var j = 0; j < c.length; j++) { $('head').append('<style type="text/css" id="block4">.Chat li[data-user="' + c[j] + '"]{ display: none; } .Rail li[data-user="' + c[j] + '"] span.username{ text-decoration: line-through !important; } '); }

$('#block3').closeModal; mainRoom.viewDiscussion.scrollToBottom; }                   }                ]            });

// Hide }).on('click', '.info li a, .custom li a', function { $('.UserStatsMenu').hide;

// Recent changes notification (part 3 of 3) }).on('click', '.changes', function { $.showCustomModal('Notify changes', ' Please enter the wiki you want its changes to be notified to you, in lowercase. Notifications from your specified wiki will appear within 20 seconds. <input id="change" autofocus="autofocus" placeholder="' + localStorage.getItem('notifyChanges').replace('http://', ).replace('.wikia.com', ) + '" style="width: 400px;"> ', {               id: 'change2',                buttons: [                    {                        message: 'Cancel',                        handler: function  {                            $('#change2').closeModal;                        }                    }, {                        defaultButton: true,                        message: 'Change',                        handler: function  {                            if ($('#change').val) {                                localStorage.setItem('notifyChanges', 'http://' + $('#change').val + '.wikia.com'); $('#change2').closeModal; }                       }                    }                ]            });        });

ChatView.prototype.render = function (type) { if (this.model.get('text') === '') { var params = this.model.get('msgParams'); params.unshift(this.model.get('wfMsg')); var i18nText = $.msg.apply(null, params); this.model.set({                   text: i18nText                }); }

var msg = this.model.toJSON, originalTemplate = this.template;

msg.text = this.processText(msg.text, this.model.get('isInlineAlert'));

if (this.model.get('isInlineAlert')) { this.template = this.inlineTemplate; $(this.el).html(this.template(msg)); this.template = originalTemplate; } else { if (msg.text.indexOf('/me ') === 0) { msg.text = msg.text.substr(4); this.template = this.meMessageTemplate; $(this.el).html(this.template(msg)); this.template = originalTemplate; } else { if (msg.text.indexOf('//me ') === 0) { msg.text = msg.text.substr(1); }                   $(this.el).html(this.template(msg)); }           }

$(this.el).attr('id', 'entry-' + this.model.cid);

if (this.model.get('name')) { $(this.el).attr('data-user', this.model.get('name')); }

if (type === 'change' || typeof (type) === 'undefined') { if (this.model.get('continued') === true) { $(this.el).addClass('continued'); }           }

if (this.model.get('name') === un) { $(this.el).addClass('you'); }

var date = new Date, minutes = (date.getMinutes.toString.length === 1) ? '0' + date.getMinutes : date.getMinutes, seconds = (date.getSeconds.toString.length === 1) ? '0' + date.getSeconds : date.getSeconds, hours;

if (date.getHours === 0) { hours = 12; } else if (date.getHours > 12) { hours = date.getHours - 12; } else { hours = date.getHours; }

if (this.model.get('timeStamp').toString.match(/^\d+$/)) { $(this.el).find('.time').text(hours + ':' + minutes + ':' + seconds); }

if (this.model.get('isInlineAlert') === true) { // Inline alert timestamp $(this.el).addClass('inline-alert').append(' ' + hours + ':' + minutes + ':' + seconds + ' '); } else { // Embed images $(this.el).children('.message').children('a[href$=".bmp"], .message a[href$=".gif"], .message a[href$=".jpeg"], .message a[href$=".JPG"], .message a[href$=".jpg"], .message a[href$=".PNG"], .message a[href$=".png"], .message a[href$=".svg"], .message a[href$=".webp"]').each(function {                    var image = $(this).attr('href');

if (!image.match(/\/wiki\/File:/g) && !image.match(/File:/g)) { $(this).after(' <img src="' + image + '" /> '); }               });

// Embed YouTube videos $(this.el).children('.message').children('a[href*="www.youtube.com/watch?"], a[href*="m.youtube.com/watch?"], a[href*="youtu.be/"]').each(function {                    var $this = $(this).text,                        result,                        res,                        ult,                        result2,                        result3,                        result4,                        result5,                        link,                        link2;

if (/www\.youtube\.com\/watch\?/.test($this) || /m\.youtube\.com\/watch\?/.test($this)) { if ($this.indexOf('http://') === 0) { result = $this.slice(7); } else if ($this.indexOf('https://') === 0) { result = $this.slice(8); }

res = result.indexOf('watch?'); ult = result.indexOf('v='); result2 = result.slice(0, res + 6) + result.slice(ult); result3 = result2.indexOf('&'); result4 = result2.substring(0, result3 !== -1 ? result3 : result2.length);

if (/www\.youtube\.com\/watch\?/.test($this)) { result5 = result4.replace('www.youtube.com/watch?v=', 'www.youtube.com/embed/'); } else { result5 = result4.replace('m.youtube.com/watch?v=', 'www.youtube.com/embed/'); }

link = result5.slice(0, 33); link2 = link.slice(22); } else { if ($this.indexOf('http://youtu.be/') === 0) { result = $this.slice(16); } else if ($this.indexOf('https://youtu.be/') === 0) { result = $this.slice(17); }

link = 'www.youtube.com/embed/' + result; link2 = result.slice(0, 11); }

$(this).after(' ');

var $el = $(this).parent('.message').children('table').children('tbody').children('tr').children('td').children('#comments'); $.getJSON('http://gdata.youtube.com/feeds/api/videos/' + link2 + '/comments', {                       v: 2,                        alt: 'json',                        'max-results': 50                    }, function (data) {                        $(data.feed.entry).each(function  { $(this.author).each(function {                                ytname = this.name.$t;                            }); var ytid = this.yt$channelId.$t, ytimage = ytid.slice(2), ytpblshd = this.published.$t, ytdt = ytpblshd.replace(/T/g, ' ').slice(0, 19), ytmnth = ytdt.slice(5, 7), ytyr = ytdt.slice(0, 4), ytdy = ytdt.slice(8, 10), yttm = ytdt.slice(11); $($el).append(' <img src="https://i1.ytimg.com/i/' + ytimage + '/1.jpg" style="float: right; height: 40px; width: 40px; padding: 5px;" /> ' + ytname + ' ' + ytmnthnm[ytmnth - 1] + ' ' + ytdy + ', ' + ytyr + ' • ' + yttm + ' (UTC) ' + this.content.$t + ' '); });                   });                });

// Small emoticons $(this.el).children('.message').children('img').each(function {                    var $src = $(this).attr('src');

if (EMOTICONS.match($src)) { $(this).removeAttr('height width').attr('style', 'height: 16px !important; width: 16px !important;'); }               });            }

return this; };

// Show/hide YouTube comments $('body').on('click', '#show-hide', function {            var $c = $(this).siblings('#comments');            if ($($c).is(':hidden')) {                $(this).text('Hide YouTube top comments');                $($c).slideDown;            } else {                $(this).text('Show YouTube top comments');                $($c).slideUp;            }        }); } }(this.jQuery, this.mediaWiki));

CSS: /** * Chat stuff *  By User: AnimatedCartoons * * RESURRECTED FROM THE DEAD!!! >:D */

/* Placeholder */ .ui-sortable-placeholder { border: 2.5px dashed #ccc; opacity: 0.5 !important; visibility: visible !important; } .ui-sortable-placeholder:hover { background: transparent !important; } .ui-sortable-placeholder * { visibility: hidden; }

/* Disable selection */ body { -moz-user-select: none; -ms-user-select: none; -webkit-user-select: none; font-size: 14px !important; overflow: hidden; user-select: none; }

/* Enable selection */ .inline-alert, .message, .Chat .username, .time, .Write textarea { -moz-user-select: text !important; -ms-user-select: text !important; -webkit-user-select: text !important; user-select: text !important; }

/* Show */ li.User, .continued .time { display: block !important; }

/* Hide */ .ChatHeader .User, li.away .status { display: none !important; }

/* Remove content */ .inline-alert::before, .inline-alert::after, .Chat .username::after { content: '' !important; } li.chat-mod .username::after, li.staff .username::after, li.admin .username::after, li.bureaucrat .username::after, li.vstf .username::after { background: none !important; }

/* Change padding */ .Chat li { padding: 18px 15px 20px 49px; }

/* Remove border */ .UserStatsMenu .info img, .Write img, .Chat .avatar, li.User img, .WikiaPage, .Rail .splotch, .Chat, .ChatHeader, .Rail .private { border: none !important; }

/* Change width */ .Rail { width: 178px !important; }

/* Highlight */ li.chat-mod:not(.ui-sortable-placeholder) { background-color: #b8611d !important; } li.staff:not(.ui-sortable-placeholder) { background-color: #124e7b !important; } li.admin:not(.ui-sortable-placeholder) { background-color: #ff0 !important; } li.bureaucrat:not(.ui-sortable-placeholder) { background-color: #3d86a5 !important; } li.patroller:not(.ui-sortable-placeholder) { background-color: #691ea0 !important; } li.vstf:not(.ui-sortable-placeholder) { background-color: #ed1c24 !important; } .User.staff .username, .User.bureaucrat .username, .User.patroller .username, .User.vstf .username { color: #fff !important; font-style: normal !important; font-weight: bold !important; } .User.admin .username, .User.chat-mod .username { color: #000 !important; font-style: normal !important; font-weight: bold !important; } .User .username::after { content: '' !important; }

/* Messages and users count */ .count { color: #fff; text-align: center; } .messages-icon, .users-icon { background-image: url("http://slot1.images.wikia.nocookie.net/common/extensions/wikia/Chat2/images/sprite-Chat.png"); background-repeat: no-repeat; } .messages-icon { background-position: -521px 0px; padding-right: 25px; } .users-icon { background-position: -583px 0px; padding-right: 25px; }

/* Away */ .WikiChatList li.away:not(.ui-sortable-placeholder) { opacity: 0.05; } .WikiChatList li.away:not(.ui-sortable-placeholder):hover { opacity: 1; }

/* Other stuff */ .Chat { line-height: 1.2em !important; margin-right: 29px !important; overflow-x: hidden !important; } .Rail .selected { background-color: inherit !important; box-shadow: none !important; } .Rail h1.private { background-image: none !important; font-weight: bold; text-align: center; } li.User img { cursor: ns-resize !important; height: 28px !important; left: 15px !important; margin-top: 2px !important; top: 2px !important; width: 28px !important; } .PrivateChatList .selected img { left: 10px !important; margin-left: 5px !important; } .message img { vertical-align: bottom !important; } .time { margin-top: 18px !important; } .Write textarea { overflow: auto !important; padding-top: 1px !important; } .continued .time { margin-bottom: -15px !important; margin-top: 3px !important; } .Write { right: 178px !important; } .Chat .avatar { border-radius: 0px !important; height: 28px !important; width: 28px !important; } .watchlist { color: #fff; position: absolute; right: 5px; top: 11px; } .inline-time { float: right; } .inline-alert span { color: inherit !important; cursor: auto !important; text-decoration: none !important; } h1.wordmark { cursor: pointer !important; } .User .username { margin-right: 0px !important; }   color: #6a6a6a; cursor: pointer; font-weight: bold; padding-left: 5px; }   display: none; height: 300px; overflow: auto; width: 300px; word-wrap: break-word; }
 * 1) show-hide {
 * 1) comments {

Please note that I will not fix bugs made by this script nor add features. </ac_metadata>