Make it check for bad characters (think “|”, which mediawiki doesn’t like in names and parameters, and everything else here: https://www.mediawiki.org/wiki/Manual:Page_title; make it do something for empty titles, so I don’t get redirected to the main page; put together all of this and upload it to github?

The final bookmarklet looks like this:

1

javascript:varlines='';varlines=$('#wpTextbox1').val().split('\n');for(i=0;i<7;i++){if(typeof lines[i]=='undefined'){lines[i]='';}}if(!ValidURL(lines[0])){alert(lines[0]+" doesn't look like a valid URL.")};if(lines[1]==''){lines[1]=lines[0]};if(lines[2]==''){lines[2]='5'};if(lines[3]==''){lines[3]='5'};if(parseInt(lines[2])>10||parseInt(lines[2])<0||isNaN(lines[2])){alert(lines[2]+'is not a valid value, setting to default 5');lines[2]='5';}if(parseInt(lines[3])>10||parseInt(lines[3])<0||isNaN(lines[3])){alert(lines[3]+'is not a valid value, setting to default 5');lines[3]='5';}varkeywords="\n{{#set:\n";keywords+="k=";keywords+=lines[5];keywords+="\n|+sep=, }}\n";varcategories="\n";for(i=0;i<lines.length-7;i++){categories+="[[Category: ";categories+=lines[i+7];categories+="]]\n";}vartext="{{B|\n"+lines[0]+"\n|"+lines[1]+"\n|"+lines[2]+"\n|"+lines[3];if(lines[4]!='')text+="\n|"+lines[4];text+="\n}}";text+=keywords;text+=categories;varfield=document.getElementById('wpTextbox1');vartextArray=field.value.split("\n");textArray.splice(0,lines.length);textArray[0]=text;field.value=textArray.join("\n");functionValidURL(str){varpattern=newRegExp('^(https?:\\/\\/)?'+'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+'((\\d{1,3}\\.){3}\\d{1,3}))'+'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+'(\\?[;&a-z\\d%_.~+=-]*)?'+'(\\#[-a-z\\d_]*)?$','i');returnpattern.test(str);}

Unrelated to the above:

Apparently, after N years of studying programming and tweaking/optimizing whatever incarnation of my workspace, I’m getting it. Like, you can really solve your own problems by writing your own code?! Wow!

What happens next? I’m gonna go around writing extensions and stuff? How was the quote: “Be a man, write your own drivers!”

Regardless, this small and dead-simple bookmarklet that solves my own problems has done much more for my motivation than anything else I’ve ever tried in the last couple of years.