ميډياويکي:Upload.js

د ويکيپېډيا، وړیا پوهنغونډ له خوا

د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئيادښت: د غوره توبونو د خوندي کولو وروسته، خپل د کتنمل (بروزر) ساتل شوې حافظه تازه کړی.د نور تفصيل لپاره د غځول په تنۍ کلېک وکړئ.

  • فايرفاکس/ سفري: په دې کتنمل کې د Reload د ټکوهلو په وخت د Shift تڼۍ نيولې وساتی، او يا هم Ctrl-F5 يا Ctrl-Rتڼۍ کېښکاږۍ (په Apple Mac کمپيوټر باندې ⌘-R کېښکاږۍ)
  • گووگل کروم: په دې کتنمل کې د Ctrl-Shift-R تڼۍ کېښکاږۍ (د مک لپاره ⌘-Shift-R)
  • انټرنټ اېکسپلورر: په دې کتنمل کې د Refresh د ټکوهلو په وخت کې د Ctrl تڼۍ کېښکاږلې ونيسۍ، او يا هم د Ctrl-F5 تڼۍ کېښکاږۍ
  • اوپرا: په دې کتنمل کې د خپل براوزر ساتل شوې حافظه پدې توگه سپينولی شی Tools→Preferences
لاسوند[جوړول]
//<source lang="javascript">
// LicenseChecker 
//
// checks whether the selected license on Special:Upload is valid and provides feedback
//
// Maintainer: [[User:Dschwen]]
//
var licenseChecker = {
	//
	// List of invalid licenses
	//
	invalid: ["د دوتنې نامعلومه د خپرولو حق", "د دوتنې نامعلومه سرچينه"],

	//
	// Translations of the warning message
	//
	i18n: {
		'en': 'The selected licensing is <b>unacceptable on Wikimedia Commons</b> and will lead to the <b>deletion</b> of your upload!',
		'ps': 'انتخابي جواز <b>د منلو وړ</b> ندي او ستاسو د پورته شوي دوتنې د پاکیدو سبب کیږي!'
	},

	// Event handler for the license selector
	check: function () {

		this.$warnbanner.empty();
		for (var i = 0; i < this.invalid.length; i++) {
			if (this.$licensemenu.val() == this.invalid[i]) {
				this.$warnbanner.append(this.message);
				return;
			}
		}

	},

	install: function () {
		this.$uploadtext = $('#uploadtext');
		this.$licensemenu = $('#wpLicense');

		// Some forms may not have a license selector (e.g. "fromwikimedia", or reupload forms)
		if (!this.$licensemenu.length) return;

		this.$warnbanner = $('<div class="center"></div>');
		this.$warnbanner.css({
			color: 'red',
			background: '#eeeeee'
		});

		this.$uploadtext.append(this.$warnbanner);
		$(this.$licensemenu).change(function () {
			licenseChecker.check();
		});
	}

};
$(document).ready(function() {licenseChecker.install();});


/***** loadAutoInformationTemplate ********
 * Adds a link to subpages of current page
 *
 *  Maintainers: [[User:Yonidebest]], [[User:Dschwen]]
 ****/

function loadAutoInformationTemplate() {
	//Don't show when reuploading
	if (getParamValue('wpDestFile') !== null) return;
	uploadDescription = document.getElementById('wpUploadDescription');

	// ignore fromflickr, as people should use flinfo tool
	// ignore fromwikimedia, as people should use commons helper tool
	if (uploadDescription != null && wgUserLanguage != 'fromflickr' && wgUserLanguage != 'fromwikimedia' && uploadDescription.value == '') {
		switch (wgUserLanguage) {
		case "ownwork":
		case "deownwork":
		case "elownwork":
		case "esownwork":
		case "frownwork":
		case "itownwork":
		case "mkownwork":
		case "nlownwork":
		case "noownwork":
		case "plownwork":
		case "ruownwork":
		case "svownwork":
			uploadDescription.value = '{{Information\n|Description=\n|Source={{own}}\n|Date=\n|Author= [[User:' + mw.config.get('wgUserName') + '|' + mw.config.get('wgUserName') + ']]\n|Permission=\n|other_versions=\n}}\n';
			break;
		case "fromgov":
			uploadDescription.value = '{{Information\n|Description=\n|Source=\n|Date=\n|Author=\n|Permission=\n|other_versions=\n}}\n';
			break;
		case "icommons":
			uploadDescription.value = '{{Information\n|Description=\n|Source=\n|Date=\n|Author=\n|Permission=\n|other_versions=\n}} \n[[category:iCommons iHeritage]]\n [[category:South Africa]]\n';
			break;
		default:
			uploadDescription.value = '{{Information\n|Description=\n|Source=\n|Date=\n|Author=\n|Permission=\n|other_versions=\n}}\n';
			break;
		}

		/// Hide copy & paste template information, if we just prefilled it automatically
		$('#Uploadtext-template-box').hide();
	}
}

// $(document).ready(loadAutoInformationTemplate);