diff options
| author | Teddy Wing | 2015-08-01 15:41:43 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-08-01 15:41:43 -0400 |
| commit | 54b0fcdb81e5b2788f5146b321e516f72c51b708 (patch) | |
| tree | 1773380c748dfc4383a76d5145e5139aa243cc2e | |
| parent | 6e0027c1bf2683cc6fe951226efb38458fc352cf (diff) | |
| download | jira-whozits-54b0fcdb81e5b2788f5146b321e516f72c51b708.tar.bz2 | |
Add main.js: Try to set ids on person headers
Get all person header elements and set the name of the person they
correspond to as their id. Doesn't currently work because it seems that
the headers get loaded via AJAX or something after the page has loaded,
so we'll need to wait until they show up on the page before manipulating
them.
| -rw-r--r-- | main.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +(function() { + var jira_person_header_class_name = '.ghx-heading'; + + // Removes spaces from a string + function slugify (str) { + return str.replace(/ /g, ''); + } + + Array.prototype.forEach.call( + document.querySelectorAll(jira_person_header_class_name), + function(element) { + element.setAttribute('id', slugify(element.firstChild.textContent)); + console.log(element); + } + ); +})(); |
