Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Created August 25, 2015 19:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mreidsma/e6e4f7442ebe7036afc4 to your computer and use it in GitHub Desktop.
Save mreidsma/e6e4f7442ebe7036afc4 to your computer and use it in GitHub Desktop.
Reformat silly tables in WebPAC Pro Advanced Search

In III's terrible OPAC, WebPAC Pro, the Advanced Search screen has all these little nested tables that just hold one label in a table cell and an imput in another. There is no reason they should be tables! So I wrapped each of the tokens in the Web Master with an id, and then wrote this silly function to remove the table markup and just give me labels and form elements. Then I used CSS to make it look the way it should, since this is 2015 and not 1997.

The fact that I had to write this function boggles my mind.

function stupidTables(id) {
var formTable = document.getElementById(id);
var formLabel = formTable.querySelector('td:first-child').innerHTML;
var formInput = formTable.querySelector('td:nth-child(2)').innerHTML;
formTable.innerHTML = formLabel + ' ' + formInput;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment