<commit_before>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js CUSTOM TEST</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<script src="../jslib/weblabjs.js"></script>
		<style>
			body {
				font-family: Monospace;
				background-color: #f0f0f0;
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>

		<script src="../jslib/three.min.js"></script>
		<script src="../jslib/stats.min.js"></script>
		<script src="../jslib/THREEx.FullScreen.js"></script>
        <script src="../jslib/jquery-1.9.1.js"></script>
        <script src="../jslib/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.js"></script>

        <img id="video" style="display:none" src="https://www.weblab.deusto.es/webcam/proxied.py/fpga1?1194580072" />

		<script>

            /// The following references are for VisualStudio, so that Intellisense recognizes every library.
		    /// <reference path="../jslib/weblabjs.js" />
		    /// <reference path="../jslib/three.min.js" />
		    /// <reference path="../jslib/stats.min.js" />
		    /// <reference path="../jslib/THREEx.FullScreen.js" />
		    /// <reference path=""../jslib/jquery-1.9.1.js" />
		    /// <reference path="../jslib/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.js" />
            
          

		    // The following code is used to refresh the webcam 
		    // It is refreshed frame-by-frame every second.
		    CameraRefresher = new function () {

		        var tick = 0;
		        var image = new Image();
		        var reload = new Date();
		        var reload = reload.getTime();

		        image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;

		        function refreshCam() {
		            tick++;
		            if (tick > 3) { restart = 1; } else { restart = 0; }
		            if (image.complete) {
		                tick = 0;
		                document.images["video"].src = image.src;
		                image = new Image();
		                reload = new Date();
		                reload = reload.getTime();
		                window.status = "";
		                image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;
		            }
		            if (restart) {
		                tick = 0;
		                image = new Image();
		                reload = new Date();
		                reload = reload.getTime();
		                window.status = "";
		                image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;
		            }
		            window.status = window.status + ".";
		            setTimeout(refreshCam, 1000);
		        }

		        refreshCam();
		    };


            // Switch widget
		    SwitchWidget = function (pos_x, pos_y, text, on_img, off_img) {

		        var wid_img;
		        var wid_container;
		        var mState = true;
		        var mOnClickCB;


		        this.createElement = function(pos_x, pos_y, text) {
		            wid_img = document.createElement('img');
		            wid_img.style.width = "50px";
		            wid_img.onclick = this.onClick.bind(this);

		            wid_text = document.createElement('span');
		            wid_text.innerHTML = "<br>" + text;

		            wid_container = document.createElement('div');
		            wid_container.style.position = 'absolute';
		            wid_container.style.left = "" + pos_x + "px";
		            wid_container.style.top = "" + pos_y + "px";
		            wid_container.style.width = "100%";
		            wid_container.appendChild(wid_img);
		            wid_container.appendChild(wid_text);

		            return wid_container;
		        }

		        this.onClick = function() {
		            console.log(this);
		            this.setState(!this.getState());

                    if(mOnClickCB != undefined)
		                mOnClickCB(); 
		        }

		        this.setOnClick = function(func) {
		            mOnClickCB = func;
		        }

		        this.setState = function setState(state) {
		            mState = state;
		            if (state)
		                wid_img.src = on_img;
		            else
		                wid_img.src = off_img;
		        }

		        this.getState = function getState() {
		            return mState;
		        }

		        this.getElement = function () {
		            return wid_container;
		        }


		        this.createElement(pos_x, pos_y, text);
		        this.setState('0');

		    };


		    function placeSwitch() {
		        sw = new SwitchWidget(300, 300, "Test", "http://www.bitsbox.co.uk/images/redled.jpg", "http://e-lamundial.com.ar/wordpress/wp-content/uploads/2011/11/nterruptor.jpg");
		        et = document.body.getElementsByTagName('div');
		        el = et[0];
		        el.appendChild(sw.getElement());
		        return sw;
		    }


			var AMOUNT = 100;
			var container, stats;
			var camera, scene, renderer;
			var video, image, imageContext,
			imageReflection, imageReflectionContext, imageReflectionGradient,
			texture, textureReflection;
			var mesh;

			var mouseX = 0;
			var mouseY = 0;

			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;
			
			// Custom vars for the bg thing test
			
			var bg;
			var bgScene;
			var bgCam;
			
			
	//		document.body.addEventListener("keydown", function() {
	//		  THREEx.FullScreen.request();
	//		  alert('FS now');
	//		}, false);
			



			var LEDs = [];


		    //! Creates a turned-off LED at the specified position, returning
            //! its DIV container.
		    //!<commit_msg>[jsxilinx]: SwitchButton now works through JS pseudo-inheritance<commit_after>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js CUSTOM TEST</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<script src="../jslib/weblabjs.js"></script>
		<style>
			body {
				font-family: Monospace;
				background-color: #f0f0f0;
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>

		<script src="../jslib/three.min.js"></script>
		<script src="../jslib/stats.min.js"></script>
		<script src="../jslib/THREEx.FullScreen.js"></script>
        <script src="../jslib/jquery-1.9.1.js"></script>
        <script src="../jslib/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.js"></script>

        <img id="video" style="display:none" src="https://www.weblab.deusto.es/webcam/proxied.py/fpga1?1194580072" />

		<script>

            /// The following references are for VisualStudio, so that Intellisense recognizes every library.
		    /// <reference path="../jslib/weblabjs.js" />
		    /// <reference path="../jslib/three.min.js" />
		    /// <reference path="../jslib/stats.min.js" />
		    /// <reference path="../jslib/THREEx.FullScreen.js" />
		    /// <reference path=""../jslib/jquery-1.9.1.js" />
		    /// <reference path="../jslib/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.js" />
            
          

		    // The following code is used to refresh the webcam 
		    // It is refreshed frame-by-frame every second.
		    CameraRefresher = new function () {

		        var tick = 0;
		        var image = new Image();
		        var reload = new Date();
		        var reload = reload.getTime();

		        image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;

		        function refreshCam() {
		            tick++;
		            if (tick > 3) { restart = 1; } else { restart = 0; }
		            if (image.complete) {
		                tick = 0;
		                document.images["video"].src = image.src;
		                image = new Image();
		                reload = new Date();
		                reload = reload.getTime();
		                window.status = "";
		                image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;
		            }
		            if (restart) {
		                tick = 0;
		                image = new Image();
		                reload = new Date();
		                reload = reload.getTime();
		                window.status = "";
		                image.src = "https://www.weblab.deusto.es/webcam/proxied.py/fpga1?" + reload;
		            }
		            window.status = window.status + ".";
		            setTimeout(refreshCam, 1000);
		        }

		        refreshCam();
		    };


		    //! Base Image widget
		    //!
		    //! @param pos_x X position of the image (left top corner). 
		    //! As a CSS string or a pixel-integer.
		    //! @param pos_y Y position of the image (left top corner). 
		    //! As a CSS string or a pixel-integer.
		    //! @param text Text beneath the image
		    //! @param imgwidth CSS string describing hte image width
            //! @param imgsrc Src URL for the image
		    ImageWidget = function (pos_x, pos_y, text, imgwidth, imgheight, imgsrc) {

		        var mWidImg;
		        var mWidContainer;
		        var mTextSpan;
		        var mOnClickCB;

		        this._init = function () {
		            this._createElement(pos_x, pos_y, text, imgwidth, imgheight, imgsrc);
		        }

		        this._getTextSpan = function () {
		            return mTextSpan;
		        }

		        this._getImageElement = function () {
		            return mWidImg;
		        }

		        this._getContainerElement = function () {
		            return mWidContainer;
		        }

		        this._getOnClickCB = function () {
		            return mOnClickCB;
		        }

		        this._createElement = function (pos_x, pos_y, text, imgwidth, imgheight, imgsrc) {
		            mWidImg = document.createElement('img');
                    if(imgwidth != undefined)
		                mWidImg.style.width = imgwidth;
                    if(imgheight != undefined)
		                mWidImg.style.height = imgheight;
		            mWidImg.onclick = this.onClick.bind(this);
		            mWidImg.src = imgsrc;

		            wid_text = document.createElement('span');
		            wid_text.innerHTML = "<br>" + text;

		            mWidContainer = document.createElement('div');
		            mWidContainer.style.position = 'absolute';

		            if (typeof pos_x == "number")
		                mWidContainer.style.left = "" + pos_x + "px";
		            else
		                mWidContainer.style.left = pos_x;

		            if (typeof pos_y == "number")
		                mWidContainer.style.top = "" + pos_y + "px";
		            else
		                mWidContainer.style.left = pos_x;

		            mWidContainer.style.width = "100%";
		            mWidContainer.appendChild(mWidImg);
		            mWidContainer.appendChild(wid_text);

		            return mWidContainer;
		        }

		        this.onClick = function () {
		            if (mOnClickCB != undefined)
		                mOnClickCB();
		        }

		        this.setOnClick = function (func) {
		            mOnClickCB = func;
		        }

		        this.getElement = function () {
		            return mWidContainer;
		        }

		        this._init();
		    };


            // Switch widget
		    SwitchWidget = function (pos_x, pos_y, text, on_img, off_img) {

		        ImageWidget.call(this, pos_x, pos_y, text, "50px", "50px");

		        this._init = function () {
		            this.setState('0');
		            this.setOnClick(this.onClick.bind(this));
		        }

		        this.onClick = function() {
		            this.setState(!this.getState());
		        }

		        this.setState = function setState(state) {
		            mState = state;
		            if (state)
		                this._getImageElement().src = on_img;
		            else
		                this._getImageElement().src = off_img;
		        }

		        this.getState = function getState() {
		            return mState;
		        }

		        this._init();
		    };


		    function placeSwitch() {
		        sw = new SwitchWidget(300, 300, "Test", "http://www.bitsbox.co.uk/images/redled.jpg", "http://e-lamundial.com.ar/wordpress/wp-content/uploads/2011/11/nterruptor.jpg");
		        et = document.body.getElementsByTagName('div');
		        el = et[0];
		        el.appendChild(sw.getElement());
		        return sw;
		    }


			var AMOUNT = 100;
			var container, stats;
			var camera, scene, renderer;
			var video, image, imageContext,
			imageReflection, imageReflectionContext, imageReflectionGradient,
			texture, textureReflection;
			var mesh;

			var mouseX = 0;
			var mouseY = 0;

			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;
			
			// Custom vars for the bg thing test
			
			var bg;
			var bgScene;
			var bgCam;
			
			
			//document.body.addEventListener("keydown", function() {
			//  THREEx.FullScreen.request();
			//  alert('FS now');
			//}, false);
			



			var LEDs = [];


		    //! Creates a turned-off LED at the specified position, returning
            //! its DIV container.
		    //!
{'fraction_non_alphanumeric': 0.13541586519966145, 'fraction_numerical': 0.012618296529968454, 'mean_word_length': 1.6349077640381107, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 69, 'https://': 8, 'lorem ipsum': 0, 'www.': 10, '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': '2139286', 'n_tokens_mistral': 4641, 'n_tokens_neox': 3796, 'n_words': 782}