view search/search.js @ 6:63e08b98032f

rewrite extraction interface into PHP MVC architecture. (Although js hasn't been rewritten into MVC, it's fitted into the current PHP MVC architecture.) - The root of the new PHP MVC is at 'develop/'. - extraction interface is called "Extractapp" with several action, eg TaggingText, EditWordlist, EditTaglist, ExportTable.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 05 Feb 2015 16:07:53 +0100
parents b12c99b7c3f0
children
line wrap: on
line source

$(document).ready(function(){
	initSection();
});
function initSection(){ //Hide sections if there are more than 5
	$("td div.section").hide();
	for(var i=1; i<=5; i++){
		$("td div.section:nth-child("+i+")").show();
	}
	$("td:has(div)").each(function(){
		console.log($(this).children().length);
		if($(this).children().length<=5){
			return;
		}
		var last=$(this).children(".section").last();
		$("<div/>").addClass("visibilityControl").html("+").insertAfter(last);
	});
	$("td div.visibilityControl").click(function(){
		if($(this).html()=="+"){
			$(this).parent().children(".section").show();
			$(this).html("-");
			return;
		}
		if($(this).html()=="-"){
			$(this).parent().children(".section").hide();
			for(var i=1; i<=5; i++){
				$(this).parent().children(".section:nth-child("+i+")").show();
			}
			$(this).html("+");
		}
	});
}