Cp-s05box Wiki
Advertisement
/* license test */

	// for [[Special:Upload]]
$(document).ready(function() {
	$('select[name="wpLicense"]#wpLicense > option:contains(None selected)').attr("value","No license");
});

if ( mw.config.get("wgPageName") == "Special:Upload" ) {
	$('input[name="wpUpload"][type="submit"]').mousedown(function() {
		if ( $("#wpLicense").val() == "No license" ) {
			$(this).attr("disabled","disabled").attr("title","Please select a license before uploading").css("cursor","disabled");
			$("td#mw-license-preview").load('http://cps05box.wikia.com/wiki/MediaWiki:License_none_error?action=raw&ctype=html');
		}
	});
	$("body").mouseover(function() {
		if ( $("#wpLicense").val() != "No license" ) {
			$('input[name="wpUpload"][type="submit"]').removeAttr("disabled").removeAttr("style").attr("title","Start upload [alt-shift-s]");
		}
	});
}
	// for [[Special:MultipleUpload]]
if ( mw.config.get("wgPageName") == "Special:MultipleUpload" ) {
	$('input[name="wpUpload"][type="submit"]').mousedown(function() {
		if ( $("#wpLicense").val() == "No license" ) {
			$(this).attr("disabled","disabled").attr("title","Please select a license before uploading").css("cursor","disabled");
			$("td#mw-license-preview").load('http://cps05box.wikia.com/wiki/MediaWiki:License_none_error?action=raw&ctype=html');
		}
	});
	$("body").mouseover(function() {
		if ( $("#wpLicense").val() != "No license" && $('input[name^="wpDestFile"]').val() !== "" ) {
			$('input[name="wpUpload"][type="submit"]').removeAttr("disabled").removeAttr("style").attr("title","Start upload [alt-shift-s]");
		} else if ( $("#wpLicense").val() != "No license" && $('input[name^="wpDestFile"]').val() !== "" ) {
			$('input[name="wpUpload"][type="submit"]').attr("disabled","disabled").attr("title","Please select a license before uploading").css("cursor","disabled");
		}
	});
}
	// for other pages - ordinary wiki loader +++ CURRENTLY DOESN'T WORK +++
if ( mw.config.get("wgPageName") != "Special:MultipleUpload" && mw.config.get("wgPageName") != "Special:Upload" ) {
	$("section#UploadPhotosWrapper").load(function() {
		$('section#UploadPhotosWrapper select[name="wpLicense"]#wpLicense > option:contains(None selected)').attr("value","No license");
		$('section#UploadPhotosWrapper #UploadPhotos > form > .step-1 > input[type="submit"]').mousedown(function() {
			if ( $("#wpLicense").val() == "No license" ) {
				$(this).attr("disabled","disabled").attr("title","Please select a license before uploading").css("cursor","disabled");
				$("td#mw-license-preview").load('http://cps05box.wikia.com/wiki/MediaWiki:License_none_error?action=raw&ctype=html');
			}
		});
		$("body").mouseover(function() {
			if ( $("#wpLicense").val() != "No license" ) {
				$('section#UploadPhotosWrapper #UploadPhotos > form > .step-1 > input[type="submit"]').removeAttr("disabled").removeAttr("style").attr("title","Start upload [alt-shift-s]");
			}
		});
	});
	$("head").append('<style type=\"text/css\">\nsection#UploadPhotosWrapper #UploadPhotos > form > .step-1 .options {\n	display: block !important;\n	background: transparent;\n	border-bottom: none;\n}\nsection#UploadPhotosWrapper #UploadPhotos > form > .advanced {\n	display: none;\n}\n</style>');
}
Advertisement