Butun axtardiqlarinizi tapmaq ucun buraya: DAXIL OLUN
  Mp4 Mp3 Axtar Yukle
  Video Axtar Yukle
  Shekil Axtar Yukle
  Informasiya Melumat Axtar
  Hazir Inshalar Toplusu
  AZERI CHAT + Tanishliq
  1-11 Sinif Derslikler Yukle
  Saglamliq Tibbi Melumat
  Whatsapp Plus Yukle(Yeni)

  • Ana səhifə
  • Təsadüfi
  • Yaxınlıqdakılar
  • Daxil ol
  • Nizamlamalar
İndi ianə et Əgər Vikipediya sizin üçün faydalıdırsa, bu gün ianə edin.

MediaViki:Gadget-sns-arxiv.js

  • İnterfeys
  • Müzakirə
  • Mənbəyə bax

Qeyd: Dəyişiklikləri yayımladıqdan sonra etdiyiniz dəyişikliklərin görünməsi üçün brauzerinizin keşinin təmizlənməsi lazım ola bilər.

  • Firefox / Safari: Reload düyməsinə basılı tutarkən Shift düyməsinə basın, və ya Ctrl+F5 və ya Ctrl+R (Mac üçün ⌘-R )
  • Google Chrome: Ctrl-Shift-R (Mac üçün ⌘-Shift-R)
  • Edge: Ctrl düyməsini basılı tutarkən Refresh düyməsinə basın, və ya sadəcə Ctrl+F5.
"use strict";

