1/** 2 * @copyright Copyright (C) 2012 Cedric KEIFLIN alias ced1870 3 * http://www.joomlack.fr 4 * Module Accordeon CK 5 * @license GNU/GPL 6 * */ 7 8(function($) { 9 10 //define the defaults for the plugin and how to call it 11 $.fn.accordeonmenuck = function(options) { 12 //set default options 13 var defaults = { 14 eventtype: 'click', 15 fadetransition: false, // pas encore implemente 16 transition: 'linear', 17 duree: 500, 18 imageplus: 'modules/mod_accordeonck/assets/plus.png', 19 imageminus: 'modules/mod_accordeonck/assets/minus.png', 20 // menuID : 'accordeonck', 21 defaultopenedid: '0', 22 showactive: true, 23 activeeffect: true, 24 showcounter: false 25 }; 26 27 //call in the default otions 28 var opts = $.extend(defaults, options); 29 var menu = this; 30 31 //act upon the element that is passed into the design 32 return menu.each(function(options) { 33 if (! menu.attr('accordeonck_done')) { 34 menu.attr('accordeonck_done', '1'); 35 accordeonmenuInit(); 36 } 37 }); 38 39 function accordeonmenuInit() { 40 $(".parent > ul", menu).hide(); 41 if (opts.showactive && !opts.activeeffect) { 42 $(".parent.active > ul", menu).show().parent().addClass("open"); 43 $(".parent.active > img.toggler", menu).attr('src', opts.imageminus); 44 } else if (opts.showactive && opts.activeeffect) { 45 togglemenu($(".parent.active > .toggler", menu)); 46 } 47 if (opts.defaultopenedid && !$(".active.parent", menu).length) { 48 $(".item-"+opts.defaultopenedid+" > ul", menu).show().parent().addClass("open"); 49 $(".item-"+opts.defaultopenedid+" > img.toggler", menu).attr('src', opts.imageminus); 50 } 51 if (opts.eventtype == 'click') { 52 $("li.parent > .toggler", menu).click(function() { 53 togglemenu($(this)); 54 }); 55 } else { 56 $("li.parent > .toggler", menu).mouseenter(function() { 57 togglemenu($(this)); 58 }); 59 } 60 if (opts.showcounter == true) { 61 if ($('.accordeonck-counter', menu).length) return; 62 $('li.accordeonck.parent', menu).each(function() { 63 // if ($('li.accordeonck', $(this)).length) { 64 var counter = '<span class="badge accordeonck-counter">' + ($('a.accordeonck', $(this)).length - 1) + '</span>'; 65 $(this).find('> .accordeonck_outer > a.accordeonck').append(counter); 66 // } 67 }); 68 } 69 } 70 71 function togglemenu(link) { 72 ck_content = link.parent(); 73 if (!link.parent().hasClass("open")) { 74 $(".parent > ul", ck_content.parent()).slideUp({ 75 duration: opts.duree, 76 easing: opts.transition, 77 complete: function() { 78 $(".parent", ck_content.parent()).removeClass("open"); 79 $(".parent > img.toggler", ck_content.parent()).attr('src', opts.imageplus); 80 if (link.get(0).tagName.toLowerCase() == 'img') 81 link.attr('src', opts.imageplus); 82 } 83 }); 84 link.nextAll("ul").slideDown({ 85 duration: opts.duree, 86 easing: opts.transition, 87 complete: function() { 88 link.parent().addClass("open"); 89 if (link.get(0).tagName.toLowerCase() == 'img') 90 link.attr('src', opts.imageminus); 91 } 92 }); 93 } else { 94 link.nextAll("ul").slideUp({ 95 duration: opts.duree, 96 easing: opts.transition, 97 complete: function() { 98 link.parent().removeClass("open"); 99 if (link.get(0).tagName.toLowerCase() == 'img') 100 link.attr('src', opts.imageplus); 101 } 102 }); 103 } 104 } 105 106 }; 107})(jQuery);
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.