User:Karl Dickman/airbuttons.js

//

if(navigator.appName=='Netscape') {

function infoBox(n,i,c,t,m,ms,d,f,introduced,r,s,p,u,pr,nb,uc,v) { insertTags(,,'\n'); insertTags(,,'}}\n');

}

function infoBoxRaw { insertTags(,,'\n'); insertTags(,,'}}\n'); }

function popupInfobox { var popup = window.open('about:blank','WPtable','height="350",width="400",scrollbars="yes"');

javaCode = 'function insertCode{\n'; javaCode += 'var name = parseInt(document.paramForm.inputName.value);\n'; javaCode += 'var image = parseInt(document.paramForm.inputImage.value);\n'; javaCode += 'var caption = parseInt(document.paramForm.inputCaption.value);\n'; javaCode += 'var type = parseInt(document.paramForm.inputType.value);\n'; javaCode += 'var manufacturer = parseInt(document.paramForm.inputManufacturer.value);\n'; javaCode += 'var manufacturersIsPlural = document.paramForm.inputManufacturerPlurality.value;\n'; javaCode += 'var designer = parseInt(document.paramForm.inputDesigner.value);\n'; javaCode += 'var firstFlight = parseInt(document.paramForm.inputFirstFlight.value);\n'; javaCode += 'var introduced = parseInt(document.paramForm.inputIntroduced.value);\n'; javaCode += 'var retired = parseInt(document.paramForm.inputRetired.value);\n'; javaCode += 'var status = parseInt(document.paramForm.inputStatus.value);\n'; javaCode += 'var PUser = parseInt(document.paramForm.inputPUser.value);\n'; javaCode += 'var users = parseInt(document.paramForm.inputUsers.value);\n'; javaCode += 'var produced = parseInt(document.paramForm.inputProduced.value);\n'; javaCode += 'var numberBuilt = parseInt(document.paramForm.inputNB.value);\n'; javaCode += 'var unitCost = parseInt(document.paramForm.inputUnitCost.value);\n'; javaCode += 'var variants = parseInt(document.paramForm.inputVariants.value);\n'; javaCode += 'var inputHeader = document.paramForm.inputHeader.checked;\n'; javaCode += 'if((caption=="Please use a descriptive caption.")||(caption=="")) {caption="";}\n'; javaCode += 'if((PUser=="Please list only one.")||(PUser=="")) {PUser="";}\n'; javaCode += 'if((users=="Up to three more. Please separate with &lt;br/&gt;.")||(users="")) {users="";}\n'; javaCode += 'window.opener.infoBox(name,image,caption,type,manufacturer,manufacturersIsPlural,designer,firstFlight,introduced,retired,status,PUser,users,produced,numberBuilt,unitCost,variants);\n'; javaCode += 'window.close;\n' javaCode += '}\nfunction infoBoxRaw{window.opener.infoBoxRaw;}\n ';

popup.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'); popup.document.write('  Insert infobox \n'); popup.document.write(' \n'); popup.document.write('/*<![CDATA[*/ @import "/skins-1.5/wikistandard/main.css?5"; /*]]>*/ \n'); popup.document.write('/*<![CDATA[*/ @import \'http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.css&action=raw&ctype=text/css&dontcountme=s?5\';/*]]>*/ \n'); popup.document.write(javaCode); popup.document.write(' \n'); popup.document.write('\n'); popup.document.write(' \n'); popup.document.write(' \n'); popup.document.write(' Insert infobox | Insert raw infobox    |\n'); popup.document.write('   Cancel \n'); popup.document.write(' \n   \n  '); popup.document.write(' \n'); popup.document.close; }

function specifications { alert("Will be completed at a later date."); }

function aircraftButton { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/17/Button_aircraft.png", "speedTip": "Header", "tagOpen": "", "tagClose": "", "sampleText": ""}

var toolbar=document.getElementById('toolbar'); if (!toolbar) return false; var textbox=document.getElementById('wpTextbox1'); if (!textbox) return false; if (!document.selection && textbox.selectionStart == null) return false; var image1=document.createElement("img"); image1.width = 23; image1.height = 22; image1.src = 'http://upload.wikimedia.org/wikipedia/commons/1/17/Button_aircraft.png'; image1.border = 0; image1.alt = 'Infobox'; image1.title = 'Insert WikiProject Aircraft infobox'; image1.style.cursor = "pointer"; image1.onclick = function { popupInfobox; return false; }

var image2=document.createElement("img"); image2.width=23; image2.height=22; image2.src='http://upload.wikimedia.org/wikipedia/commons/1/17/Button_aircraft.png'; image2.border=0; image2.alt='Specs'; image2.title='Insert WikiProject Aircraft specifications section'; image2.style.cursor='pointer'; image2.onclick=function { specifications; return false; } toolbar.appendChild(image1); toolbar.appendChild(image2); }

$(aircraftButton);

}