Last active
March 24, 2022 22:05
-
-
Save jjulian/d3b7d808ff0f79b65988edca2c94968c to your computer and use it in GitHub Desktop.
UserScript - Make navigating namely team trees easier
This file contains hidden or 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
// ==UserScript== | |
// @name Namely Team Links | |
// @version 0.2 | |
// @description Make navigating namely team trees easier - adds a "team" link next to every profile link | |
// @namespace https://adhocteam.us/ | |
// @author jjulian | |
// @match https://adhoc.namely.com/* | |
// @icon https://cdn2.iconfinder.com/data/icons/user-interface-essentials-outline/48/ui-49-1024.png | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let allLinks = Array.from(document.getElementsByTagName('a')) | |
// all links start the same, but people links truncate after the guid | |
let peopleLinks = allLinks.filter(tag => /^\/people\/[\d\w\-]+$/.test(tag.getAttribute('href'))) | |
peopleLinks.forEach(tag => { | |
let teamLink = document.createElement("a") | |
teamLink.innerText = ' (teams)' | |
teamLink.setAttribute('href', tag.getAttribute('href') + '/show/teams-allocations/teams/') | |
tag.insertAdjacentElement('afterend', teamLink) | |
//console.log(teamLink.href) | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment