1/** 2 * @copyright Copyright (C) 2012 Cedric KEIFLIN alias ced1870 3 * https://www.joomlack.fr 4 * Module Maximenu CK 5 * @license GNU/GPL 6 * */ 7 8(function($) { 9 10 //define the defaults for the plugin and how to call it 11 $.fn.FancyMaxiMenu = function(options) { 12 //set default options 13 var defaults = { 14 fancyTransition: 'linear', 15 fancyDuree: 500 16 }; 17 18 var options = $.extend(defaults, options); 19 var maximenuObj = this; 20 21 //act upon the element that is passed into the design 22 return maximenuObj.each(function(options) { 23 24 var fancyTransition = defaults.fancyTransition; 25 var fancyDuree = defaults.fancyDuree; 26 27 fancymaximenuInit(); 28 29 function fancymaximenuInit() { 30 if ($('li.active.level1', maximenuObj).length) { 31 maximenuObj.currentItem = $('li.active.level1', maximenuObj); 32 } else { 33 maximenuObj.currentItem = $('li.hoverbgactive.level1', maximenuObj); 34 } 35 36 if (!maximenuObj.currentItem.length) { 37 $('li.level1', maximenuObj).each(function(i, el) { 38 el = $(el); 39 el.mouseenter(function() { 40 if (!$('li.hoverbgactive', maximenuObj).length) { 41 el.addClass('hoverbgactive'); 42 maximenuObj.FancyMaxiMenu({fancyTransition: fancyTransition, fancyDuree: fancyDuree}); 43 } 44 45 //currentItem = this; 46 47 }); 48 }); 49 } 50 51 // if no active element in the menu, get out 52 if (!$('.active', maximenuObj).length && !$('.hoverbgactive', maximenuObj).length) 53 return false; 54 55 56 $('ul.maximenuck', maximenuObj).append('<li class="maxiFancybackground"><div class="maxiFancycenter"><div class="maxiFancyleft"><div class="maxiFancyright"></div></div></div></li>'); 57 fancyItem = $('.maxiFancybackground', maximenuObj); 58 59 if (maximenuObj.currentItem.length) 60 setCurrent(maximenuObj.currentItem); 61 62 $('li.level1', maximenuObj).each(function(i, el) { 63 el = $(el); 64 el.mouseenter(function() { 65 moveFancyck(el); 66 }); 67 el.mouseleave(function() { 68 if (!$('li.active', maximenuObj).length) { 69 $('.maxiFancybackground', maximenuObj).stop(false, false).animate({left: 0, width: 0}, {duration: fancyDuree, easing: fancyTransition}); 70 } else { 71 moveFancyck($(maximenuObj.currentItem)); 72 } 73 }); 74 }); 75 } 76 77 function moveFancyck(toEl) { 78 var toEl_left = toEl.position().left + parseInt(toEl.css('marginLeft')); 79 var toEl_width = toEl.outerWidth(); 80 $('.maxiFancybackground', maximenuObj).stop(false, false).animate({left: toEl_left, width: toEl_width}, {duration: fancyDuree, easing: fancyTransition}); 81 } 82 83 function setCurrent(el) { 84 el = $(el); 85 //Retrieve the selected item position and width 86 var default_left = Math.round(el.position().left) + parseInt(el.css('marginLeft')); 87 var default_width = el.outerWidth(); 88 89 //Set the floating bar position and width 90 $('.maxiFancybackground', maximenuObj).stop(false, false).animate({left: default_left, width: default_width}, {duration: fancyDuree, easing: fancyTransition}); 91 } 92 }); 93 }; 94})(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.