<commit_before>var g8v={
	'windowList': [],
	'objList': [],
	'videoSource': {
		'justin': function(path){
			var id=path.match(/^[a-zA-Z0-9_-]+/)[0];
			var content=$.tag('object',{
				'type': 'application/x-shockwave-flash',
				'data': 'http://www.justin.tv/swflibs/JustinPlayer.swf?channel='+id,
				'style': {
					'width': '100%',
					'height': '100%'
				}
			});
			content.innerHTML='\
				<param name="allowFullScreen" value="true">\
				<param name="allowScriptAccess" value="always">\
				<param name="allowNetworking" value="all">\
				<param name="movie" value="http://www.justin.tv/swflibs/JustinPlayer.swf">\
				<param name="flashvars" value="hostname=www.justin.tv&amp;channel='+id+'&amp;auto_play=true&amp;start_volume=25">\
			';
			return content;
		},
		'livehouse': function(path){
			var id=path.match(/^channel\/([a-zA-Z0-9_-]+)/)[0];
			var content=$.tag('iframe',{'id':randstr(8,7),'src':'data:text/html,Loading...'});
			content.addEventListener('load',function(e){
				var id=e.target.id
				var player=jwplayer(id).setup({
					'playlist': [
						{
							'file':'http://wrtctw-rtcp-tw-1.livehouse.in/'+id+'/video/playlist.m3u8',
							'provider':'plugin/jwplayer_hls/HLSProvider6.swf',
							'type':'hls'
						}
					],
					'primary': 'flash',
					'autostart': true,
					'width': '100%',
					'height': '100%'
				})
				player.onReady(function(){
					$(id+'_wrapper').style.position='static';
				});
				player.onSetupError(function(){
					$(id+'_wrapper').$replace(document.createTextNode('Load Fail.'));
				})
			});
			return content;
		},
		'ustream': function(path){
			if(path.indexOf('recorded')===0){
				return $.tag('iframe',{
					'src': 'http://www.ustream.tv/embed/recorded/'+path.match(/^recorded\/(\d+)/)[1]+'?v=3&wmode=direct&autoplay=1',
					'style': {
						'width': '100%',
						'height': '100%'
					}
				});
			}
			var tag=$.tag('iframe',{
				'src': 'data:text/html,Loading...',
				'style': {
					'width': '100%',
					'height': '100%',
					'background': '#FFF'
				}
			});
			new Ajax('POST','http://api.a0000778.idv.biz/g8v/getsourceid.php',{
				'source': 'ustream',
				'path': path.match(/^(channel\/)?[a-zA-Z0-9-]+/)[0]
			}).on('load',function(){
				console.log('load');
				tag.src=this.result()? 'http://www.ustream.tv/embed/'+this.result()+'?v=3&wmode=direct&autoplay=1':'data:text/html,Load Failed.';
			}).send();
			return tag;
		},
		'youtube': function(path){
			var id=path.match(/(\?|&)v=([a-zA-Z0-9_-]+)/)[2];
			return $.tag('iframe',{
				'src': 'http://www.youtube.com/embed/'+id,
				'allowfullscreen': 'true',
				'style': {
					'width': '100%',
					'height': '100%'
				}
			})
		}
	},
	'chatSource': {
		'justin': function(path){
			var id=path.match(/^[a-zA-Z0-9_-]+/)[0];
			return $.tag('iframe',{
				'src': 'http://zh-tw.justin.tv/chat/embed?channel='+id+'&popout_chat=true',
				'style': {
					'width': '100%',
					'height': '100%'
				}
			})
		},
		'ustream': function(path){
			if(!/^(channel\/)?[a-zA-Z0-9-]+/.test(path)){
				return $.tag('iframe',{
					'src': 'data:text/html,not support',
					'style': {
						'width': '100%',
						'height': '100%',
						'background': '#FFF'
					}
				});
			}
			var tag=$.tag('iframe',{
				'src': 'data:text/html,Loading...',
				'style': {
					'width': '100%',
					'height': '100%',
					'background': '#FFF'
				}
			});
			new Ajax('POST','http://api.a0000778.idv.biz/g8v/getsourceid.php',{
				'source': 'ustream',
				'path': path.match(/^(channel\/)?[a-zA-Z0-9-]+/)[0]
			}).on('load',function(){
				tag.src=this.result()? 'http://www.ustream.tv/socialstream/'+this.result()+'?siteMode=1?activeTab=socialStream&hideVideoTab=1&colorScheme=light&v=6':'data:text/html,Load Failed.';
			}).send();
			return tag;
		},
		'youtube': function(path){
			
		}
	},
	
	'_createWindow': function(obj,objId,title,content){
		$().$add('div',{
			'id': 'window_'+this.windowList.length,
			'className': 'window'
		}).$add('div',{
			'className': 'vw_bar',
			'textContent': title
		},null,true).$add(
			$.tag('div',{
				'className': 'vw_option'
			})
			.$add('span',{
				'className': 'vw_opacity',
				'textContent': '透'
			},null,true)
			.$add('span',{
				'className': 'vw_close',
				'textContent': 'X'
			},null,true)
		,null,true).$add(content);
		var vw=new VirtualWindow(
			'window_'+this.windowList.length,
			obj.value[2],
			obj.value[3],
			obj.value[4],
			obj.value[5]
		);
		vw.on('move',function(){
			obj.value[2]=this.posX;
			obj.value[3]=this.posY;
			g8v.updateShareUrl();
		});
		vw.on('resize',function(){
			obj.value[4]=this.width;
			obj.value[5]=this.height;
			g8v.updateShareUrl();
		});
		vw.on('close',function(){
			this.objList.splice(objId);
		}.bind(this));
		this.windowList.push(vw);
		return vw;
	},
	'createVideo': function(form,path,title,left,top,width,height){
		if(!this.videoSource[form]) return false;
		var obj={
			'type': 'video',
			'value': [
				form,
				path,
				title,
				left? left:0,
				top? top:0,
				width? width:800,
				height? height:600
			]
		};
		this._createWindow(obj,this.objList.push(obj)-1,title,this.videoSource[form](path));
		this.updateShareUrl();
		return true;
	},
	'createChat': function(form,path,title,left,top,width,height){
		if(!this.chatSource[form]) return false;<commit_msg>fix: c33d1c1d 修正方式有誤<commit_after>var g8v={
	'windowList': [],
	'objList': [],
	'videoSource': {
		'justin': function(path){
			var id=path.match(/^[a-zA-Z0-9_-]+/)[0];
			var content=$.tag('object',{
				'type': 'application/x-shockwave-flash',
				'data': 'http://www.justin.tv/swflibs/JustinPlayer.swf?channel='+id,
				'style': {
					'width': '100%',
					'height': '100%'
				}
			});
			content.innerHTML='\
				<param name="allowFullScreen" value="true">\
				<param name="allowScriptAccess" value="always">\
				<param name="allowNetworking" value="all">\
				<param name="movie" value="http://www.justin.tv/swflibs/JustinPlayer.swf">\
				<param name="flashvars" value="hostname=www.justin.tv&amp;channel='+id+'&amp;auto_play=true&amp;start_volume=25">\
			';
			return content;
		},
		'livehouse': function(path){
			var id=path.match(/^channel\/([a-zA-Z0-9_-]+)/)[0];
			var content=$.tag('iframe',{'id':randstr(8,7),'src':'data:text/html,Loading...'});
			content.addEventListener('load',function(e){
				var id=e.target.id
				var player=jwplayer(id).setup({
					'playlist': [
						{
							'file':'http://wrtctw-rtcp-tw-1.livehouse.in/'+id+'/video/playlist.m3u8',
							'provider':'plugin/jwplayer_hls/HLSProvider6.swf',
							'type':'hls'
						}
					],
					'primary': 'flash',
					'autostart': true,
					'width': '100%',
					'height': '100%'
				})
				player.onReady(function(){
					$(id+'_wrapper').style.position='static';
				});
				player.onSetupError(function(){
					$(id+'_wrapper').$replace(document.createTextNode('Load Fail.'));
				})
			});
			return content;
		},
		'ustream': function(path){
			if(path.indexOf('recorded')===0){
				return $.tag('iframe',{
					'src': 'http://www.ustream.tv/embed/recorded/'+path.match(/^recorded\/(\d+)/)[1]+'?v=3&wmode=direct&autoplay=1',
					'style': {
						'width': '100%',
						'height': '100%'
					}
				});
			}
			var tag=$.tag('iframe',{
				'src': 'data:text/html,Loading...',
				'style': {
					'width': '100%',
					'height': '100%',
					'background': '#FFF'
				}
			});
			new Ajax('POST','http://api.a0000778.idv.biz/g8v/getsourceid.php',{
				'source': 'ustream',
				'path': path.match(/^(channel\/)?[a-zA-Z0-9-]+/)[0]
			}).on('load',function(){
				console.log('load');
				tag.src=this.result()? 'http://www.ustream.tv/embed/'+this.result()+'?v=3&wmode=direct&autoplay=1':'data:text/html,Load Failed.';
			}).send();
			return tag;
		},
		'youtube': function(path){
			var id=path.match(/(\?|&)v=([a-zA-Z0-9_-]+)/)[2];
			return $.tag('iframe',{
				'src': 'http://www.youtube.com/embed/'+id,
				'allowfullscreen': 'true',
				'style': {
					'width': '100%',
					'height': '100%'
				}
			})
		}
	},
	'chatSource': {
		'justin': function(path){
			var id=path.match(/^[a-zA-Z0-9_-]+/)[0];
			return $.tag('iframe',{
				'src': 'http://zh-tw.justin.tv/chat/embed?channel='+id+'&popout_chat=true',
				'style': {
					'width': '100%',
					'height': '100%'
				}
			})
		},
		'ustream': function(path){
			if(!/^(channel\/)?[a-zA-Z0-9-]+/.test(path)){
				return $.tag('iframe',{
					'src': 'data:text/html,not support',
					'style': {
						'width': '100%',
						'height': '100%',
						'background': '#FFF'
					}
				});
			}
			var tag=$.tag('iframe',{
				'src': 'data:text/html,Loading...',
				'style': {
					'width': '100%',
					'height': '100%',
					'background': '#FFF'
				}
			});
			new Ajax('POST','http://api.a0000778.idv.biz/g8v/getsourceid.php',{
				'source': 'ustream',
				'path': path.match(/^(channel\/)?[a-zA-Z0-9-]+/)[0]
			}).on('load',function(){
				tag.src=this.result()? 'http://www.ustream.tv/socialstream/'+this.result()+'?siteMode=1?activeTab=socialStream&hideVideoTab=1&colorScheme=light&v=6':'data:text/html,Load Failed.';
			}).send();
			return tag;
		},
		'youtube': function(path){
			
		}
	},
	
	'_createWindow': function(obj,objId,title,content){
		$().$add('div',{
			'id': 'window_'+this.windowList.length,
			'className': 'window'
		}).$add('div',{
			'className': 'vw_bar',
			'textContent': title
		},null,true).$add(
			$.tag('div',{
				'className': 'vw_option'
			})
			.$add('span',{
				'className': 'vw_opacity',
				'textContent': '透'
			},null,true)
			.$add('span',{
				'className': 'vw_close',
				'textContent': 'X'
			},null,true)
		,null,true).$add(content);
		var vw=new VirtualWindow(
			'window_'+this.windowList.length,
			obj.value[obj.value.length-4],
			obj.value[obj.value.length-3],
			obj.value[obj.value.length-2],
			obj.value[obj.value.length-1]
		);
		vw.on('move',function(){
			obj.value[obj.value.length-4]=this.posX;
			obj.value[obj.value.length-3]=this.posY;
			g8v.updateShareUrl();
		});
		vw.on('resize',function(){
			obj.value[obj.value.length-2]=this.width;
			obj.value[obj.value.length-1]=this.height;
			g8v.updateShareUrl();
		});
		vw.on('close',function(){
			this.objList.splice(objId);
		}.bind(this));
		this.windowList.push(vw);
		return vw;
	},
	'createVideo': function(form,path,title,left,top,width,height){
		if(!this.videoSource[form]) return false;
		var obj={
			'type': 'video',
			'value': [
				form,
				path,
				title,
				left? left:0,
				top? top:0,
				width? width:800,
				height? height:600
			]
		};
		this._createWindow(obj,this.objList.push(obj)-1,title,this.videoSource[form](path));
		this.updateShareUrl();
		return true;
	},
	'createChat': function(form,path,title,left,top,width,height){
		if(!this.chatSource[form]) return false;
{'fraction_non_alphanumeric': 0.24770472039321154, 'fraction_numerical': 0.022813688212927757, 'mean_word_length': 3.3998368013055895, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, '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': '3452699', 'n_tokens_mistral': 5337, 'n_tokens_neox': 4232, 'n_words': 513}