<commit_before>/**
* Conviva loader
*/

( function( mw, $ ) {

mw.addResourcePaths({
	"mw.Conviva": "mw.Conviva.js"
});
	
mw.bindHelper( 'newEmbedPlayerEvent', function( event, embedPlayer ) {
    
    embedPlayer.bindHelper( 'KalturaSupport_CheckUiConf', function( event, $uiConf, callback ) {
        // Disable Conviva with IE9
        if( mw.isIE9() ) {
        	callback();
	        return;
	    }
        if( embedPlayer.isPluginEnabled ( 'Conviva' ) ) {
            var config = embedPlayer.getKalturaConfig( 'Conviva', [ 'convivaKalturaHTML5Lib', 'convivaAjaxTimeout', 'convivaCustomerId', 'convivaServiceUrl' ] );
            
            var initParameter = function( parameter, defaultValue ) {
                if ( ! config[ parameter ] ) {
                    if ( defaultValue ) {
                        config[ parameter ] = defaultValue;
                        return true;
                    }
                    return false;
                }
                return true;
            }
            
            // Check for required and set default config parameters
            var isError = false;
            
            // Initialize optional config parameters whith default values if not present explicitly
            initParameter( 'convivaAjaxTimeout', 1000 ); // default to 1 second unless explicitly set
            
            if ( ! initParameter( 'convivaKalturaHTML5Lib' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaKalturaHTML5Lib" is a required parameter!' );
            }
            if ( ! initParameter( 'convivaCustomerId' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaCustomerId" is a required parameter!' );
            }
            if ( ! initParameter( 'convivaServiceUrl' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaServiceUrl" is a required parameter!' );
            }
            
            // If required parameters are missing continue with the player build out
            if ( isError ) {
                callback();
                return;
            }
            
            mw.load('mw.Conviva', function(){
            	new mw.Conviva( embedPlayer, callback, config );
            });
            
            /*
            $.ajax({
                type: "GET",
                url: config[ 'convivaKalturaHTML5Lib' ],
                dataType: 'script',
                timeout: config[ 'convivaAjaxTimeout' ],
                success: function() {
                    new mw.Conviva( embedPlayer, callback, config );
                },
                error: function() {
                    mw.log( 'Conviva: Error: convivaKalturaHTML5Lib failed to load or timed out!');
                    // proceed if Conviva's lib fails to load or times out
                    callback();
               }
            });
            */
            return;
        }
        
        // don't block player build out if Coviva module is not enabled
        callback();
    });
});

})( window.mw, jQuery );<commit_msg>restore conviva to work with external mw.Conviva<commit_after>/**
* Conviva loader
*/

( function( mw, $ ) {

/*
mw.addResourcePaths({
	"mw.Conviva": "mw.Conviva.js"
})
*/
	
mw.bindHelper( 'newEmbedPlayerEvent', function( event, embedPlayer ) {
    
    embedPlayer.bindHelper( 'KalturaSupport_CheckUiConf', function( event, $uiConf, callback ) {
        // Disable Conviva with IE9
        if( mw.isIE9() ) {
        	callback();
	        return;
	    }
        if( embedPlayer.isPluginEnabled ( 'Conviva' ) ) {
            var config = embedPlayer.getKalturaConfig( 'Conviva', [ 'convivaKalturaHTML5Lib', 'convivaAjaxTimeout', 'convivaCustomerId', 'convivaServiceUrl' ] );
            
            var initParameter = function( parameter, defaultValue ) {
                if ( ! config[ parameter ] ) {
                    if ( defaultValue ) {
                        config[ parameter ] = defaultValue;
                        return true;
                    }
                    return false;
                }
                return true;
            }
            
            // Check for required and set default config parameters
            var isError = false;
            
            // Initialize optional config parameters whith default values if not present explicitly
            initParameter( 'convivaAjaxTimeout', 1000 ); // default to 1 second unless explicitly set
            
            if ( ! initParameter( 'convivaKalturaHTML5Lib' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaKalturaHTML5Lib" is a required parameter!' );
            }
            if ( ! initParameter( 'convivaCustomerId' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaCustomerId" is a required parameter!' );
            }
            if ( ! initParameter( 'convivaServiceUrl' ) ) {
                isError = true;
                mw.log( 'Conviva: Error: "Conviva.convivaServiceUrl" is a required parameter!' );
            }
            
            // If required parameters are missing continue with the player build out
            if ( isError ) {
                callback();
                return;
            }
            
            /*
            mw.load('mw.Conviva', function(){
            	new mw.Conviva( embedPlayer, callback, config );
            });
            */
            
            $.ajax({
                type: "GET",
                url: config[ 'convivaKalturaHTML5Lib' ],
                dataType: 'script',
                timeout: config[ 'convivaAjaxTimeout' ],
                success: function() {
                    new mw.Conviva( embedPlayer, callback, config );
                },
                error: function() {
                    mw.log( 'Conviva: Error: convivaKalturaHTML5Lib failed to load or timed out!');
                    // proceed if Conviva's lib fails to load or times out
                    callback();
               }
            });
            return;
        }
        
        // don't block player build out if Coviva module is not enabled
        callback();
    });
});

})( window.mw, jQuery );
{'fraction_non_alphanumeric': 0.09911054637865312, 'fraction_numerical': 0.0038119440914866584, 'mean_word_length': 1.397943640517898, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5970244', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1549, 'n_words': 418}