1/** 2 * @copyright Copyright (C) 2012 Cedric KEIFLIN alias ced1870 3 * https://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 var Accordeonmenuck = function (container, 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_accordeonmenuck/assets/plus.png', 19 imageminus: 'modules/mod_accordeonmenuck/assets/minus.png', 20 // menuID : 'accordeonck', 21 defaultopenedid: '0', 22 showactive: true, 23 activeeffect: true, 24 showcounter: false 25 }; 26 27 if (!(this instanceof Accordeonmenuck)) return new Accordeonmenuck(container, options); 28 var accordeonmenucks = window.accordeonmenucks || []; 29 if (accordeonmenucks.indexOf(container) > -1) return; 30 accordeonmenucks.push(container); 31 window.accordeonmenucks = accordeonmenucks; 32 33 //call in the default otions 34 var options = $.extend(defaults, options); 35 var menu = $(container); 36 37 //act upon the element that is passed into the design 38 return menu.each(function(options) { 39 if (! menu.attr('accordeonck_done')) { 40 menu.attr('accordeonck_done', '1'); 41 accordeonmenuInit(); 42 } 43 }); 44 45 function accordeonmenuInit() { 46 $(".parent > ul", menu).hide(); 47 if (options.showactive && !options.activeeffect) { 48 $(".parent.active > ul", menu).show().parent().addClass("open"); 49 $(".parent.active > img.toggler", menu).attr('src', options.imageminus); 50 } else if (options.showactive && options.activeeffect) { 51 togglemenu($(".parent.active > .toggler", menu)); 52 } 53 if (options.defaultopenedid && !$(".active.parent", menu).length) { 54 $(".item-"+options.defaultopenedid+" > ul", menu).show().parent().addClass("open"); 55 $(".item-"+options.defaultopenedid+" > img.toggler", menu).attr('src', options.imageminus); 56 } 57 if (options.eventtype == 'click') { 58 $("li.parent > .toggler", menu).click(function() { 59 togglemenu($(this)); 60 }); 61 } else { 62 $("li.parent > .toggler", menu).mouseenter(function() { 63 togglemenu($(this)); 64 }); 65 } 66 if (options.showcounter == true) { 67 if ($('.accordeonck-counter', menu).length) return; 68 $('li.accordeonck.parent', menu).each(function() { 69 // if ($('li.accordeonck', $(this)).length) { 70 var counter = '<span class="badge accordeonck-counter">' + ($('a.accordeonck', $(this)).length - 1) + '</span>'; 71 $(this).find('> .accordeonck_outer > a.accordeonck').append(counter); 72 // } 73 }); 74 } 75 } 76 77 function togglemenu(link) { 78 ck_content = link.parent(); 79 if (!link.parent().hasClass("open")) { 80 $(".parent > ul", ck_content.parent()).slideUp({ 81 duration: options.duree, 82 easing: options.transition, 83 complete: function() { 84 $(".parent", ck_content.parent()).removeClass("open"); 85 $(".parent > img.toggler", ck_content.parent()).attr('src', options.imageplus); 86 if (link.get(0).tagName.toLowerCase() == 'img') 87 link.attr('src', options.imageplus); 88 } 89 }); 90 link.nextAll("ul").slideDown({ 91 duration: options.duree, 92 easing: options.transition, 93 complete: function() { 94 link.parent().addClass("open"); 95 if (link.get(0).tagName.toLowerCase() == 'img') 96 link.attr('src', options.imageminus); 97 } 98 }); 99 } else { 100 link.nextAll("ul").slideUp({ 101 duration: options.duree, 102 easing: options.transition, 103 complete: function() { 104 link.parent().removeClass("open"); 105 if (link.get(0).tagName.toLowerCase() == 'img') 106 link.attr('src', options.imageplus); 107 } 108 }); 109 } 110 } 111 112 }; 113 window.Accordeonmenuck = Accordeonmenuck; 114})(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.