aboutsummaryrefslogtreecommitdiffstats
path: root/main.js
diff options
context:
space:
mode:
authorTeddy Wing2015-08-01 15:41:43 -0400
committerTeddy Wing2015-08-01 15:41:43 -0400
commit54b0fcdb81e5b2788f5146b321e516f72c51b708 (patch)
tree1773380c748dfc4383a76d5145e5139aa243cc2e /main.js
parent6e0027c1bf2683cc6fe951226efb38458fc352cf (diff)
downloadjira-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.
Diffstat (limited to 'main.js')
-rw-r--r--main.js16
1 files changed, 16 insertions, 0 deletions
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);
+ }
+ );
+})();