function getAllColor(){
		var colorArr=[ 
           {
					 name:'浅白',
					 bg:'rgb(255,255,255)',
					 textcolor:'rgb(89,89,89)'
			},
			{
					 name:'淡黄',
					 bg:'rgb(244,236,216)',
					 textcolor:'rgb(91,70,54)'			
			},
			{
					 name:'明黄',
					 bg:'rgb(255,250,233)',
					 textcolor:'rgb(44,39,36)'
			},
			{
					 name:'绿意',
					 bg:'rgb(238,250,238)',
					 textcolor:'rgb(44,39,36)'
			},
			{
					 name:'浅绿',
					 bg:'rgb(206,234,186)',
					 textcolor:'rgb(51,51,51)'
			},
			{
					 name:'草绿',
					 bg:'rgb(134,202,190)',
					 textcolor:'rgb(81,81,81)'
			},
			{
					 name:'粉红',
					 bg:'rgb(255,239,252)',
					 textcolor:'rgb(44,39,36)'
			},
			{
					 name:'淡蓝1',
					 bg:'rgb(220,245,245)',
					 textcolor:'rgb(44,39,36)'
			 },
			 {
					 name:'淡蓝2',
					 bg:'rgb(237,255,255)',
					 textcolor:'rgb(44,39,36)'
			 },
			 {
					 name:'深蓝',
					 bg:'rgb(61,122,168)',
					 textcolor:'rgb(178,204,159)'
			 },
			 {
					 name:'灰色',
					 bg:'rgb(239,239,239)',
					 textcolor:'rgb(44,39,36)'
			 },
			 {
					 name:'深灰',
					 bg:'rgb(69,72,74)',
					 textcolor:'rgb(157,159,163)'
			},
			{
					 name:'深黑',
					 bg:'rgb(51,51,51)',
					 textcolor:'rgb(181,172,162)'
			}
		]

			return colorArr;
}

 new Vue({
			el: '#app',					 
			data: function() {
				     return {
					   fit:"contain",
					   imgUrl:'http://gudianxiaoshuo.com/js/logo.gif',
					   gongzhonghaoUrl:'http://gudianxiaoshuo.com/js/gongzhonghao.jpg',
					   toutiaohaoUrl:'http://gudianxiaoshuo.com/js/toutiaohao.png',
					   options:[],
					   colorArr:[],
					   colorName:'默认',
					   fontName:"宋体",
					   fontSizeOptions:[],					   
					   fontSize:20,
					   textColor:null,
					   bgColor:null,
					   showTip:true,
					   foolcolorVar:'rgb(255,255,255)',
					   scrollcolorVar:'rgb(255,255,255)',
					   scrollHiddenVar:'none',
					   zanshangUrl:""
					       }
				  },
			
					methods:{
				  	open (){
					this.$message('右键，选择大声朗读即可');
					},
					closeTip(){
						localStorage.setItem('tipClosed', '1');
					  },
					 selectOne(fontName){        
                       var fontFamily="font-family:"+fontName;
                       document.querySelector('#app').style.setProperty('font-family',fontName)
					   localStorage.setItem('font', fontFamily);
					   localStorage.setItem('fontName', fontName);
				   },
				   selectFontSize(fontSize){     
					 
					  // document.body.requestFullscreen();   
                 
                       document.querySelector('#app').style.setProperty('font-size',fontSize)
					   localStorage.setItem('fontSize', fontSize);
				   },
				   selectColorName(colorIndex)
				   {
				     console.log(colorIndex);
					 console.log(this.colorArr[colorIndex]);
					 this.setTBColor(this.colorArr[colorIndex].textcolor,this.colorArr[colorIndex].bg);
					 localStorage.setItem('corlorIndex', colorIndex);
				   },
				   setTBColor(textColor,bgColor)
				   {
						document.querySelector('body').style.setProperty('background',bgColor)
						var x = document.querySelectorAll("p");
						var i;
						for (i = 0; i < x.length; i++) {
							x[i].style.color =textColor; 
						}
						localStorage.setItem('bg', bgColor);
						localStorage.setItem('pColor',textColor);
						this.textColor=textColor;
					    this.bgColor=bgColor;
				   },
				   el_colorPic_change()
				   {
					this.setTBColor(this.textColor,this.bgColor);
					this.saveRand(this.textColor,this.bgColor);
					console.log(this.textColor)
				   },
				   saveRand(textColor,bgColor){
					       var lastElemName=this.colorArr[this.colorArr.length-1].name;
							if(lastElemName=='随机色')
							{
								this.colorArr[this.colorArr.length-1].bg=bgColor;
								this.colorArr[this.colorArr.length-1].textcolor=textColor;
							}else{
								
								var fontElem={};
								fontElem.name='随机色';
								fontElem.bg=bgColor;
								fontElem.textcolor=textColor;
								this.colorArr.push(fontElem);
							}
							localStorage.setItem('Randbg', bgColor);
						    localStorage.setItem('RandTColor',textColor);	
				   },
				   rdmRgbColor() {
					const arr = [];
					for (let i = 0; i < 3; i++) {
						arr.push(Math.floor(Math.random() * 256));
					}
					const [r, g, b] = arr;
					var color=`rgb(${r},${g},${b})`;
					return color;
					},


					colorBtn:function(name){
						console.log(name);
					    if(name=="btn1")
						{
                            this.setTBColor('rgb(89,89,89)','rgb(255,255,255)');
						}
				  		else if(name=="btn2")
						{
							this.setTBColor('rgb(91,70,54)','rgb(242,236,216)');
						}
						else if(name=="btn3")
						{
							this.setTBColor('rgb(51,51,51)','rgb(206,234,186)');
						}
						else if(name=="btn4")
						{
							this.setTBColor('rgb(157,159,163)','rgb(69,72,74)');
						}
						else if(name=="btn5")
						{
							this.setTBColor('rgb(181,172,162)','rgb(51,51,51)');
						}
						else if(name=='rand')
						{
							let bgColor=this.rdmRgbColor();				
							let textColor=this.rdmRgbColor();			
							this.setTBColor(textColor,bgColor);
							this.saveRand(textColor,bgColor);
						
						}
						else if(name=='full')
						{
							
							var bgColor=localStorage.getItem('bg');
							this.foolcolorVar=bgColor;
							this.scrollcolorVar=bgColor;
							document.getElementById('mainContent').requestFullscreen();			
						}
						else if(name=='fav')
						{							
						     this.$message({
								dangerouslyUseHTMLString: true,
								message:'浏览器不支持自动添加收藏夹标签。请您使用快捷键   <strong style="color:red"><i> Ctrl+D</i> </strong>进行添加'}
								);
						}
					},
					myEventFunc(event) {
						let x=event.pageX;
						let rect=document.getElementById('mainContent').getBoundingClientRect();						
                        if(x>rect.right-50)
							this.scrollHiddenVar='inline';
						else
							this.scrollHiddenVar='none';

							
					},
					myHandleSelect(key) {
               
				    location.href=key;
	  		  }



				  },
				  created (){
					  console.log("beforeMount")
					  if($("#youshengHeader"))
					  	console.log("youshengHeader")
					// $("#youshengHeader").load('http://gudianxiaoshuo.com/js/youshengHeader.html')
				  }, 
				  beforeMount(){
					
				  },
				  mounted(){
				
				  	  var tip=localStorage.getItem('tipClosed');
					  if(tip)
						 this.showTip = false;
					  var bgColor=localStorage.getItem('bg');
					  var pColor=localStorage.getItem('pColor');
					  if(bgColor&&pColor){
                          this.textColor=pColor;
						  this.bgColor=bgColor;
						  document.querySelector('body').style.setProperty('background',bgColor);
						  var x = document.querySelectorAll("p");
						  var i;
						  for (i = 0; i < x.length; i++)
							  x[i].style.color = pColor;
					  }
					    var fontArr=getAllFont();
						for (i=0;i<fontArr.length;i++)
						{
							var fontElem={};
							fontElem.value=fontArr[i];
							fontElem.label=fontArr[i];
							this.options.push(fontElem);
						}
						let fontName=localStorage.getItem('fontName');
						if(fontName)
							{
								document.querySelector('#app').style.setProperty('font-family',fontName);
								this.fontName=fontName;
							}

						for (i=20;i<100;i++)
						{
							var fontElem={};
							fontElem.value=i;
							fontElem.label=i;
							this.fontSizeOptions.push(fontElem);
						}

						let fontSize=localStorage.getItem('fontSize');
						if(fontSize)
						{
							document.querySelector('#app').style.setProperty('font-size',fontSize)
							this.fontSize=fontSize
						}	
						
						window.addEventListener('mousemove', this.myEventFunc);

						this.colorArr=getAllColor();

						var Randbg=localStorage.getItem('Randbg');
					    var RandTColor=localStorage.getItem('RandTColor');
                        if(Randbg)
						{
							    var fontElem={};
								fontElem.name='随机色';
								fontElem.bg=Randbg;
								fontElem.textcolor=RandTColor;
								this.colorArr.push(fontElem);
						}

						let colorIndex=localStorage.getItem('corlorIndex');
						console.log(colorIndex)
						console.log(this.colorArr)
						if(colorIndex&&colorIndex<this.colorArr.length)
	                    	this.colorName=this.colorArr[colorIndex].name;

						var zan=getWeixin();
						if(zan)
							this.zanshangUrl=zan;
						else{
							zan=getWeixinFromLocal();							
							this.zanshangUrl=zan;
						}

		
					   
					   
				  }
				})
			