User:Auaubykddi/common.js

mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );

function newPhonePage { var textarea = document.getElementById('wpTextbox1'); var brand = prompt("This script creates a new phone article with a specified brand and model. Make sure there is no existing text in the editor area. Phone brand?"); if (!brand) return; var model = prompt("Phone model?"); if (!model) return; textarea.value = "\n\nThe "+brand+" "+model+" is a __ announced in __ and released in __.\n\n== Variants ==\n* \n\n== Related phones ==\n* \n\n== Specs ==\n\n\n\n\n\n\n\n\n\n\n\n\n== Pre-loaded content ==\n=== Apps ===\n=== Games ===\n=== Themes ===\n\n== Accessories ==\n=== Batteries ===\n\n=== Chargers ===\n\n== Gallery ==\n\n\n== References ==\n\n"+"["+"[Category:"+brand+" phones]]"; }

var btn = document.createElement('button'); btn.type = 'button'; // important! by default, button inside html form will submit the form btn.onclick = newPhonePage; btn.innerHTML = "New phone page";

// Have to set timeout to wait for the editor to load function addButton { try { document.getElementById("wikiEditor-section-main").appendChild(btn); }	catch (e) { setTimeout(addButton, 200); } } addButton;