User:Puffin/vector.js

importScript('MediaWiki:Gadget-HotCat.js');
importScript('User:Ale_jrb/Scripts/igloo.js'); // [[User:Ale_jrb/Scripts/igloo]]
//<source lang=javascript>
/**
 * NowCommonsReview tagger
 * URL: http://en.wikipedia.org/wiki/User:MGA73/nowcommonsreview.js
 * Credits: 
 * MGA73, ZooFari, Krinkle
 *
 * Based on http://commons.wikimedia.org/wiki/User:ZooFari/licensereviewer.js by Patstuart
 */
window.nowcommonsreview = "0.20 (2010-06-23)";
 
// NowCommons review passed
function NowCommonsReviewOK(autosave){
	var needAppend=document.editform.wpTextbox1.value;
	document.editform.wpTextbox1.value = needAppend.replace(/({{([Nn]ow|[Dd]b-now|[Mm]oved to) ?(C|c)ommons([^\}]*?))}}/g, '$1|reviewer=' + wgUserName + '}}');
 
	document.editform.wpSummary.value = '[[Template:NowCommons|NowCommons review]] passed (using [[User:MGA73/nowcommonsreview.js|nowcommonsreviewer]])';
	document.editform.wpMinoredit.checked = true;
 
	if(autosave){ document.editform.submit(); }
}
 
// NowCommons review failed
function NowCommonsReviewNotOK(autosave){
	var needAppend=document.editform.wpTextbox1.value;
 
	var reason = window.prompt("Reason for failed NowCommons review:","");
	document.editform.wpTextbox1.value = needAppend.replace(/({{(N|n|db-n|Db-n)ow(C|c)ommons([^}]*?))}}/g, '$1|reason=' + reason + '}}').replace(/\{\{(N|n|db-n|Db-n)ow(C|c)ommons/g, '{{NotMovedToCommons');
 
	document.editform.wpSummary.value = '[[Template:NowCommons|NowCommons review]] failed (using [[User:MGA73/nowcommonsreview.js|nowcommonsreviewer]])';
	document.editform.wpMinoredit.checked = true;
 
	if(autosave){ document.editform.submit(); }
}
 
// [review] link inserter
$(function(){
 
	var targets = getElementsByClassName(document, 'div', 'nowcommons-reviewme');
	if(targets.length === 0) return true; // NowCommons is not on this page, return the function.
 
	targets[0].style.textAlign = 'center'; // center the text
 
	var catstring = wgCategories.join("|");
 
	if(catstring.match(/Wikipedia files reviewed on Wikimedia Commons/)){
		// This page is in a reviewed category. Dont display links.
		targets[0].innerHTML = '<small>Already reviewed</small>';
		return true; 
 
	} else { // This NowCommons page isn't reviewed yet. Show links.
		var passlink = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName=NowCommonsReviewOK";
		var faillink = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName=NowCommonsReviewNotOK";
 
		targets[0].innerHTML = '[<a href="'+passlink+'">pass review</a>] [<a href="'+faillink+'">fail review</a>]';
		return true;
	}	
});
 
// Link/Button maker
function addFunction(functionNameString, buttonDisplayName, buttonID){
 
	if (mw.util.getParamValue('functionName')==functionNameString){
		addOnloadHook(function(){
			eval(functionNameString+"(true)");
		});
	}
 
	var _href;
	if (wgAction=="edit"){ 
		_href = "javascript:"+functionNameString+"(true);";
	} else {
		_href = wgScript+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&action=edit&functionName="+functionNameString;
	}
 
	// Add buttons
	addOnloadHook(function(){ mw.util.addPortletLink('p-cactions', _href, buttonDisplayName, 'ca-'+buttonID, '', null, 0); });
	addOnloadHook(function(){ mw.util.addPortletLink('p-tb', _href, buttonDisplayName, 'tb-'+buttonID, '', null, 0); });
}
 
// Fire it off:
addFunction("NowCommonsReviewOK", "NowCommons OK", "nowcommonsreview");
addFunction("NowCommonsReviewNotOK", "NowCommons Not OK", "nowcommonsreview");
 
//</source>
importScript("Wikipedia:Dazzle!/code.js");
importScript('User:Timotheus Canens/afchelper4.js'); // Yet another AfC helper script v4.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.