define(['text!../views/opmlContent.html', 'jquery', 'utils', 'services'], function(html, $, utils, services) {
    'use strict';

    // ===================================
    // OPML CONTENT
    // ===================================

    var _opmlContent = function(posts) {
        var container = utils._getId('opmlContainer'),
            opmlTitle = posts.childNodes[0].childNodes[1].childNodes[0].attributes.text.value,
            opmlBody = posts.childNodes[0].childNodes[1],
            opmlBodyChilds = opmlBody.childNodes[0].childNodes,
            opmlBodyChildsLen = opmlBodyChilds.length,
            opmlBodyChildsAttrs = null,
            opmlName = null,
            opmlXmlUrl = null,
            i = 0,
            menuPanel = null,
            titleContainer = null,
            menuSubContainer = null,
            menuSubContainerList = null,
            subLi = null,
            subLink = null,
            listId = null,
            listIdChilds = null,
            listIdChildsLen = null,
            firstLiElement = null,
            opmlContainer = null,
            emptyOpmlVideoContainer = function() {
                var vidContainer = $('#opmlVideoContainer');
                if (!utils._isUnd(vidContainer)) {
                    $(vidContainer).empty();
                }
            },
            youtubeIframe = function(url) {
                var iFrame = utils._create('iframe');
                utils._setAttr(iFrame, 'width', '300');
                utils._setAttr(iFrame, 'height', '160');
                utils._setAttr(iFrame, 'src', url);
                utils._setAttr(iFrame, 'frameborder', '0');
                utils._setAttr(iFrame, 'allowfullscreen', '');
                return iFrame;
            },
            appendInContainer = function(elements) {
                var entries = elements.entries,
                    j = 0,
                    entriesLen = entries.length,
                    videoContainer = null,
                    videoTitle = null,
                    videoDate = null,
                    preVideo = null,
                    video = null,
                    parentContainer = utils._getId('opmlVideoContainer');

                for (j; j < entriesLen; j++) {
                    videoContainer = utils._create('div');
                    videoTitle = utils._create('h6');
                    videoDate = utils._create('p');
                    preVideo = entries[j].link.replace('watch?v=', 'embed/') + '?rel=0';
                    video = youtubeIframe(preVideo);
                    videoContainer.className = 'col s6';
                    videoTitle.innerHTML = entries[j].title;
                    videoDate.innerHTML = entries[j].publishedDate;
                    utils._appendArr(videoContainer, [videoTitle, videoDate, video]);

                    if (!utils._isUnd(parentContainer)) {
                        parentContainer.appendChild(videoContainer);
                    }
                }
            };

        if (!utils._isUnd(posts) && !utils._isUnd(html)) {
            container.innerHTML = html;

            if (!utils._isNull(opmlTitle) && !utils._isUnd(menuPanel)) {
                menuPanel = utils._getId('opmlMenu');
                titleContainer = (!utils._isUnd(menuPanel)) ? utils._create('h5') : null;
                titleContainer.innerHTML = opmlTitle;
                menuSubContainer = utils._create('div');
                menuSubContainer.id = 'opmlMenuSubContainer';
                menuSubContainerList = utils._create('ul');
                menuSubContainerList.id = 'menuSubContainerList';

                menuSubContainer.appendChild(menuSubContainerList);
                utils._appendArr(menuPanel, [titleContainer, menuSubContainer]);

                for (i; i < opmlBodyChildsLen; i++) {
                    subLi = utils._create('li');
                    subLink = utils._create('a');

                    opmlBodyChildsAttrs = opmlBodyChilds[i].attributes;
                    opmlName = opmlBodyChildsAttrs[1].value;
                    opmlXmlUrl = opmlBodyChildsAttrs[3].value;

                    subLink.className = 'youTubeVideo';
                    utils._setAttr(subLink, 'href', '#');
                    utils._setAttr(subLink, 'data-link', opmlXmlUrl);

                    subLink.innerHTML = opmlName;

                    subLi.appendChild(subLink);
                    menuSubContainerList.appendChild(subLi);
                }

                window.setTimeout(function() {
                    listId = utils._getId('menuSubContainerList');
                    listIdChilds = listId.childNodes;
                    listIdChildsLen = listIdChilds.length;
                    firstLiElement = listIdChilds[0].childNodes[0].attributes['data-link'].value;
                    opmlContainer = utils._getId('opmlContainer');

                    if (!utils._isUnd(opmlContainer)) {
                        services.parseRSS(firstLiElement, appendInContainer);
                    }
                }, 100);

                // EVENTS
                $('.youTubeVideo').on('click', function(ev) {
                    var link = ev.currentTarget.attributes[2].value;
                    emptyOpmlVideoContainer();
                    services.parseRSS(link, appendInContainer);
                });
            }
        }
    };

    return {
        opmlContent: _opmlContent
    };
});

@@ -2603,16 +2603,25 @@
  'col s6
+ youVideo
 ';%0A     
@@ -5330,32 +5330,576 @@
 endInContainer);
+%0A%0A                    if (!utils._isUnd(listId) && !utils._isUnd(listIdChildsLen)) %7B%0A                        var f = 0;%0A                        for (f; f %3C listIdChildsLen; f++) %7B%0A                            var links = listIdChilds%5Bf%5D.childNodes%5B0%5D;%0A                            if ($(links).hasClass('now')) %7B%0A                                $(links).removeClass('now');%0A                            %7D%0A                        %7D%0A                    %7D%0A                    $(this).addClass('selected');%0A                    $(this).addClass('now');
 %0A               

Improve opmlContent events