ব্যবহারকারী:ARI/common.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য
অবয়ব
"mw.loader.using('mediawiki.util', function () { var pageName = mw.config.get('wgPageName'); if (!pageName) return; var purgeUrl = mw.util.getUrl(pageName, { action: 'purge' }); var hardPurgeUrl = mw.util.getUrl(pageName, { action: 'purge', forcerecursivelinkupdate: 1 }); mw.util.addPortletLink( 'p-cactions', purgeUrl, 'পার্জ', 'ca-purge', 'পাতার ক্যাশ পরিষ্কার করুন'..." দিয়ে পাতা তৈরি |
সম্পাদনা সারাংশ নেই |
||
| ১ নং লাইন: | ১ নং লাইন: | ||
mw.loader.using('mediawiki.util', function () { | 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' }); | |||
}); | |||
}); | |||
}); | |||
}); | }); | ||
০৯:১০, ৩ জানুয়ারি ২০২৬ তারিখে সংশোধিত সংস্করণ
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' });
});
});
});
});