Gebruiker:Erwin85/CH2Plus.js
Van Wikipedia
Hulp bij het instellen van uw voorkeuren Let op! Nadat u de veranderingen heeft opgeslagen, moet u de cache van uw browser nog legen om ze daadwerkelijk te zien.
Mozilla (incl. Firefox) | Ctrl+Shift+R |
Internet Explorer | Ctrl+F5 |
Opera | F5 |
Safari | Cmd+R |
Konqueror | F5 |
// CommonsHelper Helper Plus (CH²+) by Erwin85 // Released into the public domain // Based on // CommonsHelper Helper (CH²) by Krimpet // [[:en:User:Krimpet/CH2.js]] ([[:en:User:Krimpet/CommonsHelper Helper]]) var ch2_wplanguage = "nl"; var ch2_chlanguage = "en"; var ch2_edittitle_Prefix = "Bezig met het bewerken van Afbeelding:"; var ch2_edittitle_Postfix = ""; var ch2_string_SpecifyNewName = "Nieuwe naam"; var ch2_string_UseWikiSense = "Gebruik WikiSense"; var ch2_string_StartCommonsHelper = "Start CommonsHelper"; var ch2_string_FinishedUploading = "Voltooid"; var ch2_string_Done = "Controleer onderstaande tekst en sla deze pagina op."; var ch2_string_MoveToCommons = "Verplaats naar Commons"; var ch2_string_EditSummary_Prefix = "Afbeelding is verplaatst naar [[:Commons:"; var ch2_string_ShowEditform = "Toon bewerkingspagina"; var ch2_string_HideEditform = "Verberg bewerkingspagina"; var ch2_string_EditSummary_Postfix = "]] met [[Gebruiker:Erwin85/CH2Plus|CH²+]]."; var ch2_string_Delete = "Verwijder pagina" var ch2_deletelink = false; var ch2_template_ncd = "NuCommons"; var ch2_templates_copy = new Array( "NowCommons", "nowCommons", "nuCommons", "nowcommons", "Nowcommons", "Nucommons", "nucommons", "NCT", "nCT", "Nct", "nct", "to Commons" ); var ch2_templates_embed = new Array(0); var ch2 = null; var ch2frame = null, ch2framedoc = null; var newName = ""; var imageTitle = ""; function ch2Form() { ch2.innerHTML = "<b>" + ch2_string_SpecifyNewName + " <input id=\"newnamet\"><br /><input id=\"csense\" type=checkbox value=1 /><b>" + ch2_string_UseWikiSense + "</b><br /><button onClick=\"ch2Start();\">" + ch2_string_StartCommonsHelper + "</button>"; } function ch2Start() { document.editform.style.display = "none" newName = document.getElementById("newnamet").value; var sense = document.getElementById("csense").checked; ch2.innerHTML = "<iframe name=\"CH2iframe\" id=\"CH2iframe\" height=\"500\" width=\"100%\"></iframe><br/><button onClick=\"ch2Finalize()\">" + ch2_string_FinishedUploading + "</button><button id=\"ch2showhideform\" onClick=\"ch2Editform()\">" + ch2_string_ShowEditform + "</button>"; ch2frame = document.getElementById("CH2iframe"); ch2framedoc = ch2frame.contentDocument; if (ch2framedoc == undefined || ch2framedoc == null) ch2framedoc = ch2frame.contentWindow.document; ch2framedoc.open(); ch2framedoc.write("Enter a wikipedia language code and image name, and it will generate an image description to copy-and-paste for the commons upload form.</small><br/><form action=\'http://tools.wikimedia.de/~magnus/commonshelper.php?interface=" + ch2_chlanguage + "\' method=\'post\'>Language code: <input type=text name=language value=\'" + ch2_wplanguage + "\' cols=4/><br/>Image name: <input type=text name=image value=\'" + imageTitle + "\' cols=30/><br/>New name: <input type=text name=newname value=\'" + newName + "\' cols=30/> (for direct upload only; leave blank to keep original name)<br/>Project: <input type=text name=project value=\'wikipedia\' cols=30/> (may also be wikibooks or wikisource)<br/><input type=checkbox name=commonsense value=1 " + (sense ? "checked" : "") + " />Use WikiSense to suggest categories<br/><input type=submit name=doit value=\'Get text\'/></form><script>document.forms[0].doit.click();</script>"); ch2framedoc.close(); } function ch2Finalize() { ncd = "{{" + ch2_template_ncd + (newName != "" ? "|Image:" + newName : "") + "}}"; editBox = document.editform.wpTextbox1; for (var i = 0; i < ch2_templates_copy.length; i++) editBox.value = editBox.value.replace("\{\{" + ch2_templates_copy[i] + "\}\}", ncd); for (var i = 0; i < ch2_templates_embed.length; i++) editBox.value = editBox.value.replace("\{\{" + ch2_templates_embed[i] + "\}\}", "\{\{" + ch2_templates_embed[i] + "|commons=" + ncd + "\}\}"); if (editBox.value.indexOf(ncd) == -1) editBox.value += "\n" + ncd; document.editform.wpSummary.value = ch2_string_EditSummary_Prefix + (newName != "" ? "Image:" + newName : "Image:" + imageTitle) + ch2_string_EditSummary_Postfix; ch2.innerHTML = "<b>" + ch2_string_Done + "</b>" + (ch2_deletelink == true ? " - <a href=\"http://" + ch2_wplanguage + ".wikipedia.org/w/index.php?title=Afbeelding:" + imageTitle + "&action=delete&wpReason=" + ch2_string_EditSummary_Prefix + (newName != "" ? "Image:" + newName : "Image:" + imageTitle) + ch2_string_EditSummary_Postfix + "&confirmdelete" + "\">" + ch2_string_Delete + "</a>" : "") document.editform.style.display = "inline" } function ch2Editform() { editform = document.editform; showbutton = document.getElementById("ch2showhideform"); if (editform.style.display == "none"){ editform.style.display = "inline"; showbutton.value = ch2_string_HideEditform; showbutton.innerHTML = ch2_string_HideEditform; } else { editform.style.display = "none"; showbutton.value = ch2_string_ShowEditform; showbutton.innerHTML = ch2_string_ShowEditform; } } function ch2Init() { if (typeof ch2I18N != "undefined") ch2I18N(); var pageTitle = document.getElementsByTagName('h1')[0].firstChild.nodeValue; if (pageTitle.substring(0, ch2_edittitle_Prefix.length) != ch2_edittitle_Prefix || pageTitle.substring(pageTitle.length - ch2_edittitle_Postfix.length) != ch2_edittitle_Postfix) return; imageTitle = pageTitle.substring(ch2_edittitle_Prefix.length, pageTitle.length - ch2_edittitle_Postfix.length) if (/*document.editform.wpTextbox1.value.indexOf(ch2_template_ncd) == -1 && document.editform.wpTextbox1.value.indexOf("subst:" + ch2_template_ncd) == -1 &&*/ document.getElementById("wikiPreview").innerHTML.length == 0) { document.getElementById("toolbar").innerHTML = document.getElementById("toolbar").innerHTML + "<br /><br /><div id=\"CH2div\"></div>"; ch2 = document.getElementById("CH2div"); ch2.innerHTML = "<button onClick=\"ch2Form();\">" + ch2_string_MoveToCommons + "</button>"; } } addOnloadHook(ch2Init);