<commit_before>/**
 * Created with JetBrains WebStorm.
 */

/**
 * Cordova kWidget lib
 */
(function(kWidget){ "use strict"
	if( !kWidget ){
		return ;
	}
	var init = function(){
		var executeCordova;

		cordova.define("cordova/plugin/NativeComponentPlugin",
			function(require, exports, module) {
				executeCordova = require("cordova/exec");
			});
		//This is mandatory for supporting cordova plugins
		if (!window.plugins) {
			window.plugins = {};
		}
		if (!window.plugins.NativeComponentPlugin) {
			window.plugins.NativeComponentPlugin = cordova.require("cordova/plugin/NativeComponentPlugin");
		}

		cordova.kWidget = {

			// This element is populated by cordova
			proxyElement: null,
			// callbacks to auth object events go here:
			embed : function( targetId, settings ){
				this.target = document.getElementById( targetId );
				this.iframeUrl = kWidget.getIframeUrl() + '?' + kWidget.getIframeRequest( targetId, settings );
				this.iframeUrl += '#' + JSON.stringify( window.preMwEmbedConfig );
				this.addApi( this.target );
				this.drawPlayer( this.target );
			},
			addApi: function( target ){
				target.evaluate = this.evaluate;
				target.sendNotification = this.sendNotification;
				target.addJsListener = this.addJsListener;
			},
			exec:function(){
				executeCordova(null,null,"NativeComponentPlugin",command, args);
			},
			evaluate:function(){
				this.exec("evaluate", ['']);
			},
			sendNotification:function(){
				this.exec("sendNotification", ['']);
			},
			addJsListener:function(){

			},
			drawPlayer:function( target ){
				// get target size + position

				var videoElementDiv = this.target;
				var videoElementRect = videoElementDiv.getBoundingClientRect();

				var x = videoElementRect.left;
				var y = videoElementRect.top;
				var w = videoElementRect.right - videoElementRect.left;
				var h = videoElementRect.bottom - videoElementRect.top;

				executeCordova( null,null,"NativeComponentPlugin","drawVideoNativeComponent", [ x, y, w, h ] );
				executeCordova( null,null,"NativeComponentPlugin","setIframeUrl", [ this.iframeUrl ] );
			}

		};
	}
	document.addEventListener("deviceready", init, false);

})( window.kWidget );<commit_msg>kwidget android additions (not final)<commit_after>/**
 * Created with JetBrains WebStorm.
 */

/**
 * Cordova kWidget lib
 */
(function(kWidget){ "use strict"
	if( !kWidget ){
		return ;
	}
	var init = function(){
		var executeCordova;

		cordova.define("cordova/plugin/NativeComponentPlugin",
			function(require, exports, module) {
				executeCordova = require("cordova/exec");
			});
		//This is mandatory for supporting cordova plugins
		if (!window.plugins) {
			window.plugins = {};
		}
		if (!window.plugins.NativeComponentPlugin) {
			window.plugins.NativeComponentPlugin = cordova.require("cordova/plugin/NativeComponentPlugin");
		}

		cordova.kWidget = {

			// This element is populated by cordova
			proxyElement: null,
			// callbacks to auth object events go here:
			embed : function( targetId, settings ){
				this.target = document.getElementById( targetId );
				this.iframeUrl = kWidget.getIframeUrl() + '?' + kWidget.getIframeRequest( targetId, settings );
				this.iframeUrl += '#' + JSON.stringify( window.preMwEmbedConfig );
				this.addApi( this.target );
				this.drawPlayer( this.target );
			},
			addApi: function( target ){
				target.evaluate = this.evaluate;
				target.sendNotification = this.sendNotification;
				target.addJsListener = this.addJsListener;
				target.exec = this.exec;
			},
			exec:function(){
				executeCordova(null,null,"NativeComponentPlugin",command, args);
			},
			evaluate:function(){
				this.exec("evaluate", ['']);
			},
			sendNotification:function( notificationName, notificationData ){
				executeCordova(null,null,"NativeComponentPlugin", "sendNotification",  [ notificationName, JSON.stringify( notificationData ) ]);
			},
			addJsListener:function(){

			},
			drawPlayer:function( target ){
				// get target size + position

				var videoElementDiv = this.target;
				var videoElementRect = videoElementDiv.getBoundingClientRect();

				var x = videoElementRect.left;
				var y = videoElementRect.top;
				var w = videoElementRect.right - videoElementRect.left;
				var h = videoElementRect.bottom - videoElementRect.top;

				executeCordova( null,null,"NativeComponentPlugin","drawVideoNativeComponent", [ x, y, w, h ] );
				executeCordova( null,null,"NativeComponentPlugin","setIframeUrl", [ this.iframeUrl ] );
			}

		};
	}
	document.addEventListener("deviceready", init, false);

})( window.kWidget );
{'fraction_non_alphanumeric': 0.13302752293577982, 'fraction_numerical': 0.0, 'mean_word_length': 3.9880174291938997, 'pattern_counts': {'":': 0, '<': 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': '2867985', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1336, 'n_words': 272}