ব্যবহারকারী:ARI/common.js
লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।
- ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
- এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন।
- অপেরা: Ctrl-F5 টিপুন।
mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {
$(function () {
// Prevent script from running on Special pages (which cannot be purged)
if (mw.config.get('wgNamespaceNumber') < 0) return;
// Add the Portlet Link
var purgeLink = mw.util.addPortletLink(
'p-cactions', // Target the "More" dropdown (Vector) or Actions tab (Monobook)
'#', // Link destination (handled by click event below)
'Purge', // The visible text
'ca-purge', // DOM ID for the link
'Purge cache and update links', // Tooltip
'*' // Keyboard shortcut (Alt+Shift+*)
);
// Handle the click event
$(purgeLink).on('click', function (e) {
e.preventDefault(); // Stop the link from following '#'
// Change text to indicate processing
$(this).find('a').text('Purging...');
// Call the API
new mw.Api().post({
action: 'purge',
titles: mw.config.get('wgPageName'),
forcelinkupdate: 1 // This performs the "Hard Purge" (updates tables)
}).then(function () {
// On success, reload the page
location.reload();
}).catch(function () {
// If API fails, fallback to the standard confirmation screen
window.location.href = mw.util.getUrl(null, { action: 'purge' });
});
});
});
});