Mercurial > hg > extraction-interface
comparison search/search.js @ 0:b12c99b7c3f0
commit for previous development
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 19 Jan 2015 17:13:49 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b12c99b7c3f0 |
---|---|
1 $(document).ready(function(){ | |
2 initSection(); | |
3 }); | |
4 function initSection(){ //Hide sections if there are more than 5 | |
5 $("td div.section").hide(); | |
6 for(var i=1; i<=5; i++){ | |
7 $("td div.section:nth-child("+i+")").show(); | |
8 } | |
9 $("td:has(div)").each(function(){ | |
10 console.log($(this).children().length); | |
11 if($(this).children().length<=5){ | |
12 return; | |
13 } | |
14 var last=$(this).children(".section").last(); | |
15 $("<div/>").addClass("visibilityControl").html("+").insertAfter(last); | |
16 }); | |
17 $("td div.visibilityControl").click(function(){ | |
18 if($(this).html()=="+"){ | |
19 $(this).parent().children(".section").show(); | |
20 $(this).html("-"); | |
21 return; | |
22 } | |
23 if($(this).html()=="-"){ | |
24 $(this).parent().children(".section").hide(); | |
25 for(var i=1; i<=5; i++){ | |
26 $(this).parent().children(".section:nth-child("+i+")").show(); | |
27 } | |
28 $(this).html("+"); | |
29 } | |
30 }); | |
31 } |