<commit_before>//所有目录项
var categoryList=[
'Home',
'CSS',
'Javascript',
'Algorithm'
]

function Article(title,category,strDate,url){
	this.title=title;
	this.category=category;
	this.date=strDate;
	this.url=url
}
//所有文章,按日期存储
var articleList=[
new Article('闭合浮动',categoryList[1],'|2016.4.8','CSS/clearfix.html'),
new Article('ife_task3',categoryList[1],'|2016.5.10','CSS/ife_task/task3.html'),
new Article('ife_task4',categoryList[1],'|2016.5.10','CSS/ife_task/task4.html'),
new Article('ife_task6',categoryList[1],'|2016.5.10','CSS/ife_task/task6.html'),
new Article('ife_task8',categoryList[1],'|2016.5.10','CSS/ife_task/task8.html'),
new Article('ife_task10',categoryList[1],'|2016.5.10','CSS/ife_task/task10.html'),
new Article('ife_task12',categoryList[1],'|2016.5.10','CSS/ife_task/task12.html'),
];
var pageNum=0;
var startIndex=0;//在当前页码下,category在articleList中的起始位置
//找到某个category在articleList中的起始位置
function findIndex(category){
	if(category=='Home')
		return 0;
	var i;
	for(i=0;i<articleList.length;i++)
		if(articleList[i].category==category)
			return i;
}
function sortByCty(category){
	articleList.sort(function(a,b){
			if(a.category!=category&&b.category==category)
				return 1;
			else
				return -1;
		});
}
//对article的date进行处理，便于排序
function dateFormat(date){
	var d=date.replace(/\|/,' ');
	
	var dd=d.split('.');
	for(var i in dd){
		dd[i]=parseInt(dd[i]);
		
	}
	return dd;
}
//根据article的date进行排序
function sortByDate(){
	articleList.sort(function(a,b){
		var d1=dateFormat(a.date);
		var d2=dateFormat(b.date);
		for(var i=0;i<d1.length;i++ )
		{
			if(d1[i]<d2[i])
				return 1;
		}
		return -1;
	});
}
//生成某一页article list ,先hide原先的article,然后再fadeIn
function generatorArticleList(category,titleNum){
	var i;
	var articleId;
	//隐藏当前界面的articleList
	for(i=0;i<titleNum;i++)
	{
		articleId='#article'+(i+1).toString();
		$(articleId).hide();
	}
	//对于'Home'
	if(category=='Home')
	{
		for(i=0;i<titleNum;i++,startIndex++)
		{
			
			if(startIndex>=articleList.length)
				break;
			articleId='#article'+(i+1).toString();
			$(articleId+' .title').text(articleList[startIndex].title);
			$(articleId+' .title').attr('href',articleList[startIndex].url);
			$(articleId+' .date').text(articleList[startIndex].date);
			$(articleId+' .category').text(articleList[startIndex].category);
			$(articleId).fadeIn(1000);
		}
	}
	//对于其他category
	else{	
		for(i=0;i<titleNum;startIndex++)
		{
			if(startIndex>=articleList.length)
				break;
			if(articleList[startIndex].category==category)
			{
				articleId='#article'+(i+1).toString();
				$(articleId+' .title').text(articleList[startIndex].title);
				$(articleId+' .title').attr('href',articleList[startIndex].url);
				$(articleId+' .date').text(articleList[startIndex].date);
				$(articleId+' .category').text(articleList[startIndex].category);
				$(articleId).fadeIn(1000);
				i++;				
			}
		}
	}
	//页码加1
	pageNum++;
}
$(document).ready(function(){
	var titleNum=$('#article li').toArray().length;
	generatorArticleList('Home',titleNum);
	$('#article').fadeIn(2000);
	$('#Home').click(function(){
		$('#theme').text($('#Home').text());
		pageNum=0;
		startIndex=0;
		sortByDate();
		generatorArticleList('Home',titleNum);
	});<commit_msg>ife_part1 commit<commit_after>//所有目录项
var categoryList=[
'Home',
'CSS',
'Javascript',
'Algorithm'
]

function Article(title,category,strDate,url){
	this.title=title;
	this.category=category;
	this.date=strDate;
	this.url=url
}
//所有文章,按日期存储
var articleList=[
new Article('闭合浮动',categoryList[1],'|2016.4.8','CSS/clearfix.html'),
new Article('ife_task3',categoryList[1],'|2016.5.10','CSS/ife_task/task3.html'),
new Article('ife_task4',categoryList[1],'|2016.5.10','CSS/ife_task/task4.html'),
new Article('ife_task6',categoryList[1],'|2016.5.10','CSS/ife_task/task6.html'),
new Article('ife_task8',categoryList[1],'|2016.5.10','CSS/ife_task/task8.html'),
new Article('ife_task10',categoryList[1],'|2016.5.10','CSS/ife_task/task10.html'),
new Article('ife_task12',categoryList[1],'|2016.5.10','CSS/ife_task/task12.html'),
];
var pageNum=0;
var startIndex=0;//在当前页码下,category在articleList中的起始位置
//找到某个category在articleList中的起始位置
function findIndex(category){
	if(category=='Home')
		return 0;
	var i;
	for(i=0;i<articleList.length;i++)
		if(articleList[i].category==category)
			return i;
}
function sortByCty(category){
	articleList.sort(function(a,b){
			if(a.category!=category&&b.category==category)
				return 1;
			else
				return -1;
		});
}
//对article的date进行处理，便于排序
function dateFormat(date){
	var d=date.replace(/\|/,' ');
	
	var dd=d.split('.');
	for(var i in dd){
		dd[i]=parseInt(dd[i]);
		
	}
	return dd;
}
//根据article的date进行排序
function sortByDate(){
	articleList.sort(function(a,b){
		var d1=dateFormat(a.date);
		var d2=dateFormat(b.date);
		for(var i=0;i<d1.length;i++ )
		{
			if(d1[i]<d2[i])
				return 1;
		}
		return -1;
	});
}
//生成某一页article list ,先hide原先的article,然后再fadeIn
function generatorArticleList(category,titleNum){
	var i;
	var articleId;
	//隐藏当前界面的articleList
	for(i=0;i<titleNum;i++)
	{
		articleId='#article'+(i+1).toString();
		$(articleId).hide();
	}
	//对于'Home'
	if(category=='Home')
	{
		for(i=0;i<titleNum;i++,startIndex++)
		{
			
			if(startIndex>=articleList.length)
				break;
			articleId='#article'+(i+1).toString();
			$(articleId+' .title').text(articleList[startIndex].title);
			$(articleId+' .title').attr('href',articleList[startIndex].url);
			$(articleId+' .date').text(articleList[startIndex].date);
			$(articleId+' .category').text(articleList[startIndex].category);
			$(articleId).fadeIn(1000);
		}
	}
	//对于其他category
	else{	
		for(i=0;i<titleNum;startIndex++)
		{
			if(startIndex>=articleList.length)
				break;
			if(articleList[startIndex].category==category)
			{
				articleId='#article'+(i+1).toString();
				$(articleId+' .title').text(articleList[startIndex].title);
				$(articleId+' .title').attr('href',articleList[startIndex].url);
				$(articleId+' .date').text(articleList[startIndex].date);
				$(articleId+' .category').text(articleList[startIndex].category);
				$(articleId).fadeIn(1000);
				i++;				
			}
		}
	}
	//页码加1
	pageNum++;
}
$(document).ready(function(){
	var titleNum=$('#article li').toArray().length;
	sortByDate();
	generatorArticleList('Home',titleNum);
	$('#article').fadeIn(2000);
	$('#Home').click(function(){
		$('#theme').text($('#Home').text());
		pageNum=0;
		startIndex=0;
		sortByDate();
		generatorArticleList('Home',titleNum);
	});
{'fraction_non_alphanumeric': 0.21215418091389493, 'fraction_numerical': 0.03310537768106932, 'mean_word_length': 5.745283018867925, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, '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': '69829', 'n_tokens_mistral': 2827, 'n_tokens_neox': 2580, 'n_words': 288}