Jump to content

User:Amaury/common.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Amaury (talk | contribs) at 22:34, 6 January 2025. The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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();
    });
})();