Last active
October 21, 2020 17:16
-
-
Save carloscheddar/da213d4f76e83a4ed7d74924dadc0e30 to your computer and use it in GitHub Desktop.
Replaces estimation symbols with easy to read numbers.
This file contains 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 Readable estimations | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Replaces estimation symbols with easy to read numbers. | |
// @author Carlos Feliciano-Barba | |
// @match https://www.pivotaltracker.com/n/projects/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
(new MutationObserver(check)).observe(document, {childList: true, subtree: true}); | |
function check(changes, observer) { | |
// Disconnect the observer once the elements are rendered | |
if(document.querySelector('span[class^="StoryPreviewItem__metaItem"]')) { | |
observer.disconnect(); | |
// Replace symbols in estimated stories | |
var toHide = document.querySelectorAll('span[class^="StoryPreviewItem__metaItem"]'); | |
var toShow = document.querySelectorAll('span[class^="StoryPreviewItem__estimateText"]'); | |
toHide.forEach((el) => (el.style.display = 'none')); | |
toShow.forEach((el) => (el.style.display = 'flex')); | |
// Replace symbols in unestimated stories | |
var buttons = document.querySelectorAll('.StoryPreviewItemButtons__estimateButton'); | |
Array.prototype.forEach.call(buttons, function(button, i){ | |
var image = button.querySelector('img'); | |
image.parentNode.removeChild(image); | |
button.innerHTML = button.attributes['data-point-value'].value; | |
button.style.color = 'black'; | |
button.style.fontWeight = '600'; | |
}); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment