<commit_before>define(['FFF','zepto'],function(FFF,$){
	var F=FFF.FFF;
	var Widget=F.Widget;
	function FontSelect(){
		Widget.apply(this,arguments);
	}

	FontSelect.ATTRS={
		boundingBox:{
			value:$('<div class="dropdown W_s_fl"></div>')
		},
		title:{
			value:'选择字体',
			changeFn:function(obj){
				var that =this;
				that.$btn.text(obj.value);
			}
		},
		selectIndex:{
			value:0
		}
	}
	F.extend(FontSelect,Widget,{
		initialize:function(){

		},
		renderUI:function(){
			var that=this;
			var html ='';
			var btnhtml='<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1">'+that.getTitle()+'<span class="caret"></span></button>';
			$.ajax({
	            type: "get",
	            url: '/loadFontlist', 
	            success: function(data){  
	            	 for (var i = 0; i < data.length; i++) {
	            	 	var ff =data[i].replace(/\.\w*/g,"");
	            	 	if(ff!=""){ 
	            	 	 html+='<li  fontname="'+ff+'" class="W_li_click" ><a  index="'+i+'"  href="javasctipt:void(0)">'+ff+'</a></li>';
	            	 	}
	            	 }; 

	                var ulhtml ='<ul class="dropdown-menu J_select"">'+html+'</ul>' ;
	             
	               that.getBoundingBox().append(btnhtml+ulhtml);

	            },
	            error: function(xhr, type){
	                alert('Ajax error!')
	            }   
           });


		},
		bindUI:function(){
			var that=this;	

			setTimeout(function(){
				var $dom =  that.getBoundingBox();

			  that.$btn =$dom.find('#dropdownMenu1');

			 that.$ul =$dom.find('.J_select');
           
            var $lic =$dom.find('.W_li_click');

            that.$btn.on('click',function(){
            	that.$ul.show(); 
            })
            $lic.on('click',function(){
            	 that.setTitle($(this).children('a').text());
            	 that.setSelectIndex($(this).children('a').attr('index'));
            	 that.$ul.hide(); 
            })		

			},1000)
			
			

			 
		},
		destructor:function(){

		},
		getFonts:function(){
			var that=this;
			var html='';	
			$.ajax({
	            type: "get",
	            url: '/loadFontlist', 
	            success: function(data){    
	            	 for (var i = 0; i < data.length; i++) {
	            	 	var ff =data[i].replace(/\.\w*/g,"");
	            	 	var isadd =false;
	            	 	if(ff=="") continue; 
	            	 	var $ul = that.$ul.children('li')
	            	    $ul.each(function(inde,item){
	            	  	var fontname = $(item).attr('fontname');<commit_msg>修改上传后不能选中<commit_after>define(['FFF','zepto'],function(FFF,$){
	var F=FFF.FFF;
	var Widget=F.Widget;
	function FontSelect(){
		Widget.apply(this,arguments);
	}

	FontSelect.ATTRS={
		boundingBox:{
			value:$('<div class="dropdown W_s_fl"></div>')
		},
		title:{
			value:'选择字体',
			changeFn:function(obj){
				var that =this;
				that.$btn.text(obj.value);
			}
		},
		selectIndex:{
			value:0
		}
	}
	F.extend(FontSelect,Widget,{
		initialize:function(){

		},
		renderUI:function(){
			var that=this;
			var html ='';
			var btnhtml='<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1">'+that.getTitle()+'<span class="caret"></span></button>';
			$.ajax({
	            type: "get",
	            url: '/loadFontlist', 
	            success: function(data){  
	            	 for (var i = 0; i < data.length; i++) {
	            	 	var ff =data[i].replace(/\.\w*/g,"");
	            	 	if(ff!=""){ 
	            	 	 html+='<li  fontname="'+ff+'" class="W_li_click" ><a  index="'+i+'"  href="javasctipt:void(0)">'+ff+'</a></li>';
	            	 	}
	            	 }; 

	                var ulhtml ='<ul class="dropdown-menu J_select"">'+html+'</ul>' ;
	             
	               that.getBoundingBox().append(btnhtml+ulhtml);

	            },
	            error: function(xhr, type){
	                alert('Ajax error!')
	            }   
           });


		},
		bindUI:function(){
			var that=this;	

			setTimeout(function(){
				var $dom =  that.getBoundingBox();

			  that.$btn =$dom.find('#dropdownMenu1');

			 that.$ul =$dom.find('.J_select');
           
            var $lic =$dom.find('.W_li_click');

            that.$btn.on('click',function(){
              	that.$ul.show(); 
            })
            that.$ul.on('click',function(e){
            	   var target = e.target.tagName.toUpperCase();
            	     if(target=="A" || target=="LI"){
            	     	var txt = $(e.target).text() || $(e.target).children('a').text(); 
            	     	var index = $(e.target).attr('index') || $(e.target).children('a').attr('index'); 
            	     	that.setTitle(txt);
		            	 that.setSelectIndex(parseInt(index));
		            	 $(this).hide();
            	     }  
            	  
            })		

			},1000)
			
			

			 
		},
		destructor:function(){

		},
		getFonts:function(){
			var that=this;
			var html='';	
			$.ajax({
	            type: "get",
	            url: '/loadFontlist', 
	            success: function(data){    
	            	 for (var i = 0; i < data.length; i++) {
	            	 	var ff =data[i].replace(/\.\w*/g,"");
	            	 	var isadd =false;
	            	 	if(ff=="") continue; 
	            	 	var $ul = that.$ul.children('li')
	            	    $ul.each(function(inde,item){
	            	  	var fontname = $(item).attr('fontname');
{'fraction_non_alphanumeric': 0.1918702218907328, 'fraction_numerical': 0.003729256013425322, 'mean_word_length': 1.745138178096213, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 27, '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': '7453209', 'n_tokens_mistral': 2026, 'n_tokens_neox': 1760, 'n_words': 268}