User:Silverfish/actorlisting.js

function func_start{ if (document.editform){ addPortletLink ("p-cactions", "javascript:doMakeListing", "Make Listing");} }

$(func_start);

function addbrackets(s){ return "" + s + ""; }

function doMakeListing{ name = prompt("Enter Name"); name = "*" + addbrackets(name) + " "; credits = []; newcredit = prompt("Enter Credit"); n = 0; while (newcredit.length > 0){ credits[n++] = "\'\'" + addbrackets(newcredit)+ "\'\'"; newcredit = prompt("Enter Credit"); } var text = document.editform.wpTextbox1; text.value += name + "(" + credits.join(", ") + ")"; }