the_umm_guy / decrapifyYahooFF

// ==UserScript==
// @name         decrapifyYahooFF
// @version      0.1
// @description  Decrapify the Yahoo Fantasy Footbal experience.
// @author       the_umm_guy
// @match        https://football.fantasysports.yahoo.com/*
// @match        http://football.fantasysports.yahoo.com/*
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    /* disclaimer, it might not work. I've only tested in chrome. Also, I know the code is bad. I did this in like thirty minutes without any real concrete design ideas. To be rewritten later.*/
    //remove daily fantasy header.
    var elm = document.getElementsByClassName('Thm-snow Page-herocontent');
    if (elm !== null){
        for (var i = 0, n = elm.length; i < n; ++i) {
    // get id property from element and set as innerHTML
    var id= elm[i].innerHTML = elm[i].id;
     console.log(id);
            if (id === ''){}
            else {
                document.getElementById(id).style.display = 'none';
            }
        }
    }
    //should've written a function, but I was too lazy at the time. There's two main classes used to display the daily fantasy header. This is to take care of the second.
    var elm2 = document.getElementsByClassName('df-ad');
    if (elm2 !== null){
        for (var i2 = 0, n2 = elm2.length; i2 < n2; ++i2) {
            // get id property from element and set as innerHTML
            var id2= elm2[i2].innerHTML = elm2[i2].id;
            if (id2 === ''){}
            else {
                document.getElementById(id2).style.display = 'none';
            }
        }
    }
    //remove post-season contests blurb from leauge overview.
    var coceligibility = document.getElementById('coceligibility');
    if (coceligibility !== null){
        coceligibility.style.display = 'none';
    }
    //remove sidebar.
    var yspsub = document.getElementById('yspsub');
    if (yspsub !== null){
        yspsub.style.display = 'none';
    }
    //remove fantasyshop advert.
    var fantasyshoppromo = document.getElementById('fantasyshoppromo');
    if (fantasyshoppromo !== null){
        fantasyshoppromo.style.display = 'none';
    }
    //remove the daily fantasy heard if it exists.
    var ysppageheader = document.getElementById('yspsub');
    if (yspsub !== null){
        yspsub.style.display = 'none';
    }
    //remove the footer.
    var yspcontentfooter = document.getElementById('yspcontentfooter');
    if (yspcontentfooter !== null){
        yspcontentfooter.style.display = 'none';
    }
    //remove ream medals.
    var team_medals = document.getElementById('team-medals');
    if (team_medals !== null){
        team_medals.style.display = 'none';
    }
    //remove fantasy pros ranks
    var fantasyprosranks = document.getElementById('fantasyprosranks');
    if (fantasyprosranks !== null){
        fantasyprosranks.style.display = 'none';
    }
})();