مواد ڏانھن هلو

ذريعات وڪي:TourwikiRecommend.js

کليل ڄاڻ چيڪلي، وڪيپيڊيا مان

تفصيل جي لاءِ ڪلڪ ڪريويادگيري: محفوظ ڪرڻ کانپوءِ تازين تبديلن کي کي ڏسڻ جي لاءِ توهان کي پنهنجي برائوزر جي ڪيش کي صاف ڪرڻ جي ضرورت آهي.

  • فائرفاڪس: جڏهن Reload تي ڪلڪ ڪريو ته Shift دٻائي رکو یا Ctrl-F5 یا Ctrl-R دٻايو (Mac تي R-⌘)
  • گوگل ڪروم: Ctrl-Shift-R دٻايو (Mac تي Shift-R-⌘)
  • انٽرنيٽ ايڪسپلورر: جڏهن Refresh تي ڪلڪ ڪريو ته Ctrl یا Ctrl-F5 دٻايو
  • اوپيرا: Tools → Preferences ۾ وڃو ۽ ڪيش صاف ڪريو
دستاويز[تخليق]
$(function () {
	var enLink = $('.interwiki-en > a[lang="en"]');
	if (!enLink.length) {
		return;
	}
	$.get('https://api.wikimedia.org/service/lw/recommendation/v1/api', {
		s: 'en',
		t: 'sd',
		n: 4,
		article: enLink.attr('title').replace('–انگریزي', '')
	}).then(function (data) {
		return new mw.Api({ ajax: { url: '//en.wikipedia.org/w/api.php' } }).get({
			action: 'query',
			formatversion: 2,
			format: 'json',
			prop: 'pageimages|pageterms',
			piprop: 'thumbnail',
			pithumbsize: 70,
			wbptterms: 'description',
			pilimit: 3,
			titles: data.map(function (x) { return x.title; }).join('|'),
			uselang: 'en',
			smaxage: 86400,
			origin: location.protocol + '//' + location.hostname
		});
	}).then(function (data) {
		$('#bodyContent').prepend($('<aside>', {
			'class': 'ra-read-more noprint'
		}).append(
			$('<h3>').append($('<b>', { text: 'لاڳاپيل مضمون تخليق لاءِ:' })),
			$('<table>', {
				class: 'wikitable',
				style: 'width:80%; border: 2px solid #2a4b8d; background-color:#eaf3ff;',
				dir: 'ltr'
			}).append($('<tbody>').append($('<tr>').append(
				data.query.pages.map(function (article) {
					return $('<td>', { style: 'width:25%;' }).append($('<a>', {
						href: 'https://en.wikipedia.org' + mw.util.getUrl(article.title),
					}).append(
						$('<img>', {
							style: 'float: left; padding: .2em;',
							src: article.thumbnail !== undefined
								? article.thumbnail.source
								: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/OOjs_UI_icon_article-ltr.svg/70px-OOjs_UI_icon_article-ltr.svg.png'
						}),
						$('<span>', {
							style: "color: #000; font-size: .8em;",
							text: article.title
						}),
						$('<br>'),
						$('<span>', {
							style: 'color: #888888; font-size: .6em;',
							text: article.terms !== undefined
								? article.terms.description
								: ''
						})
					));
				})
			)))
		));
	});
});