1/** 2 * 2008 - 2020 (c) Prestablog 3 * 4 * MODULE PrestaBlog 5 * 6 * @author Prestablog 7 * @copyright Copyright (c) permanent, Prestablog 8 * @license Commercial 9 10 */ 11 12$(document).ready(function(){ 13 $('ul.prestablogtree.dhtml').hide(); 14 15 //to do not execute this script as much as it's called... 16 if(!$('ul.prestablogtree.dhtml').hasClass('dynamized')) 17 { 18 //add growers to each ul.prestablogtree elements 19 $('ul.prestablogtree.dhtml ul').prev().before("<span class='grower OPEN'> </span>"); 20 21 //dynamically add the '.last' class on each last item of a branch 22 $('ul.prestablogtree.dhtml ul li:last-child, ul.prestablogtree.dhtml li:last-child').addClass('last'); 23 24 //collapse every expanded branch 25 $('ul.prestablogtree.dhtml span.grower.OPEN').addClass('CLOSE').removeClass('OPEN').parent().find('ul:first').hide(); 26 $('ul.prestablogtree.dhtml').show(); 27 28 //open the prestablogtree for the selected branch 29 $('ul.prestablogtree.dhtml .selected').parents().each( function() { 30 if ($(this).is('ul')) 31 toggleBranch($(this).prev().prev(), true); 32 }); 33 toggleBranch( $('ul.prestablogtree.dhtml .selected').prev(), true); 34 35 //add a fonction on clicks on growers 36 $('ul.prestablogtree.dhtml span.grower').click(function(){ 37 toggleBranch($(this)); 38 }); 39 //mark this 'ul.prestablogtree' elements as already 'dynamized' 40 $('ul.prestablogtree.dhtml').addClass('dynamized'); 41 42 $('ul.prestablogtree.dhtml').removeClass('dhtml'); 43 } 44}); 45 46//animate the opening of the branch (span.grower jQueryElement) 47function openBranch(jQueryElement, noAnimation) 48{ 49 jQueryElement.addClass('OPEN').removeClass('CLOSE'); 50 if(noAnimation) 51 jQueryElement.parent().find('ul:first').show(); 52 else 53 jQueryElement.parent().find('ul:first').slideDown(); 54 55 // jQueryElement.parents('ul').find('li').each(function() { 56 // if($(this).find('span.grower') != jQueryElement) 57 // $(this).find('a img.catblog_img, a.catblog_desc').fadeOut(); 58 // }); 59} 60//animate the closing of the branch (span.grower jQueryElement) 61function closeBranch(jQueryElement, noAnimation) 62{ 63 jQueryElement.addClass('CLOSE').removeClass('OPEN'); 64 if(noAnimation) 65 jQueryElement.parent().find('ul:first').hide(); 66 else 67 jQueryElement.parent().find('ul:first').slideUp(); 68 69 // jQueryElement.parents('ul').find('li').each(function() { 70 // if($(this).find('span.grower') != jQueryElement) 71 // $(this).find('a img.catblog_img, a.catblog_desc').fadeIn(); 72 // }); 73} 74 75//animate the closing or opening of the branch (ul jQueryElement) 76function toggleBranch(jQueryElement, noAnimation) 77{ 78 if(jQueryElement.hasClass('OPEN')) 79 closeBranch(jQueryElement, noAnimation); 80 else 81 openBranch(jQueryElement, noAnimation); 82}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.