Skip to content

Instantly share code, notes, and snippets.

@jjulian
Last active March 24, 2022 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjulian/d3b7d808ff0f79b65988edca2c94968c to your computer and use it in GitHub Desktop.
Save jjulian/d3b7d808ff0f79b65988edca2c94968c to your computer and use it in GitHub Desktop.
UserScript - Make navigating namely team trees easier
// ==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