Created
June 4, 2019 06:23
-
-
Save dennmuel/4e04040fb6e31162abde66cbc70c28f2 to your computer and use it in GitHub Desktop.
Hide id subfield in eprints workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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