User:ElBosso/global.js

PurgeButtonText = 'Purge';

importArticles({   type: "script",    articles: [        "u:dev:QuickIW/code.js",        "u:dev:PurgeButton/code.js",        "u:dev:QuickCreateUserPage/code.js",        "u:dev:MediaWiki:MultiUpload.js",        "u:dev:MediaWiki:WHAM/code.2.js"    ] });

(function(window, mw, $) {   "use strict";    var tru = {        condition: "false"    };    setInterval(function { if ($('#my-tools-menu')[0] !== undefined && tru.condition == "false") { $('ul#my-tools-menu').append(' Page Comparator'); $('#feedercompare').on('click', function {               $.showCustomModal('Wiki Comparator', '  Listing Non-Existing Pages  Listing Existing Pages  All    #wikicomparator input {    margin: 20px;}#wikicomparator textarea,#feedresults {    margin: 20px;    width: 349px;    height: 212px;}' + '#wikicomparator h1 {    font-family: monospace;    font-weight: 700;    font-size: 40px;    font-variant: small-caps;    text-shadow: 0px 0px 18px #b5b5b5;    color: gray;    padding: 16px;}#wikicomparator {    background: white;}#wikicomparator select#feederSituation {    margin: 20px 110px;}#wikicomparator ::-webkit-scrollbar {    background: #e4e4e4;}#wikicomparator ::-webkit-scrollbar-thumb {    background: linear-gradient(to top,#cccccc,#c5c2c2);    border-radius:2pc;} ', { id: "wikicomparator", buttons: [{ message: "Fetch Articles", id: "beginFetch" }, {                       message: "Clear", id: "clearlist" }, {                       message: "Execute", id: "beginCompare" }],                   callback: function { $('#clearlist').on('click', function {                           $('#feedresults div').remove;                        }) $('#wiki1').val(wgServer.split("http://")[1].split(".wikia")[0]); $('#beginCompare').on('click', function {                           i = 0;                            var searchAlt = setInterval(function { if ($('#feedcompare').val.split(/^/gmi).length - 1 <= i) { clearInterval(searchAlt); }                               var m = i;                                var k = {}; $.ajax({                                   type: 'GET',                                    dataType: 'text',                                    url: 'http://' + $('#wiki1').val + '.wikia.com/api.php',                                    method: 'GET',                                    data: {                                        action: 'query',                                        prop: 'revisions',                                        titles: $('#feedcompare').val.split(/^/gmi)[i].replace('↵', ).replace(/\n/, ),                                        rvtoken: 'rollback',                                        rvprop: 'content',                                        format: 'json'                                    },                                    xhrFields: {                                        withCredentials: true                                    }, dataType: 'JSONP', crossdomain: true, }).always(function(d) { console.log(Object.keys(d.query.pages)[0] + " " + m + " " + $('#feedcompare').val.split(/^/gmi)[m].replace('↵', ).replace(/\n/, )) if (Object.keys(d.query.pages)[0] == "-1" && $('#feedcompare').val.split(/^/gmi)[m] != undefined && $('#feederSituation').val == "1") { $('#feedresults').append(' ' + $('#feedcompare').val.split(/^/gmi)[m].replace('↵', ).replace(/\n/, ) + " "); } else if (Object.keys(d.query.pages)[0] != "-1" && $('#feedcompare').val.split(/^/gmi)[m] != undefined && $('#feederSituation').val == "2") { $('#feedresults').append(' ' + $('#feedcompare').val.split(/^/gmi)[m].replace('↵', ).replace(/\n/, ) + " "); } else if ($('#feedcompare').val.split(/^/gmi)[m] != undefined && $('#feederSituation').val == "3") { if (Object.keys(d.query.pages)[0] == "-1") { $('#feedresults').append(' ' + $('#feedcompare').val.split(/^/gmi)[m].replace('↵', ).replace(/\n/, ) + " "); } else { $('#feedresults').append(' ' + $('#feedcompare').val.split(/^/gmi)[m].replace('↵', ).replace(/\n/, ) + " "); }                                   }                                });                                i = i + 1                                return i;                            }, 100); })                       $('input#feedsearcher').on('keydown', function(d) { $.ajax({                               type: 'GET',                                dataType: 'text',                                url: 'http://' + $("#wiki1")[0].value + '.wikia.com/api.php',                                method: 'GET',                                data: {                                    action: 'query',                                    list: 'allpages',                                    apfrom: d.target.value,                                    format: 'json'                                },                                xhrFields: {                                    withCredentials: true                                },                                dataType: 'JSONP',                                crossdomain: true                            }).always(function(d) {                                $('#searchparams option').remove; Object.keys(d.query.allpages).forEach(function(f, e) {                                   $('datalist#searchparams').append($(' ', {                                        value: d.query.allpages[f].title,                                        text: d.query.allpages[f].title                                    }))                                }); });                       });                        $('#beginFetch').on('click', function {                            var starter = "";                            var x = 0;                            function pageloopersecond(pagelooper, starter) {                                $.ajax({ type: 'GET', dataType: 'text', url: 'http://' + $('#wiki1').val + '.wikia.com/api.php?action=query&list=allpages&aplimit=5000&apfrom=' + starter + '&prop=info&apnamespace=0&format=json', method: 'GET', xhrFields: { withCredentials: true },                                   dataType: 'JSONP', crossdomain: true, }).always(function(d) { Object.keys(d.query.allpages).forEach(function(f, e) {                                       var tes = d.query.allpages[f].title.replace(/([^\w\b\s])/gmi, '\\$1');                                        var tt = new RegExp(tes + "\n","gmi");                                        if ($('#feedcompare').val.match(tt) === null) {                                            $('#feedcompare').val($('#feedcompare').val + d.query.allpages[f].title + "\n");                                        }                                    }); if (d["query-continue"] !== undefined) { pageloopersecond([], d["query-continue"].allpages.apfrom); }                               });                            }                            var pagelooper = function(pagelooper, starter) {                                $.ajax({ type: 'GET', dataType: 'text', url: 'http://' + $('#wiki1').val + '.wikia.com/api.php?action=query&list=allpages&aplimit=5000&apfrom=' + starter + '&prop=info&apnamespace=0&format=json', method: 'GET', xhrFields: { withCredentials: true },                                   dataType: 'JSONP', crossdomain: true, }).always(function(d) { Object.keys(d.query.allpages).forEach(function(f, e) {                                       var tes = d.query.allpages[f].title.replace(/([^\w\b\s])/gmi, '\\$1');                                        var tt = new RegExp(tes + "\n","gmi");                                        if ($('#feedcompare').val.match(tt) === null) {                                            $('#feedcompare').val($('#feedcompare').val + d.query.allpages[f].title + "\n");                                        }                                    }); if (d["query-continue"] !== undefined) { pageloopersecond([], d["query-continue"].allpages.apfrom); }                               });                            }                            pagelooper([], starter);                        }) }               })            })            return tru.condition = "true"; }   }, 2000) }(window, mw, $));