<commit_before>define(function(require, exports, module) {
    "use strict";

    var app = require("app");
    var AbstractView = require("modules/view/AbstractView");
    var YouTubeCollection = require("modules/collection/youtube/YouTubeCollection");
    var YouTubeListView = require("modules/view/top/YouTubeListView");

    var YouTubeView = AbstractView.extend({
        template : require("ldsh!/app/templates/top/youTube"),
        /**
         * youtubePlayer
         */
        player : null,
        events : {
            "click .playListItem" : "onClickPlayList"
        },

        beforeRendered : function() {

        },

        afterRendered : function() {
            this.requestGoogleAPIClient();
        },

        /**
         * 初期化処理
         */
        initialize : function() {
        },

        /**
         * Google API clientを初期化する
         */
        requestGoogleAPIClient : function() {
            if (app.gapiLoaded) {
                this.initYouTubeView();
                return;
            }

            var self = this;
            window.googleApiClientReady = function() {
                delete window.googleApiClientReady;

                window.onYouTubeIframeAPIReady = function() {
                    delete window.onYouTubeIframeAPIReady;
                    app.gapiLoaded = true;

                    self.initYouTubeView();
                };

                var tag = document.createElement('script');
                tag.src = "https://www.youtube.com/iframe_api";
                var firstScriptTag = document.getElementsByTagName('script')[0];
                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
            };

            var tag = document.createElement('script');
            tag.src = "https://apis.google.com/js/client.js?onload=googleApiClientReady";
            var firstScriptTag = document.getElementsByTagName('script')[0];
            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
        },
        
        /**
         *  YouTubeViewを初期化する
         *  GoogleAPIの初期化が済んだら呼ばれる
         */
        initYouTubeView: function () {
            this.collection = new YouTubeCollection();
            this.collection.channelId = "UC9_ZCtgOk8dPC6boqZMNqbw";

            var youTubeListView = new YouTubeListView();
            youTubeListView.collection = this.collection;
            youTubeListView.parent = this;
            this.setView("#sidebar_list", youTubeListView);

            youTubeListView.listenTo(this.collection, "reset sync request", youTubeListView.render);
<commit_msg>NAM-114 全般:右側記事表示<commit_after>define(function(require, exports, module) {
    "use strict";

    var app = require("app");
    var AbstractView = require("modules/view/AbstractView");
    var YouTubeCollection = require("modules/collection/youtube/YouTubeCollection");
    var YouTubeListView = require("modules/view/top/YouTubeListView");

    var YouTubeView = AbstractView.extend({
        template : require("ldsh!/app/templates/top/youTube"),
        /**
         * youtubePlayer
         */
        player : null,
        events : {
            "click .playListItem" : "onClickPlayList"
        },

        beforeRendered : function() {

        },

        afterRendered : function() {
            this.requestGoogleAPIClient();
        },

        /**
         * 初期化処理
         */
        initialize : function() {
        },

        /**
         * Google API clientを初期化する
         */
        requestGoogleAPIClient : function() {
            if (app.gapiLoaded) {
                this.initYouTubeView();
                return;
            }

            var self = this;
            window.googleApiClientReady = function() {
                delete window.googleApiClientReady;

                window.onYouTubeIframeAPIReady = function() {
                    delete window.onYouTubeIframeAPIReady;
                    app.gapiLoaded = true;

                    self.initYouTubeView();
                };

                var tag = document.createElement('script');
                tag.src = "https://www.youtube.com/iframe_api";
                var firstScriptTag = document.getElementsByTagName('script')[0];
                firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
            };

            var tag = document.createElement('script');
            tag.src = "https://apis.google.com/js/client.js?onload=googleApiClientReady";
            var firstScriptTag = document.getElementsByTagName('script')[0];
            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
        },
        
        /**
         *  YouTubeViewを初期化する
         *  GoogleAPIの初期化が済んだら呼ばれる
         */
        initYouTubeView: function () {
            this.collection = new YouTubeCollection();
            this.collection.channelId = "UC9_ZCtgOk8dPC6boqZMNqbw";

            var youTubeListView = new YouTubeListView();
            youTubeListView.collection = this.collection;
            youTubeListView.parent = this;
            this.setView("#sidebar__list", youTubeListView);

            youTubeListView.listenTo(this.collection, "reset sync request", youTubeListView.render);

{'fraction_non_alphanumeric': 0.10597043578421962, 'fraction_numerical': 0.00249568055288923, 'mean_word_length': 1.8485511208310552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7649394', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1353, 'n_words': 209}