মিডিয়াউইকি:Gadget-PurgeTab.js

উইকিভ্রমণ থেকে

লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: Ctrl-F5 টিপুন।
jQuery(document).ready(function () {

	if (!mw.config.get('wgArticleId'))
		return;
	var link;

	link = mw.util.addPortletLink(
		'p-cactions', mw.util.getUrl(mw.config.get('wgPageName'), { 'action': 'purge' }),
		(mw.user.options.get( 'skin' ) == 'vector' ) ? "পার্জ" : "পার্জ",
		'ca-purge', "পাতার সার্ভারের ক্যাশ পরিস্কার করতে পার্জ করুন", '*'
	);

	link = mw.util.addPortletLink(
	// not sure if raw link is valid for extra params  Using wikiScript instead of getUrl
		'p-cactions', mw.util.wikiScript('api') + '?action=purge&titles=' + mw.config.get('wgPageName') + '&forcerecursivelinkupdate=1&redirects=1',
		(mw.user.options.get( 'skin' ) == 'vector' ) ? "হার্ড পার্জ " : "হার্ড পার্জ",
		'ca-purge-forcerecursivelinkupdate', "Purge with forced recursive-link table update", ','
	);

	if ( link ) {
		link.addEventListener('click', function (ev) {
			mw.loader.using( 'mediawiki.api' ).done(function() {
				( new mw.Api() ).post({
					action: 'purge',
					pageids: mw.config.get('wgArticleId'),
					forcerecursivelinkupdate: 1,
					redirects: 1
				}).then(function () {
					location.reload();
				}, function (code, details) {
					var mesg;
					switch (code) {
					case 'http':
						mesg = 'HTTP error: ' + details.xhr.statusText;
						break;
					case 'ok-but-empty':
						mesg = 'Received empty response.';
						break;
					default:
						mesg = details.error.info;
					}
					mw.notify('<b>Hard purge failed</b>: ' + mesg);
					console.error(arguments);
				} );
			} );
		ev.preventDefault();
		}, false);
	}

	link = mw.util.addPortletLink(
		'p-cactions', 'javascript:void window.warranty',
		(mw.user.options.get( 'skin' ) == 'vector' ) ? "Null edit" : "Null edit",
		'ca-nulledit', "Null edit", '0'
	);

	if ( link ) {
		link.addEventListener('click', function (ev) {
			mw.loader.using( 'mediawiki.api' ).done( function() {
				( new mw.Api() ).post({
					action: 'edit',
					pageid: mw.config.get('wgArticleId'),
					appendtext: '',
					watchlist: 'nochange',
					nocreate: '1',
					token: mw.user.tokens.get('csrfToken')
				}).then(function () {
					location.reload();
				}, function (code, details) {
					var mesg;
					switch (code) {
					case 'http':
						mesg = 'HTTP error: ' + details.xhr.statusText;
						break;
					case 'ok-but-empty':
						mesg = 'Received empty response.';
						break;
					default:
						mesg = details.error.info;
					}
					mw.notify('<b>Null edit failed</b>: ' + mesg);
					console.error(arguments);
				} );
			} );
			ev.preventDefault();
		}, false);
	}
} );