Skip to content

Instantly share code, notes, and snippets.

@dennmuel
Created June 4, 2019 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennmuel/4e04040fb6e31162abde66cbc70c28f2 to your computer and use it in GitHub Desktop.
Save dennmuel/4e04040fb6e31162abde66cbc70c28f2 to your computer and use it in GitHub Desktop.
Hide id subfield in eprints workflow
function hideMailfield() {
var ths = document.querySelectorAll('[id*="_creators_th_"], [id*="_editors_th_"]');
var inputs = document.querySelectorAll('[class*="ep_eprint_creators_id"], [class*="ep_eprint_editors_id"]');
var tds = [];
ths.forEach(function(item) {
if (/^.*mail.*$/gmi.test(item.innerHTML))
{
item.style.display = "none";
}
});
inputs.forEach(function(input) {
tds.push(input.parentNode);
});
tds.forEach(function(td) {
td.style.display = "none";
});
}
// Run this when the page is loaded...
document.observe("dom:loaded", hideMailfield);
// ... and after an ajax button has been clicked (e.g. "add more rows")
Ajax.Responders.register({onComplete: hideMailfield});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment