Board Thread:Support Requests - Getting Technical/@comment-5961377-20140807025056

Hey all, so my friend AnimatedCartoons has deactivated his account so he cannot fix his own script anymore. I asked the script from him and would like help in fixing it, as certain features do not work.

I'd like help in figuring out how to fix Recent Changes notifications in chat. The code for that is below:

// 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";

// 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);

// 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.  ', {               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; }                       }                    }                ]            });        });

This is only part of the script I think is involved with recent notifications. The whole script can be found here: User:Gameuser10/chat.js 