// ==UserScript==
// @name           epl-parandaja
// @namespace      http://www.epl.ee
// @description    Parandab ära mõned tõsised kasutatavusprobleemid EPL saidis
// @include        http://www.epl.ee/*
// ==/UserScript==

function fixCoverStories() {
    try {
        with (document.getElementById('StorySelection')) {
            for (var item = 0; item < childNodes.length; item++) {
                try {
                    if (childNodes[item].id.substring(0,5) == "cover") {
                        childNodes[item].firstChild.href = getStoryUrl(childNodes[item].id);
                    };
                } catch(e) {
                }
            }
        }
    } catch (e) {
    }
};

function getStoryUrl(id) {
    var url = '';
    with(document.getElementById(id + 'story')) {
            url = childNodes[3].childNodes[1].firstChild.href;
    }
    return url;
}

fixCoverStories();



