User:Mdd4696/monobook.js

This is an old revision of this page, as edited by Mdd4696 (talk | contribs) at 23:12, 25 January 2006 (Added closing x). 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.
// <pre><nowiki>

/************/
/* DEV CODE */
/************/

function addlilink(tabs, url, name, id, title, key){
	var na = document.createElement('a');
	na.href = url;
	na.appendChild(document.createTextNode(name));
	var li = document.createElement('li');
	if(id) li.id = id;
	li.appendChild(na);
	tabs.appendChild(li);
	if(id)
	{
		if(key && title)
		{
		    ta[id] = [key, title];
		}
		else if(key)
		{
		    ta[id] = [key, ''];
		}
		else if(title)
		{
		    ta[id] = ['', title];
		}
	}
	// re-render the title and accesskeys from existing code in wikibits.js
	akeytt();
	return li;
}

function addTab(url, name, id, title, key){
	var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
	return addlilink(tabs, url, name, id, title, key);
}

function generateTaggerBody() {
	var retVal = "";

	retVal += "<span onClick=\"this.parentNode.style.display = 'none';\">[×]</span>";
	retVal += "<input type='checkbox' /> No license";
	retVal += "<br />";
	retVal += "<input type='checkbox' /> No source";
	retVal += "<br />";
	retVal += "<input type='checkbox' /> Notify uploader";
	retVal += "<br />";
	retVal += "<input type='checkbox' /> Default summary";
	retVal += "<br />";
	retVal += "<input type='button' value='Tag image' />";

	return retVal;
}

function showTagger() {
	var taggerBox = document.createElement( "div" );

	taggerBox.style.background = "#CCCCFF";
	taggerBox.style.border = "1px solid #000000";
	taggerBox.style.height = "200px";
	taggerBox.style.right = "10px";
	taggerBox.style.padding = "2px";
	taggerBox.style.position = "absolute";
	taggerBox.style.top = "10px";
	taggerBox.style.width = "200px";
	taggerBox.style.zIndex = "100";

	taggerBox.innerHTML = generateTaggerBody();

	document.body.appendChild( taggerBox );
}

// Image Autotagger Deluxe
addOnloadHook( function() {
    
	if ( document.title.indexOf( "Image:" ) == 0 ) {
		addTab( "javascript:showTagger()", "Add License", "ca-tagimage", "Tag this image with the proper licensing", "" );
	}

});

/**************/
/* OTHER CODE */
/**************/

/**** afd helper ****/
document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Jnothman/afd_helper/' +
  'script.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/* This is to keep track of who is using this extension: [[User:Jnothman/afd_helper/script.js]] */

popupAdminLinks = true;
popupFixDabs = true;

function doNoSource() {
  //var uploader = prompt('Name of uploader', '');
  document.editform.wpTextbox1.value = "{" + "{no source|day={{subs" +"t:CURRENTDAY}}|month={{subs"+"t:CURRENTMONTHNAME}}|year={{subs"+"t:CURRENTYEAR}}}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "+no source";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = true;
  document.editform.submit();
}

function doNoLicense() {
  //var uploader = prompt('Name of uploader', '');
  document.editform.wpTextbox1.value = "{" + "{no license|day={{subs" +"t:CURRENTDAY}}|month={{subs"+"t:CURRENTMONTHNAME}}|year={{subs"+"t:CURRENTYEAR}}}}\n\n" + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = "+no license";
  document.editform.wpMinoredit.checked = false;
  document.editform.wpWatchthis.checked = true;
  document.editform.submit();
}

function addNoSource() {
  addTab("javascript:doNoSource()", "no source", "ca-nosource", "Tag as No source", "");
  akeytt();
}

function addNoLicense() {
  addTab("javascript:doNoLicense()", "no license", "ca-nolicense", "Tag as No license", "");
  akeytt();
}

if (document.title.indexOf("Editing Image:") == 0) {
  if (window.addEventListener) window.addEventListener("load", addNoSource, false);
    else if (window.attachEvent) window.attachEvent("onload", addNoSource);

  if (window.addEventListener) window.addEventListener("load", addNoLicense, false);
    else if (window.attachEvent) window.attachEvent("onload", addNoLicense);
}

// </nowiki></pre>