From 54b0fcdb81e5b2788f5146b321e516f72c51b708 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 1 Aug 2015 15:41:43 -0400 Subject: 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. --- main.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 main.js diff --git a/main.js b/main.js new file mode 100644 index 0000000..b7bc92b --- /dev/null +++ b/main.js @@ -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); + } + ); +})(); -- cgit v1.2.3