<commit_before>define(["sugar-web/activity/activity", 'sugar-web/datastore'], function (activity, datastore) {

	// Manipulate the DOM only when it is ready.
	requirejs(['domReady!'], function (doc) {

		// Initialize the activity.
		activity.setup();

		//Initialize 3D Scene and Camera
		var scene = new THREE.Scene();
		var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
		var renderer = new THREE.WebGLRenderer({preserveDrawingBuffer: true});

		//Planet Information
		var infoType = ["Name", "Type", "Year", "Mass", "Temperature", "Moons"];
		var planet = planets;

		var homeDisplay = document.getElementById("planets-list");
		var interactContainer = document.getElementById("planet-container");
		var planetDisplay = document.getElementById("planet-display");
		var planetInfo = document.getElementById("planet-info");

		//Allow interaction with planet
		var controls = new THREE.TrackballControls(camera, renderer.domElement);
		controls.target.set(0,0,0);


		interactContainer.style.display = "none";
		document.getElementById("rotation-button").style.display = "none";
		document.getElementById("info-button").style.display = "none";
		document.getElementById("home-button").style.display = "none";
		document.getElementById("image-button").style.display = "none";

		for (var i = 0; i < planet.length; i ++){
			var planetList = document.createElement('div');
			planetList.id = 'planet-' + planet[i].name;
			planetList.className = 'planets';
			homeDisplay.appendChild(planetList);

			var planetImage = document.createElement('img');
			planetImage.className = planet[i].name;
			planetImage.src = "images/" + planet[i].name + ".jpg";
			planetImage.width = 250;
			document.getElementById("planet-" + planet[i].name).appendChild(planetImage);

			initPlanet(planet[i].name, planet[i].type, planet[i].year, planet[i].mass, planet[i].temperature, planet[i].moons);
		}

		//Show planet function
		function initPlanet(name, type, year, mass, temperature, moons){

			//Variable action detectors
			var showInfo;
			var stopRotation;
			var save;

			//Url of image files
			var url = "images/" + name + "map.jpg";
			var bumpUrl = "images/" + name + "bump.png";
			var specUrl = "images/" + name + "spec.png";
			var cloudUrl = "images/" + name + "cloudmap.jpg";
			var ringUrl = "images/" + name + "ringcolor.jpg";

			//Create Planet
			var loadTexture = new THREE.TextureLoader().load(url);
			var geometry = new THREE.SphereGeometry(2, 32, 32);
			var material = new THREE.MeshPhongMaterial({
				map: loadTexture,
				shininess: 5
			});
			var planetMesh = new THREE.Mesh(geometry, material);

			//Create clouds for Earth
			var loadCloudTexture = new THREE.TextureLoader().load(cloudUrl);
			var light = new THREE.DirectionalLight(0xffffff);
			var lightHolder = new THREE.Group();
			var cloudGeometry = new THREE.SphereGeometry(2.03, 32, 32);
			var cloudMaterial = new THREE.MeshPhongMaterial({
				map: loadCloudTexture,
				side: THREE.DoubleSide,
				opacity: 0.5,
				transparent: true,
				depthWrite: false
			});
			var cloudMesh = new THREE.Mesh(cloudGeometry, cloudMaterial);
			planetMesh.add(cloudMesh);

			//Create Rings
			var loadRingTexture = new THREE.TextureLoader().load(ringUrl);
			var ringGeometry = new THREE.RingBufferGeometry(2.5, 5, 40);
			var position = ringGeometry.attributes.position;
			var vector = new THREE.Vector3();
			for (let i = 0; i < position.count; i++){
				vector.fromBufferAttribute(position, i);
				ringGeometry.attributes.uv.setXY(i, vector.length() < 4 ? 0 : 1, 1);
			}
			var ringMaterial = new THREE.MeshPhongMaterial({
				map: loadRingTexture,
				side: THREE.DoubleSide,
				opacity: 0.6,
				transparent: true,
				depthWrite: true
			});
			var ringMesh = new THREE.Mesh(ringGeometry, ringMaterial);

			//For planets with terrain, add bumps
			material.bumpMap = new THREE.TextureLoader().load(bumpUrl);
			material.specularMap = new THREE.TextureLoader().load(specUrl);
			material.specular  = new THREE.Color('grey')
			material.bumpScale = 0.1;


			//When click on a planet, show more info about that planet
			document.getElementById("planet-" + name).addEventListener("click", function(){
				showInfo = true;
				stopRotation = false;
				interactContainer.style.display = "block";
				homeDisplay.style.display = "none";
				document.getElementById("planet-info").style.display = "block";
				planetDisplay.style.width = "60%";
				document.getElementById("rotation-button").style.display = "inline";
				document.getElementById("info-button").style.display = "inline";
				document.getElementById("home-button").style.display = "inline";
				document.getElementById("image-button").style.display = "inline";

				renderer.setSize( planetDisplay.clientWidth, window.innerHeight);
				planetDisplay.appendChild(renderer.domElement);
				light.position.set( 1, 1, 5 );

				lightHolder.add(light);
				scene.add(lightHolder);

				scene.add(planetMesh);<commit_msg>Fix showInfo bug<commit_after>define(["sugar-web/activity/activity", 'sugar-web/datastore'], function (activity, datastore) {

	// Manipulate the DOM only when it is ready.
	requirejs(['domReady!'], function (doc) {

		// Initialize the activity.
		activity.setup();

		//Initialize 3D Scene and Camera
		var scene = new THREE.Scene();
		var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
		var renderer = new THREE.WebGLRenderer({preserveDrawingBuffer: true});

		//Planet Information
		var infoType = ["Name", "Type", "Year", "Mass", "Temperature", "Moons"];
		var planet = planets;

		var homeDisplay = document.getElementById("planets-list");
		var interactContainer = document.getElementById("planet-container");
		var planetDisplay = document.getElementById("planet-display");
		var planetInfo = document.getElementById("planet-info");

		//Allow interaction with planet
		var controls = new THREE.TrackballControls(camera, renderer.domElement);
		controls.target.set(0,0,0);


		interactContainer.style.display = "none";
		document.getElementById("rotation-button").style.display = "none";
		document.getElementById("info-button").style.display = "none";
		document.getElementById("home-button").style.display = "none";
		document.getElementById("image-button").style.display = "none";

		for (var i = 0; i < planet.length; i ++){
			var planetList = document.createElement('div');
			planetList.id = 'planet-' + planet[i].name;
			planetList.className = 'planets';
			homeDisplay.appendChild(planetList);

			var planetImage = document.createElement('img');
			planetImage.className = planet[i].name;
			planetImage.src = "images/" + planet[i].name + ".jpg";
			planetImage.width = 250;
			document.getElementById("planet-" + planet[i].name).appendChild(planetImage);

			initPlanet(planet[i].name, planet[i].type, planet[i].year, planet[i].mass, planet[i].temperature, planet[i].moons);
		}

		//Show planet function
		function initPlanet(name, type, year, mass, temperature, moons){

			//Variable action detectors
			var showInfo = true;
			var stopRotation;
			var save;

			//Url of image files
			var url = "images/" + name + "map.jpg";
			var bumpUrl = "images/" + name + "bump.png";
			var specUrl = "images/" + name + "spec.png";
			var cloudUrl = "images/" + name + "cloudmap.jpg";
			var ringUrl = "images/" + name + "ringcolor.jpg";

			//Create Planet
			var loadTexture = new THREE.TextureLoader().load(url);
			var geometry = new THREE.SphereGeometry(2, 32, 32);
			var material = new THREE.MeshPhongMaterial({
				map: loadTexture,
				shininess: 5
			});
			var planetMesh = new THREE.Mesh(geometry, material);

			//Create clouds for Earth
			var loadCloudTexture = new THREE.TextureLoader().load(cloudUrl);
			var light = new THREE.DirectionalLight(0xffffff);
			var lightHolder = new THREE.Group();
			var cloudGeometry = new THREE.SphereGeometry(2.03, 32, 32);
			var cloudMaterial = new THREE.MeshPhongMaterial({
				map: loadCloudTexture,
				side: THREE.DoubleSide,
				opacity: 0.5,
				transparent: true,
				depthWrite: false
			});
			var cloudMesh = new THREE.Mesh(cloudGeometry, cloudMaterial);
			planetMesh.add(cloudMesh);

			//Create Rings
			var loadRingTexture = new THREE.TextureLoader().load(ringUrl);
			var ringGeometry = new THREE.RingBufferGeometry(2.5, 5, 40);
			var position = ringGeometry.attributes.position;
			var vector = new THREE.Vector3();
			for (let i = 0; i < position.count; i++){
				vector.fromBufferAttribute(position, i);
				ringGeometry.attributes.uv.setXY(i, vector.length() < 4 ? 0 : 1, 1);
			}
			var ringMaterial = new THREE.MeshPhongMaterial({
				map: loadRingTexture,
				side: THREE.DoubleSide,
				opacity: 0.6,
				transparent: true,
				depthWrite: true
			});
			var ringMesh = new THREE.Mesh(ringGeometry, ringMaterial);

			//For planets with terrain, add bumps
			material.bumpMap = new THREE.TextureLoader().load(bumpUrl);
			material.specularMap = new THREE.TextureLoader().load(specUrl);
			material.specular  = new THREE.Color('grey')
			material.bumpScale = 0.1;


			//When click on a planet, show more info about that planet
			document.getElementById("planet-" + name).addEventListener("click", function(){
				stopRotation = false;
				interactContainer.style.display = "block";
				homeDisplay.style.display = "none";
				document.getElementById("planet-info").style.display = "block";
				planetDisplay.style.width = "60%";
				document.getElementById("rotation-button").style.display = "inline";
				document.getElementById("info-button").style.display = "inline";
				document.getElementById("home-button").style.display = "inline";
				document.getElementById("image-button").style.display = "inline";

				renderer.setSize( planetDisplay.clientWidth, window.innerHeight);
				planetDisplay.appendChild(renderer.domElement);
				light.position.set( 1, 1, 5 );

				lightHolder.add(light);
				scene.add(lightHolder);

				scene.add(planetMesh);
{'fraction_non_alphanumeric': 0.14059841889322525, 'fraction_numerical': 0.010407285099569698, 'mean_word_length': 4.093781855249746, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4727996', 'n_tokens_mistral': 3568, 'n_tokens_neox': 2946, 'n_words': 704}