1;(function($){ 2 var DEBUG = false; 3 $.mashmenu = function(el, options){ 4 var menu = $(el); 5 var settings = $.extend({ 6 animation : 300 7 },options); 8 9 var _onSlideDown = false; 10 11 methods = { 12 /* lazy load images in a content div. What it actually does is to change data-src property into src property */ 13 loadImages : function(divContent){ 14 $("img",$(divContent)).each(function(){ 15 if($(this).attr("data-src") != ""){ 16 $(this).attr("src",$(this).attr("data-src")); 17 $(this).attr("data-src",""); 18 } 19 }); 20 }, 21 init : function(){ 22 if(mashmenu.ajax_enabled == 0){ 23 // modify HTML of sub content 24 menu.find(".channel-content").each(function(){ 25 $(this).appendTo($(this).parent().parent()); 26 }); 27 } 28 menu.find(".menu-mobile").click(function(){ 29 menu.find(".menu").toggleClass("active"); 30 }); 31 32 $(window).resize(function(){ 33 menu.find(".menu").removeClass("active"); 34 }); 35 36 menu.find(".channel-title").each(function(){ 37 $(this).hover(function(){ 38 methods.displayChannel($(this)); 39 }); 40 }); 41 42 menu.find(".level0").hover(function(){ 43 $(this).addClass("hover"); 44 // if current hovered item is not active 45 if(!_onSlideDown && $(this).find(".sub-content-active").length == 0){ 46 // find current active item 47 var activeSub = $(this).parent().find(".sub-content-active"); 48 if(activeSub.length == 0){ // if no active item 49 var sub = $(this).find(".sub-content"); 50 if(sub.length > 0){ 51 // if has sub content 52 sub.addClass("sub-content-active"); 53 54 if(sub.find(".sub-channel .hover").length == 0){ 55 methods.displayChannel(sub.find(".sub-channel .channel-title:eq(0)")); 56 } 57 } 58 } else { // change active flag 59 var divContent = $(this).find(".sub-content"); 60 divContent.addClass("sub-content-active"); 61 activeSub.removeClass("sub-content-active"); 62 63 if(divContent.find(".sub-channel .hover").length == 0){ 64 methods.displayChannel(divContent.find(".sub-channel .channel-title:eq(0)")); 65 } 66 } 67 } 68 },function(){ 69 $(this).removeClass("hover"); 70 setTimeout($.proxy(function(){ // hide active item if mouse is out of menu 71 if($(this).find(".menu>.hover").length == 0){ 72 sub = $(this).find(".sub-content"); 73 74 sub.removeClass("sub-content-active"); 75 } 76 }, menu),300); 77 }); 78 }, 79 displayChannel : function(channel_title){ 80 var target = "#" + $(channel_title).attr("data-target"); 81 $(channel_title).parent().parent().find(".channel-content").removeClass("active"); 82 83 if($(target).length == 0){ 84 if(mashmenu.ajax_enabled != 0){ 85 // create panel to receive data 86 var channel = $('<div class="channel-content active" id="' + $(channel_title).attr("data-target") + '"><div class="content-inner row"><div class="loading"><!-- --></div></div></div>'); 87 $(channel_title).parent().parent().append(channel); 88 89 methods.getChannelContent(target,$(channel_title).attr("data-object"),$(channel_title).attr("data-id"),$(channel_title).attr('data-post')); 90 } 91 } else { 92 methods.loadImages(target); 93 $(target).addClass("active"); 94 } 95 96 $(channel_title).parent().find(".channel-title").removeClass("hover"); 97 $(channel_title).addClass("hover"); 98 }, 99 getChannelContent : function(channelId, dataType, dataId, postType){ 100 $.ajax({
101 type: 'POST', 102 cache: false, 103 url: mashmenu.ajax_url, 104 data: { "action" : "mashMenu_getChannelContent", "data" : new Array(dataType, dataId,postType) }, 105 error: function(req, status, errorThrown){ 106 if(DEBUG) console.log('Error: '+status+' | '+errorThrown); 107 }, 108 success: function(data, status, req){ 109 $(channelId).find(".content-inner").html(data); 110 } 111 }); 112 } 113 }; 114 115 methods.init(); 116 }; 117 $.fn.mashmenu = function(options){ 118 return new $.mashmenu(this,options); 119 } 120}(jQuery)); 121 122// var _mobile_screen = 480; global variable, defined in HTML 123 124jQuery(document).ready(function($){ 125 var _mashmenu = $(".mashmenu").mashmenu(); 126});
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.