Jump to content

User:Ale jrb/Scripts/csdcheck.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ale jrb (talk | contribs) at 08:33, 20 May 2009 (test). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* ============================================== *\
** CSD Helper JavaScript
**   for Wikipedia
**
** Created by Alexander Barley [[User:Ale_jrb]]
**
\* ============================================== */

// the following settings are used in this script:
	

function csdHelper() {
	this.launch = function() {
		// launch helper. check whether there is a deletion tag on this page.
		if (document.getElementById('delete-criterion') != null) {
			// this page is tagged. check sysop.
			var iAmSysop = false;
			for (var i = 0; i < wgUserGroups.length; i ++) {
				if (wgUserGroups[i] == 'sysop') iAmSysop = true;
			}
			if (iAmSysop == false) { return false; // do nothing!
			} else {
				// sysop check OK :).
				// launch controller.
				this.control	= new csdH_controller;
				control.attachLinks();
				return true;
			}
		} else { return false;  /* do nothing! */ }
	}
}

function csdH_controller() {
	
	
	this.attachLinks = function() {
		alert('test');
		this.csdHelperLink 						= new wa_element('li');
		this.csdHelperLink.ele_obj.id			= 'ca-decline';
		this.csdHelperLink.ele_obj.innerHTML	= '<a href="#" title="decline speedy">decline speedy</a>';
		//this.csdHelperLink.addWAEvent('click', function() { selfController.showWAWindow(); });
		
		this.csdHelperLink.attach(document.getElementById('ca-delete'), 'after');
	};
}



// -- run program
function launchCsdHelper() {
	// lib proto
	wa_window.prototype = new wa_document;
	wa_element.prototype = new wa_document;
	
	// init object
	var obj_csdHelper = new csdHelper;
	obj_csdHelper.launch();
	
	return true;
}

importScript('User:Ale_jrb/Scripts/waLib.js');
hookEvent('load', launchCsdHelper);