var horseLandFixUpdateButton = { main: function() { var textarea = ''; // To point to the textarea element on the page. // Get text textareas on the page (should only be 1). var textareas = content.document.getElementsByTagName('textarea'); // Find textarea with name of 'ddescription'. for (var i = 0; i < textareas.length; i++) { if (textareas[i].name == 'ddescription') { textarea = textareas[i]; break; } } // If it doesn't exist, then return. if (!textarea) return; // If the submit button has been added, then don't execute this script again. var submitButtonAdded = content.document.getElementById('submitButton'); if (submitButtonAdded != null) return; // Get the parent table. var table = textarea.parentNode.parentNode.parentNode.parentNode; // Set the width to 100%. table.width = '100%'; // Get the parent table of the table above. var outerTable = table.parentNode.parentNode.parentNode.parentNode; // Create an Array of elements contained within that table. var outerTableChildNodes = outerTable.lastChild.childNodes; // Set the row variables. var r0 = outerTableChildNodes[0]; var r1 = outerTableChildNodes[2]; // Remove colspan property from the first row. r0.colspan = ''; var td1 = r1.childNodes[2]; // Hide the end TD element of the last row which contains the ill-placed submit image. td1.style.display = 'none'; // Create the submit button. var submitButton = document.createElement('input'); submitButton.setAttribute('type', 'submit'); submitButton.id = 'submitButton'; submitButton.setAttribute('value', 'Save Changes'); submitButton.setAttribute('name', 'Save Changes'); // Resize the textarea to 100% width. textarea.style.width = '100%'; // Make textarea higher. textarea.rows = "50"; // Append the submit button. textarea.parentNode.appendChild(submitButton); } }