User:Lupin/addlicense.js

// var addlicenseVersion="Tue Sep 13 09:55:04 EDT 2005";

function addLicense_sourceJS(url) { var str=' '; return document.write(str); };

function addLicense_sourceWikipediaJS(wiki, name) { var url='http://' + wiki + '/w/index.php?title='; url += name; url += '&action=raw&ctype=text/javascript&dontcountme=s'; return sourceJS(url); };

function addLicense_sourceLupinJS(name) { return sourceWikipediaJS('en.wikipedia.org', 'User:Lupin/'+name + '.js'); };

if (!autoEdit){ addLicense_sourceLupinJS('autoedit'); }

var licenseBoxHTML='		\\n			 None selected \\n			GNU Free Documentation Licenses: \\n	 #redirect Template:GFDL \\n	  GFDL (self made) \\nCreative Commons licenses: \\n\\n	  Attribution ShareAlike 2.5 \\n	  Attribution 2.5 \\nNo rights reserved (must be explicitly stated by author): \\n	  No rights reserved, author releases all rights \\n	  Copyrighted, free to use for any purpose \\nPublic Domain / not copyrighted: \\n	  PD (self made): donate to public domain / release all rights \\n\\n	  PD (old): author died more than 100 years ago \\n	  PD (United States): first published in the United States before 1923 \\n	  Work of a US Government agency - public domain \\n	<option value="PD-Soviet" title="PD-Soviet">  Work published in the Soviet Union before May 27, 1973 - public domain \\n	<option value="PD-BY-exempt" title="PD-BY-exempt">  Work published by the Government of Belarus \\n	<option value="patent" title="patent">  Patent material - public domain \\n\\n	<option value="PD-stamp" title="PD-stamp">  Postage stamps known to be in public domain (US before 1978, others) \\n	<option value="PD" title="PD">  Public domain (generic) \\n<option value="" disabled="disabled">Non-free licenses: \\n	<option value="CopyrightByWikimedia" title="CopyrightByWikimedia">  Images copyrighted by Wikimedia \\n<option value="" disabled="disabled">Fair use / copyrighted: \\n	<option value="Coatofarms" title="Coatofarms">  Coat of arms, seal, emblem, or crest \\n	<option value="logo" title="logo">  Logo \\n\\n	<option value="Promotional" title="Promotional">  Press release photo \\n	<option value="smithsonian" title="smithsonian">  Image from the Smithsonian Institution \\n	<option value="Stamp" title="Stamp">  Fair use postage stamp, where copyright depends on country \\n	<option value="USPSstamp" title="USPSstamp">  - U.S. postage stamp after 1978 \\n<option value="" disabled="disabled">Covers: \\n	<option value="albumcover" title="albumcover">  Album cover \\n\\n	<option value="boardgamecover" title="boardgamecover">  Board game cover \\n	<option value="bookcover" title="bookcover">  Book cover \\n	<option value="Comiccover" title="Comiccover">  Comic book cover \\n	<option value="Comicpanel" title="Comicpanel">  - Single comic book panel \\n	<option value="Comicscene" title="Comicscene">  - Series of panels from a comic strip \\n	<option value="DVDcover" title="DVDcover">  DVD cover \\n\\n	<option value="Gamecover" title="Gamecover">  Video game cover \\n	<option value="Magazinecover" title="Magazinecover">  Magazine cover \\n	<option value="TIME" title="TIME">  - TIME Magazine cover \\n	<option value="Newspapercover" title="Newspapercover">  Newspaper cover \\n	<option value="Video tape cover" title="Video tape cover">  Video tape cover \\n<option value="" disabled="disabled">Posters (must be reduced quality images): \\n\\n	<option value="Movieposter" title="Movieposter">  Movie poster \\n	<option value="Sportsposter" title="Sportsposter">  Sports event poster \\n	<option value="Eventposter" title="Eventposter">  Generic event poster \\n	<option value="Politicalposter" title="Politicalposter">  Politcal event poster \\n<option value="" disabled="disabled">Screenshots (one per article): \\n	<option value="film-screenshot" title="film-screenshot">  Movie or TV screenshot \\n\\n	<option value="game-screenshot" title="game-screenshot">  Computer game or video game screenshot \\n	<option value="musicpromo-screenshot" title="musicpromo-screenshot">  Music video or music promo screenshot \\n	<option value="software-screenshot" title="software-screenshot">  Software screenshot \\n	<option value="mac-software-screenshot" title="mac-software-screenshot">  - Macintosh software screenshot \\n	<option value="windows-software-screenshot" title="windows-software-screenshot">  - Windows software screenshot \\n	<option value="web-screenshot" title="web-screenshot">  Web page screenshot \\n\\n	<option value="wikipedia-screenshot" title="wikipedia-screenshot">  Wikipedia web page screenshot \\n	<option value="otherlicence" title="otherlicence">  Other: this placeholder must be replaced by a proper tag \\n\\n		 <a id="doLicenseLink"></a>';

function addLicense_addLicenseBox { var t=document.createElement('div'); t.innerHTML=licenseBoxHTML;

var h=document.getElementsByTagName('h2')[0]; if (!h) return; h.parentNode.insertBefore(t,h);

// set global var licenseBox here window.licenseBox=document.getElementById('wpLicense'); doLicenseLink=document.getElementById('doLicenseLink');

licenseBox.onchange=addLicense_licenseBox_onChange; };

function addLicense_articleFromURL(h) { var thisWiki='en.wikipedia.org'; var reStart='[^:]*://'; var preTitles='wiki/|w/index\\.php\\?title='; // if (!wikimediaWiki) preTitles += '|index\\.php\\?title='; var reEnd='/(' + preTitles + ')([^&]*)'; var re = RegExp(reStart + thisWiki.split('.').join('\\.') + reEnd);

var m=re.exec(h); if(m===null) return null; article=m[2]; return article; };

function addLicense_licenseBox_onChange { var article=addLicense_articleFromURL(document.location); var url='http://en.wikipedia.org/w/index.php?title=' + article; url += '&action=edit'; url +='&autoedit=s~$~\\n~'; url +='&autosummary=Added license '; if (false) url +='&autoclick=wpDiff'; doLicenseLink.href=url; doLicenseLink.innerHTML='Add the selected license'; };

function addLicense_addOnloadFunction (f) { if (window.addEventListener) window.addEventListener("load",f,false); else if (window.attachEvent) window.attachEvent("onload",f); else { window._old_addLicense_onload = window.onload; window.onload = function{ window._old_addLicense_onload; f; } } };

function addLicense_isImagePage { var h=String(document.location); return RegExp('(title=|wiki/):?Image:').test(h); return false; };

function addLicense_onloadFunction { if (addLicense_isImagePage) addLicense_addLicenseBox; }

addLicense_addOnloadFunction(addLicense_onloadFunction); //