<commit_before>Ext.namespace('Kwf.Utils.YoutubePlayer');
Kwf.Utils.YoutubePlayer.isLoaded = false;
Kwf.Utils.YoutubePlayer.isCallbackCalled = false;
Kwf.Utils.YoutubePlayer.callbacks = [];

Kwf.Utils.YoutubePlayer.load = function(callback, scope)
{
    if (Kwf.Utils.YoutubePlayer.isCallbackCalled) {
        callback.call(scope || window);
        return;
    }
    Kwf.Utils.YoutubePlayer.callbacks.push({
        callback: callback,
        scope: scope
    });
    if (Kwf.Utils.YoutubePlayer.isLoaded) return;

    Kwf.Utils.YoutubePlayer.isLoaded = true;

    var tag = document.createElement('script');
    tag.setAttribute('type', 'text/javascript');
    tag.setAttribute('src', 'http://www.youtube.com/iframe_api');
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};

if (typeof window.onYouTubePlayerAPIReady == 'undefined') {
    window.onYouTubePlayerAPIReady = function() {
        Kwf.Utils.YoutubePlayer.isCallbackCalled = true;
        Kwf.Utils.YoutubePlayer.callbacks.forEach(function(i) {
            i.callback.call(i.scope || window);
        });
    }
}<commit_msg>moved code from callback call for youtubeapi in load function from youtubeplayer<commit_after>Ext.namespace('Kwf.Utils.YoutubePlayer');
Kwf.Utils.YoutubePlayer.isLoaded = false;
Kwf.Utils.YoutubePlayer.isCallbackCalled = false;
Kwf.Utils.YoutubePlayer.callbacks = [];

Kwf.Utils.YoutubePlayer.load = function(callback, scope)
{
    if (Kwf.Utils.YoutubePlayer.isCallbackCalled) {
        callback.call(scope || window);
        return;
    }
    Kwf.Utils.YoutubePlayer.callbacks.push({
        callback: callback,
        scope: scope
    });
    if (Kwf.Utils.YoutubePlayer.isLoaded) return;

    Kwf.Utils.YoutubePlayer.isLoaded = true;

    //workaround mediaelementjs also defining onYouTubePlayerAPIReady
    //placed here in load() so we are called after mediaelementjs
    var origOnYouTubePlayerAPIReady = window.onYouTubePlayerAPIReady;
    window.onYouTubePlayerAPIReady = function() {
        if (origOnYouTubePlayerAPIReady) origOnYouTubePlayerAPIReady();
        Kwf.Utils.YoutubePlayer.isCallbackCalled = true;
        Kwf.Utils.YoutubePlayer.callbacks.forEach(function(i) {
            i.callback.call(i.scope || window);
        });
    };

    var tag = document.createElement('script');
    tag.setAttribute('type', 'text/javascript');
    tag.setAttribute('src', 'http://www.youtube.com/iframe_api');
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};

{'fraction_non_alphanumeric': 0.12466742683390346, 'fraction_numerical': 0.0007601672367920942, 'mean_word_length': 3.8205128205128207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6060842', 'n_tokens_mistral': 848, 'n_tokens_neox': 818, 'n_words': 122}