mw.loader.using(['mediawiki.util', 'mediawiki.api', '@wikimedia/codex', 'vue'], function(require) {
	const { createMwApp, ref, onMounted, watch } = require('vue');
	const { CdxDialog, CdxButton } = require('@wikimedia/codex');
	const api = new mw.Api();

	const page = mw.config.get('wgPageName');
	if (page !== "Vikipediya:Silinməyə_namizəd_səhifələr") return;
	if (mw.config.get('skin') === 'minerva') return;

	const headings = document.querySelectorAll('.mw-heading');

	headings.forEach((heading) => {
		const editSection = heading.querySelector('.mw-editsection');
		if (!editSection) return;

		const aTag = editSection.querySelector('a');
		const editLinkHref = aTag ? aTag.getAttribute('href') : null;
		const match = editLinkHref && editLinkHref.match(/title=([^&]+)/);
		const matchedTitle = match && match[1] ? decodeURIComponent(match[1]).replace(/_/g, ' ') : null;
		if (!matchedTitle) return;

		const sectionPage = matchedTitle;

		api.get({
			action: 'parse',
			prop: 'wikitext',
			page: sectionPage,
			formatversion: 2
		}).then(res => {
			const wikitext = res.parse.wikitext;
			if (!wikitext.includes('{{qapalı')) return;
			
			let container;
			
			if (mw.config.get('skin') === 'minerva') {
				container = document.createElement('div');
				container.className = 'arxivleshdir-wrapper';
				heading.after(container);
			} else {
				container = document.createElement('span');
				container.className = 'mw-editsection';
				editSection.after(container);
			}

			const app = createMwApp({
				components: { CdxDialog, CdxButton },
				setup() {
					const dialogOpen = ref(false);
					const progressing = ref(false);
					const countdown = ref(5);
					const redirectInterval = ref(null);
					
					const sectionName = sectionPage.replace('Vikipediya:Silinməyə namizəd səhifələr/', '');

					const now = new Date();
					const monthNames = ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'];
					const archivePage = `Vikipediya:Silinməyə namizəd səhifələr/Arxiv/${now.getFullYear()} ${monthNames[now.getMonth()]}`;
					
					watch(dialogOpen, (newVal) => {
						if (!newVal && redirectInterval.value) {
							clearInterval(redirectInterval.value);
							redirectInterval.value = null;
							countdown.value = 5;
						}
					});

					async function archiveDiscussion() {
						progressing.value = true;

						try {
							const mainRes = await api.get({
								action: 'query',
								titles: page,
								prop: 'revisions',
								rvprop: 'content',
								formatversion: 2
							});
							let mainContent = mainRes.query.pages[0].revisions[0].content;
							const lineToRemove = `{{Vikipediya:Silinməyə namizəd səhifələr/${sectionName}}}`;
							mainContent = mainContent.split('\n').filter(l => l.trim() !== lineToRemove).join('\n');

							await api.postWithEditToken({
								action: 'edit',
								title: page,
								text: mainContent,
								summary: `[[${sectionPage}]] müzakirəsi [[${archivePage}|arxivə]] köçürüldü`,
								format: 'json'
							});

							let archiveContent = '';
							let isNew = false;
							try {
								const archRes = await api.get({
									action: 'query',
									titles: archivePage,
									prop: 'revisions',
									rvprop: 'content',
									formatversion: 2
								});
								const pageObj = archRes.query.pages[0];
								if (!pageObj.missing) {
									archiveContent = pageObj.revisions[0].content;
								} else {
									archiveContent = '{{Arxiv}}\n';
									isNew = true;
								}
							} catch (e) {}

							archiveContent += `\n{{Vikipediya:Silinməyə namizəd səhifələr/${sectionName}}}`;

							await api.postWithEditToken({
								action: 'edit',
								title: archivePage,
								text: archiveContent,
								summary: `[[${sectionPage}]] müzakirəsi arxivə əlavə olundu`,
								createonly: isNew,
								format: 'json'
							});

							redirectInterval.value = setInterval(() => {
								countdown.value--;
								if (countdown.value <= 0) {
									clearInterval(redirectInterval.value);
									redirectInterval.value = null;
									location.href = mw.util.getUrl(archivePage) + '#' + encodeURIComponent(sectionName);
								}
							}, 1000);
						} catch (err) {
							console.error(err);
							mw.notify('Arxivləşdirmə zamanı xəta baş verdi.', { type: 'error' });
						}
					}

					return {
						dialogOpen,
						progressing,
						archiveDiscussion,
						countdown,
						sectionName,
						archivePage
					};
				},
				template: `
					<span class="mw-editsection-bracket">[</span>
					<a href="#" @click.prevent="dialogOpen = true">arxivləşdir</a>
					<span class="mw-editsection-bracket">]</span>

					<cdx-dialog
						v-model:open="dialogOpen"
						title="Müzakirənin arxivləşdirilməsi"
						use-close-button
					>
						<template #default>
							<p>
								<code>{{ sectionName }}</code> səhifəsinin müzakirəsi
								<a :href="'/wiki/' + archivePage.replaceAll(' ', '_')">{{ archivePage }}</a> səhifəsində arxivləşdiriləcəkdir. Davam etmək üçün klikləyin.
							</p>
							<div v-if="progressing && countdown === 5" class="cdx-progress-indicator">
							  <div class="cdx-progress-indicator__indicator">
							    <progress class="cdx-progress-indicator__indicator__progress"></progress>
							  </div>
							  <div class="cdx-label cdx-progress-indicator__label">
							    <label class="cdx-label__label">
							      <span class="cdx-label__label__text">Müzakirə arxivləşdirilir…</span>
							    </label>
							  </div>
							</div>
							
							<p v-if="progressing && countdown < 5 && countdown > 0" style="margin-top: 1em;">
							  Müzakirə arxivləşdirildi! {{ countdown }} saniyə sonra arxiv səhifəsinə yönləndiriləcəksiniz.
							</p>
						</template>
						<template #footer>
							<cdx-button @click="archiveDiscussion" :disabled="progressing">Davam et</cdx-button>
						</template>
					</cdx-dialog>
				`
			});

			app.mount(container);
		});
	});
});
Mənbə — "https://az.wikipedia.org/w/index.php?title=MediaViki:Gadget-sns-arxiv.js&oldid=8177176"
Informasiya Melumat Axtar