User:Hotbot/addlicense.js
From Homestar Runner Wiki
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Mozilla / Firefox: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac)
- Safari: press Cmd-Option-E
- IE: hold Ctrl while clicking Refresh, or press Ctrl-F5
- Konqueror: simply click the Reload button, or press F5
- Opera users may need to completely clear their cache in Tools→Preferences.
var addlicenseVersion="Tue Sep 13 09:55:04 EDT 2005"; function addLicense_sourceJS(url) { var str='<script type="text/javascript" src="'; str += url; str += '"></script>'; 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=' <select id="wpLicense" name="wpLicense">\\n <option value="">None selected</option>\\n <option value="" disabled="disabled">GNU Free Documentation Licenses:</option>\\n <option value="GFDL" title="GFDL"> #redirect [[Template:GFDL]]</option>\\n <option value="GFDL-self" title="GFDL-self"> GFDL (self made)</option>\\n<option value="" disabled="disabled">Creative Commons licenses:</option>\\n\\n <option value="cc-by-sa-2.5" title="cc-by-sa-2.5"> Attribution ShareAlike 2.5</option>\\n <option value="cc-by-2.5" title="cc-by-2.5"> Attribution 2.5</option>\\n<option value="" disabled="disabled">No rights reserved (must be explicitly stated by author):</option>\\n <option value="NoRightsReserved" title="NoRightsReserved"> No rights reserved, author releases all rights</option>\\n <option value="CopyrightedFreeUse" title="CopyrightedFreeUse"> Copyrighted, free to use for any purpose</option>\\n<option value="" disabled="disabled">Public Domain / not copyrighted:</option>\\n <option value="PD-self" title="PD-self"> PD (self made): donate to public domain / release all rights</option>\\n\\n <option value="PD-old" title="PD-old"> PD (old): author died more than 100 years ago</option>\\n <option value="PD-US" title="PD-US"> PD (United States): first published in the United States before 1923</option>\\n <option value="PD-USGov" title="PD-USGov"> Work of a US Government agency - public domain</option>\\n <option value="PD-Soviet" title="PD-Soviet"> Work published in the Soviet Union before May 27, 1973 - public domain</option>\\n <option value="PD-BY-exempt" title="PD-BY-exempt"> Work published by the Government of Belarus</option>\\n <option value="patent" title="patent"> Patent material - public domain</option>\\n\\n <option value="PD-stamp" title="PD-stamp"> Postage stamps known to be in public domain (US before 1978, others)</option>\\n <option value="PD" title="PD"> Public domain (generic)</option>\\n<option value="" disabled="disabled">Non-free licenses:</option>\\n <option value="CopyrightByWikimedia" title="CopyrightByWikimedia"> Images copyrighted by Wikimedia</option>\\n<option value="" disabled="disabled">Fair use / copyrighted:</option>\\n <option value="Coatofarms" title="Coatofarms"> Coat of arms, seal, emblem, or crest</option>\\n <option value="logo" title="logo"> Logo</option>\\n\\n <option value="Promotional" title="Promotional"> Press release photo</option>\\n <option value="smithsonian" title="smithsonian"> Image from the Smithsonian Institution</option>\\n <option value="Stamp" title="Stamp"> Fair use postage stamp, where copyright depends on country</option>\\n <option value="USPSstamp" title="USPSstamp"> - U.S. postage stamp after 1978</option>\\n<option value="" disabled="disabled">Covers:</option>\\n <option value="albumcover" title="albumcover"> Album cover</option>\\n\\n <option value="boardgamecover" title="boardgamecover"> Board game cover</option>\\n <option value="bookcover" title="bookcover"> Book cover</option>\\n <option value="Comiccover" title="Comiccover"> Comic book cover</option>\\n <option value="Comicpanel" title="Comicpanel"> - Single comic book panel</option>\\n <option value="Comicscene" title="Comicscene"> - Series of panels from a comic strip</option>\\n <option value="DVDcover" title="DVDcover"> DVD cover</option>\\n\\n <option value="Gamecover" title="Gamecover"> Video game cover</option>\\n <option value="Magazinecover" title="Magazinecover"> Magazine cover</option>\\n <option value="TIME" title="TIME"> - TIME Magazine cover</option>\\n <option value="Newspapercover" title="Newspapercover"> Newspaper cover</option>\\n <option value="Video tape cover" title="Video tape cover"> Video tape cover</option>\\n<option value="" disabled="disabled">Posters (must be reduced quality images):</option>\\n\\n <option value="Movieposter" title="Movieposter"> Movie poster</option>\\n <option value="Sportsposter" title="Sportsposter"> Sports event poster</option>\\n <option value="Eventposter" title="Eventposter"> Generic event poster</option>\\n <option value="Politicalposter" title="Politicalposter"> Politcal event poster</option>\\n<option value="" disabled="disabled">Screenshots (one per article):</option>\\n <option value="film-screenshot" title="film-screenshot"> Movie or TV screenshot</option>\\n\\n <option value="game-screenshot" title="game-screenshot"> Computer game or video game screenshot</option>\\n <option value="musicpromo-screenshot" title="musicpromo-screenshot"> Music video or music promo screenshot</option>\\n <option value="software-screenshot" title="software-screenshot"> Software screenshot</option>\\n <option value="mac-software-screenshot" title="mac-software-screenshot"> - Macintosh software screenshot</option>\\n <option value="windows-software-screenshot" title="windows-software-screenshot"> - Windows software screenshot</option>\\n <option value="web-screenshot" title="web-screenshot"> Web page screenshot</option>\\n\\n <option value="wikipedia-screenshot" title="wikipedia-screenshot"> Wikipedia web page screenshot</option>\\n <option value="otherlicence" title="otherlicence"> Other: this placeholder must be replaced by a proper tag</option>\\n\\n </select><br><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{{' + window.licenseBox.value + '}}~'; url +='&autosummary=Added license {{'+licenseBox.value +'}}'; 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);