NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Sprint Randomizer // @description Randomizes your teammates pics on the phonetool panel // @copyright 2016, Manav Kundra (http://manavkundra.com) // @namespace https://phonetool.amazon.com/ // @include https://phonetool.amazon.com/users/* // @version 1 // @grant none // ==/UserScript== function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } window.addEventListener('load', setTimeout(function() { var not_included = 2; // get all HTML objects in array var pics = document.getElementsByClassName('blue-badge-small'); var arrayLength = pics.length; // extract pic links to array var pic_links = []; for (var i = 0; i < arrayLength; i++) { pic_links.push(pics[i].attributes.src.value); } // get all Devs pic_links = pic_links.slice(not_included); // Shuffle pic_links pic_links = shuffle(pic_links); // Display in html var result ="<h3 style='text-align: center;''>Sprint Randomizer</h3>"; for (var i = 0; i < arrayLength - not_included; i++) { result = result + " <img src='" + pic_links[i] + "'></img>"; } document.getElementById('widget-2').innerHTML = result; }, 3000), false);