<commit_before><html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="google-code-prettify/prettify.css"/>
		<link rel="stylesheet" href="style.css">
		<link rel="stylesheet" href="preview.css"/>
		<script src="pace.min.js"></script>
		<script src="../webcomponents.js/webcomponents-lite.min.js"></script>
		<link rel="import" href="../polymer/polymer.html">
		<link rel="import" href="editor/shader-graph.html">
		<script src="cocos2d-js.js"></script>
	</head>
<body>
	<div id="toolbar">
		<div id="preview">
			<div id="GameDiv">
				<canvas id="GameCanvas">
				<div id="splash">
					<div class:"progress-bar stripes">
						<span style:"width:0%"></span>
					</div>
				</div>
			</div>
		</div>
		<pre id="source" class="prettyprint lang-glsl linenums"></pre>
	</div>
	<shader-graph id="graph" class="graph"></shader-graph>
	<nav id="context-menu" class="context-menu">
		<form onsubmit="return false;" style="margin:0">
			<input id="search" class="search" autofocus="" type="text" name="q" placeholder="Node name ..." style="width:100%;outline:0" autocomplete="off">
		</form>
		<div id="menu-items"></div>
	</nav>
	<script src="google-code-prettify/prettify.js"></script>
	<script src="main.js"></script>
	<script>
		parent.preview = {
			_CCSettings: {
				"platform": "web-desktop",
				"groupList": [
					"default"
				],
				"collisionMatrix": [
					[
						true
					]
				],
				"rawAssets": {
					"assets": {
						"cd0305b4-c877-43af-8ed8-27d38478c262": [
							"Images/monkey",
							"cc.SpriteFrame",
							1
						],
						"1d955528-ab82-4be4-a727-d864908c2b74": [
							"Images/monkey.png",
							"cc.Texture2D"
						],
						"ecbfd2e4-3595-4b9e-94e1-ad307f36bfab": [
							"resources/EffectPreview.fs.glsl",
							"cc.RawAsset"
						],
						"2fdfd899-b375-46c6-ac69-fdefaf994017": [
							"resources/EffectPreview_noMVP.vs.glsl",
							"cc.RawAsset"
						],
						"0bf9ac5e-ff33-4a0a-9de7-83bff3b29a40": [
							"resources/EffectPreview.vs.glsl",
							"cc.RawAsset"
						]
					},
					"internal": {
					}
				},
				"launchScene": "db://assets/Scene/EffectPreview.fire",
				"scenes": [
					{
						"url": "db://assets/Scene/EffectPreview.fire",
						"uuid": "0c0e54e8-a57a-4811-af7d-e0106440f9f2"
					}
				],
				"orientation": "",
				"debug": false
			},
			init: function(){
				if (cc.sys.isBrowser) {
					this._initEngine();
				}
				else if (cc.sys.isNative) {
					require('js/settings.js');
					require('js/jsb_polyfill.js');

					this._initEngine();
				}
			},
			_initEngine: function() {
				if ( !this._CCSettings.debug ) {
					// retrieve minified raw assets
					var rawAssets = this._CCSettings.rawAssets;
					var assetTypes = this._CCSettings.assetTypes;
					for (var mount in rawAssets) {
						var entries = rawAssets[mount];
						for (var uuid in entries) {
							var entry = entries[uuid];
							var type = entry[1];
							if (typeof type === 'number') {
								entry[1] = assetTypes[type];
							}
						}
					}
				}

				// init engine
				var canvas, div;
				//var width = 640, height = 480;

				if (cc.sys.isBrowser) {
					canvas = document.getElementById('GameCanvas');
					div = document.getElementById('GameDiv');

					//width = div.clientWidth;
					//height = div.clientHeight;
				}

				function setLoadingDisplay () {
					// Loading splash scene
					var splash = document.getElementById('splash');
					var progressBar = splash.querySelector('.progress-bar span');
					var currentResCount = cc.loader.getResCount();
					cc.loader.onProgress = function (completedCount, totalCount, item) {
						var percent = 100 * (completedCount - currentResCount) / (totalCount - currentResCount);
						if (progressBar) {
							progressBar.style.width = percent.toFixed(2) + '%';
						}
					};
					splash.style.display = 'block';

					cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
						splash.style.display = 'none';
					});
				}

				var onStart = function () {
					cc.view.resizeWithBrowserSize(true);
					// UC browser on many android devices have performance issue with retina display
					if (cc.sys.os !== cc.sys.OS_ANDROID || cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC) {
						cc.view.enableRetina(true);
					}
					//cc.view.setDesignResolutionSize(this._CCSettings.designWidth, this._CCSettings.designHeight, cc.ResolutionPolicy.SHOW_ALL);
				
					if (cc.sys.isBrowser) {
						setLoadingDisplay();
					}

					if (this._CCSettings.orientation === 'landscape') {
						cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
					}
					else if (this._CCSettings.orientation === 'portrait') {
						cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
					}

					// init assets
					cc.AssetLibrary.init({
						libraryPath: parent.shaderGraph.resolveUrl('res/import'),
						rawAssetsBase: parent.shaderGraph.resolveUrl('res/raw-'),
						rawAssets: this._CCSettings.rawAssets
					});

					var launchScene = this._CCSettings.launchScene;

					var self = this;

					// load scene
					cc.director.loadScene(launchScene, null,
						function () {
							if (cc.sys.isBrowser) {
								// show canvas
								canvas.style.visibility = '';
								var div = document.getElementById('GameDiv');
								if (div) {
									div.style.backgroundImage = '';
								}
							}

							// play game
							// cc.game.resume();

							cc.eventManager.addCustomListener("preview_did_load", function(event){
								cc.eventManager.removeCustomListeners("preview_did_load");
								setTimeout(function(){
									typeof self.onload === "function" && self.onload();
								}, 1000);
							});

							console.log('Success to load scene: ' + launchScene);
						}
					);

					// purge
					//noinspection JSUndeclaredVariable
					this._CCSettings = undefined;
				};

				var option = {
					//width: width,
					//height: height,
					id: 'GameCanvas',
					scenes: this._CCSettings.scenes,
					debugMode: this._CCSettings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
					showFPS: this._CCSettings.debug,
					frameRate: 60,
					jsList: [
						parent.shaderGraph.resolveUrl('js/preview.js')
					],
					groupList: this._CCSettings.groupList,
					collisionMatrix: this._CCSettings.collisionMatrix
				};

				cc.game.run(option, onStart.bind(this));
			},
			updateShader: function(graph){
				if (graph) {
					var shaderDef = graph.buildShader();

					// console.log(shaderDef.fshader());
					if (cc.EffectPreview) {
						var fs = shaderDef.fshader();
						//fs = fs.split("uniform sampler2D texture12;").join("");
						//fs = fs.split("texture12").join("CC_Texture0");

						parent.source.innerHTML = ShaderGraph.Beautify(
							optimize_glsl(fs, "2", "fs"),
							//fs,
							{
								"indent_size": 1,
								"indent_char": '\t',
								"max_preserve_newlines": -1,
								"brace_style": "expand",
								"wrap_line_length": 0
							}
						);

						parent.source.classList.remove("prettyprinted");

						prettyPrint();

						cc.EffectPreview.frag_glsl = fs;
						cc.EffectPreview.updateShader();
					}
				}
			}
		};
	</script>
