Jump to content

User:Amaury/common.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript( 'User:Mxn/CommentsInLocalTime.js' ); // Backlink: [[User:Mxn/CommentsInLocalTime.js]]

window.LocalComments = $.extend(window.LocalComments, {
	formats: {
		day: function (then) { return then.calendar(); },
		week: function (then) { return then.calendar().replace(/^Last /, ""); },
		other: "MMMM D, YYYY [at] h:mm A",
	},
	tooltipFormats: null
});

importScript( 'User:Enterprisey/reply-link.js' ); // Backlink: [[User:Enterprisey/reply-link.js]]

importScript( 'User:Technical_13/Scripts/OneClickArchiver.js' ); // Backlink: [[User:Technical_13/Scripts/OneClickArchiver]]

(function() {
    'use strict';

    var pagesToPurge = [
        'User:Amaury',
        'User talk:Amaury'
    ];

    function purgePage(pageTitle) {
        new mw.Api().post({
            action: 'purge',
            titles: pageTitle,
            assert: 'user'
        }).done(function() {
          //  console.log('Page purged: ' + pageTitle);
        }).fail(function() {
           // console.error('Failed to purge page: ' + pageTitle);
        });
    }

    function startAutoPurge() {
        var interval = 60000; // purge every 60 seconds
        var delay = 5000; // 5 seconds delay between each page

        function purgePages() {
            pagesToPurge.forEach(function(pageTitle, index) {
                setTimeout(function() {
                    purgePage(pageTitle);
                }, index * delay);
            });
        }
        purgePages();
        setInterval(purgePages, interval);
    }

    $(document).ready(function() {
        startAutoPurge();
    });
})();