1/* accordion menu plugin*/ 2;(function($, window, document, undefined) { 3 var pluginName = "accordion"; 4 var defaults = { 5 speed: 200, 6 showDelay: 0, 7 hideDelay: 0, 8 singleOpen: true, 9 clickEffect: true, 10 indicator: 'submenu-indicator-minus', 11 subMenu: 'submenu', 12 event: 'click' // click, touchstart 13 }; 14 15 function Plugin(element, options) { 16 this.element = element; 17 this.settings = $.extend({}, defaults, options); 18 this._defaults = defaults; 19 this._name = pluginName; 20 this.init(); 21 } 22 $.extend(Plugin.prototype, { 23 init: function() { 24 this.openSubmenu(); 25 this.submenuIndicators(); 26 if (defaults.clickEffect) { 27 this.addClickEffect(); 28 } 29 }, 30 openSubmenu: function() { 31 $(this.element).children("ul").find("li").bind(defaults.event, function(e) { 32 e.stopPropagation(); 33 e.preventDefault(); 34 var $subMenus = $(this).children("." + defaults.subMenu); 35 var $allSubMenus = $(this).find("." + defaults.subMenu); 36 if ($subMenus.length > 0) { 37 if ($subMenus.css("display") == "none") { 38 $subMenus.slideDown(defaults.speed).siblings("a").addClass(defaults.indicator); 39 if (defaults.singleOpen) { 40 $(this).siblings().find("." + defaults.subMenu).slideUp(defaults.speed) 41 .end().find("a").removeClass(defaults.indicator); 42 } 43 return false; 44 } else { 45 $(this).find("." + defaults.subMenu).delay(defaults.hideDelay).slideUp(defaults.speed); 46 } 47 if ($allSubMenus.siblings("a").hasClass(defaults.indicator)) { 48 $allSubMenus.siblings("a").removeClass(defaults.indicator); 49 } 50 } 51 52 // Menü modülündeki farklı sekme sorunun çözümü 53 var link = $(this).children("a"); 54 var href = link.attr("href"); 55 var target = link.attr("target"); 56 57 if (target === "_blank") { 58 window.open(href, "_blank"); // Yeni sekmede aç 59 } else { 60 window.location.href = href; // Aynı sekmede aç 61 //window.location.href = $(this).children("a").attr("href"); 62 } 63 64 65 }); 66 }, 67 submenuIndicators: function() { 68 if ($(this.element).find("." + defaults.subMenu).length > 0) { 69 $(this.element).find("." + defaults.subMenu).siblings("a").append("<span class='submenu-indicator'>+</span>"); 70 } 71 }, 72 addClickEffect: function() { 73 var ink, d, x, y; 74 $(this.element).find("a").bind("click touchstart", function(e) { 75 $(".ink").remove(); 76 if ($(this).children(".ink").length === 0) { 77 $(this).prepend("<span class='ink'></span>"); 78 } 79 ink = $(this).find(".ink"); 80 ink.removeClass("animate-ink"); 81 if (!ink.height() && !ink.width()) { 82 d = Math.max($(this).outerWidth(), $(this).outerHeight()); 83 ink.css({ 84 height: d, 85 width: d 86 }); 87 } 88 x = e.pageX - $(this).offset().left - ink.width() / 2; 89 y = e.pageY - $(this).offset().top - ink.height() / 2; 90 ink.css({ 91 top: y + 'px', 92 left: x + 'px' 93 }).addClass("animate-ink"); 94 }); 95 } 96 }); 97 $.fn[pluginName] = function(options) { 98 this.each(function() { 99 if (!$.data(this, "plugin_" + pluginName)) { 100 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 101 } 102 }); 103 return this; 104 }; 105})(jQuery, window, document);
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.