</body>
</html>
<commit_msg>remove the source fro the iframe<commit_after><html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="google-code-prettify/prettify.css"/>
		<link rel="stylesheet" href="style.css">
		<link rel="stylesheet" href="preview.css"/>
		<script src="pace.min.js"></script>
		<script src="../webcomponents.js/webcomponents-lite.min.js"></script>
		<link rel="import" href="../polymer/polymer.html">
		<link rel="import" href="editor/shader-graph.html">
		<script src="cocos2d-js.js"></script>
	</head>
<body>
	<div id="toolbar">
		<div id="preview">
			<div id="GameDiv">
				<canvas id="GameCanvas">
				<div id="splash">
					<div class:"progress-bar stripes">
						<span style:"width:0%"></span>
					</div>
				</div>
			</div>
		</div>
	</div>
	<shader-graph id="graph" class="graph"></shader-graph>
	<nav id="context-menu" class="context-menu">
		<form onsubmit="return false;" style="margin:0">
			<input id="search" class="search" autofocus="" type="text" name="q" placeholder="Node name ..." style="width:100%;outline:0" autocomplete="off">
		</form>
		<div id="menu-items"></div>
	</nav>
	<script src="google-code-prettify/prettify.js"></script>
	<script src="main.js"></script>
	<script>
		parent.preview = {
			_CCSettings: {
				"platform": "web-desktop",
				"groupList": [
					"default"
				],
				"collisionMatrix": [
					[
						true
					]
				],
				"rawAssets": {
					"assets": {
						"cd0305b4-c877-43af-8ed8-27d38478c262": [
							"Images/monkey",
							"cc.SpriteFrame",
							1
						],
						"1d955528-ab82-4be4-a727-d864908c2b74": [
							"Images/monkey.png",
							"cc.Texture2D"
						],
						"ecbfd2e4-3595-4b9e-94e1-ad307f36bfab": [
							"resources/EffectPreview.fs.glsl",
							"cc.RawAsset"
						],
						"2fdfd899-b375-46c6-ac69-fdefaf994017": [
							"resources/EffectPreview_noMVP.vs.glsl",
							"cc.RawAsset"
						],
						"0bf9ac5e-ff33-4a0a-9de7-83bff3b29a40": [
							"resources/EffectPreview.vs.glsl",
							"cc.RawAsset"
						]
					},
					"internal": {
					}
				},
				"launchScene": "db://assets/Scene/EffectPreview.fire",
				"scenes": [
					{
						"url": "db://assets/Scene/EffectPreview.fire",
						"uuid": "0c0e54e8-a57a-4811-af7d-e0106440f9f2"
					}
				],
				"orientation": "",
				"debug": false
			},
			init: function(){
				if (cc.sys.isBrowser) {
					this._initEngine();
				}
				else if (cc.sys.isNative) {
					require('js/settings.js');
					require('js/jsb_polyfill.js');

					this._initEngine();
				}
			},
			_initEngine: function() {
				if ( !this._CCSettings.debug ) {
					// retrieve minified raw assets
					var rawAssets = this._CCSettings.rawAssets;
					var assetTypes = this._CCSettings.assetTypes;
					for (var mount in rawAssets) {
						var entries = rawAssets[mount];
						for (var uuid in entries) {
							var entry = entries[uuid];
							var type = entry[1];
							if (typeof type === 'number') {
								entry[1] = assetTypes[type];
							}
						}
					}
				}

				// init engine
				var canvas, div;
				//var width = 640, height = 480;

				if (cc.sys.isBrowser) {
					canvas = document.getElementById('GameCanvas');
					div = document.getElementById('GameDiv');

					//width = div.clientWidth;
					//height = div.clientHeight;
				}

				function setLoadingDisplay () {
					// Loading splash scene
					var splash = document.getElementById('splash');
					var progressBar = splash.querySelector('.progress-bar span');
					var currentResCount = cc.loader.getResCount();
					cc.loader.onProgress = function (completedCount, totalCount, item) {
						var percent = 100 * (completedCount - currentResCount) / (totalCount - currentResCount);
						if (progressBar) {
							progressBar.style.width = percent.toFixed(2) + '%';
						}
					};
					splash.style.display = 'block';

					cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
						splash.style.display = 'none';
					});
				}

				var onStart = function () {
					cc.view.resizeWithBrowserSize(true);
					// UC browser on many android devices have performance issue with retina display
					if (cc.sys.os !== cc.sys.OS_ANDROID || cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC) {
						cc.view.enableRetina(true);
					}
					//cc.view.setDesignResolutionSize(this._CCSettings.designWidth, this._CCSettings.designHeight, cc.ResolutionPolicy.SHOW_ALL);
				
					if (cc.sys.isBrowser) {
						setLoadingDisplay();
					}

					if (this._CCSettings.orientation === 'landscape') {
						cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
					}
					else if (this._CCSettings.orientation === 'portrait') {
						cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
					}

					// init assets
					cc.AssetLibrary.init({
						libraryPath: parent.shaderGraph.resolveUrl('res/import'),
						rawAssetsBase: parent.shaderGraph.resolveUrl('res/raw-'),
						rawAssets: this._CCSettings.rawAssets
					});

					var launchScene = this._CCSettings.launchScene;

					var self = this;

					// load scene
					cc.director.loadScene(launchScene, null,
						function () {
							if (cc.sys.isBrowser) {
								// show canvas
								canvas.style.visibility = '';
								var div = document.getElementById('GameDiv');
								if (div) {
									div.style.backgroundImage = '';
								}
							}

							// play game
							// cc.game.resume();

							cc.eventManager.addCustomListener("preview_did_load", function(event){
								cc.eventManager.removeCustomListeners("preview_did_load");
								setTimeout(function(){
									typeof self.onload === "function" && self.onload();
								}, 1000);
							});

							console.log('Success to load scene: ' + launchScene);
						}
					);

					// purge
					//noinspection JSUndeclaredVariable
					this._CCSettings = undefined;
				};

				var option = {
					//width: width,
					//height: height,
					id: 'GameCanvas',
					scenes: this._CCSettings.scenes,
					debugMode: this._CCSettings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
					showFPS: this._CCSettings.debug,
					frameRate: 60,
					jsList: [
						parent.shaderGraph.resolveUrl('js/preview.js')
					],
					groupList: this._CCSettings.groupList,
					collisionMatrix: this._CCSettings.collisionMatrix
				};

				cc.game.run(option, onStart.bind(this));
			},
			updateShader: function(graph){
				if (graph) {
					var shaderDef = graph.buildShader();

					// console.log(shaderDef.fshader());
					if (cc.EffectPreview) {
						var fs = shaderDef.fshader();
						//fs = fs.split("uniform sampler2D texture12;").join("");
						//fs = fs.split("texture12").join("CC_Texture0");

						parent.source.innerHTML = ShaderGraph.Beautify(
							optimize_glsl(fs, "2", "fs"),
							//fs,
							{
								"indent_size": 1,
								"indent_char": '\t',
								"max_preserve_newlines": -1,
								"brace_style": "expand",
								"wrap_line_length": 0
							}
						);

						parent.source.classList.remove("prettyprinted");

						prettyPrint();

						cc.EffectPreview.frag_glsl = fs;
						cc.EffectPreview.updateShader();
					}
				}
			}
		};
	</script>
</body>
</html>

{'fraction_non_alphanumeric': 0.15363790186125212, 'fraction_numerical': 0.02084602368866328, 'mean_word_length': 2.2632508833922262, 'pattern_counts': {'":': 44, '<': 97, '<?xml version=': 0, '>': 97, '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': '6220442', 'n_tokens_mistral': 6928, 'n_tokens_neox': 4868, 'n_words': 768}