bryanwaddington / Strava - Highlight certain users

// ==UserScript==
// @name         Strava - Highlight certain users
// @namespace    http://thisfrog.com/
// @version      0.1
// @description  Highlights Strava users in your activity feed that you are following that are listed in the stravaUsers array.
// @author       Bryan Waddington
// @match        www.strava.com/dashboard*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var i, nameAnchor;
    var rawName, name, activity;

    // ------- Edit this array to include users you wish to highlight -------
    var stravaUsers = ['Bryan Waddington', 'Fred Bloggs', 'Boaty McBoatface'];

    setInterval(function () {
        nameAnchor = document.querySelectorAll('.comment .athlete-name, .entry-head .entry-athlete');

        for (i = 0; i < nameAnchor.length; i++) {
            rawName = nameAnchor[i].firstChild.nodeValue;
            name = rawName.trim();

            if (stravaUsers.indexOf(name) !== -1) {
                activity = nameAnchor[i].parentNode.parentNode;
                activity.style.border = '1px solid #FC4C02';
                activity.style.padding = '10px';
                activity.style.borderRadius = '5px';
            }
        }
    }, 1000);
})();