1/** 2* @package Helix Framework 3* @author JoomShaper http://www.joomshaper.com 4* @copyright Copyright (c) 2010 - 2017 JoomShaper 5* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later 6*/; 7(function ($) { 8 $.fn.spmenu = function (options) { 9 var defaults = { 10 startLevel: 0, 11 direction: 'ltr', 12 center: 0, 13 marginLeft: 0, 14 marginTop: 0, 15 width: 200, 16 initOffset: { 17 x: 0, 18 y: 0 19 }, 20 subOffset: { 21 x: 0, 22 y: 0 23 } 24 }; 25 26 var options = $.extend(defaults, options); 27 28 return this.each(function () { 29 30 //First Level 31 32 $(this).find('>li.menu-item.parent').each(function (index) { 33 34 var $this = $(this); 35 var $submenu = $this.find('>.sp-submenu'); 36 var rootLevel = ($this.closest('ul.sp-menu').hasClass('level-' + options.startLevel) ? true : false); //Detect Level Root 37 if (rootLevel) { 38 $submenu.addClass('sub-level'); 39 40 var marginTop = $this.height() + options.marginTop; 41 var marginLeft = options.marginLeft; 42 43 if (options.center) { 44 marginLeft = -($submenu.width() / 2) + ($submenu.closest('.parent').width() / 2); 45 } else { 46 47 var offset = $submenu.offset(); 48 var submenuWidth = offset.left + $submenu.width(); 49 var viewport = $(window).width(); 50 51 if (viewport < submenuWidth) { 52 var restWidth = submenuWidth - viewport; 53 } 54 else if(offset.left < 0){ 55 restWidth = offset.left*(-1); 56 } 57 58 else { 59 var restWidth = 0; 60 } 61 62 marginLeft = marginLeft - restWidth; 63 } 64 65 $submenu.find('>.sp-submenu-wrap').css({ 66 'margin-top': options.initOffset.y, 67 'margin-left': options.initOffset.x 68 }); 69 70 71 if (options.direction == 'rtl') { 72 73 $submenu.css({ 74 'top': marginTop, 75 'right': marginLeft 76 }); 77 78 } else { 79 80 $submenu.css({ 81 'top': marginTop, 82 'left': marginLeft 83 }); 84 } 85 86 } else { 87 $submenu.addClass('sub-level-child'); 88 var marginTop = options.marginTop; 89 var offset = $submenu.offset(); 90 var viweport = $(window).width(); 91 92 var outerWidth = $submenu.outerWidth(true); 93 var parentouterWidth = $submenu.parent().outerWidth(true); 94 95 var submenuWidth = $submenu.width(); 96 97 var parentWidth = $submenu.parent().width(); 98 99 var isVisible = function(){ 100 if( offset.left < 0 ) return false; 101 else if( viweport < (outerWidth+offset.left+submenuWidth) ) return false;
102 else return true; 103 } 104 105 var isMegaMenu = function(){ 106 if( options.width < submenuWidth ) return true; 107 else return false; 108 } 109 110 var isRTL = function(){ 111 if( options.direction=='rtl' ) return true; 112 else return false; 113 } 114 115 var moveMenuPX = function(){ 116 if (options.direction == 'ltr') { 117 if( outerWidth > parentouterWidth ){ 118 if( isVisible() ) return parentouterWidth; 119 else return submenuWidth; 120 } 121 else if( parentouterWidth < outerWidth ) return parentWidth; 122 else if( outerWidth == parentouterWidth ) return outerWidth; 123 else return options.width; 124 } else { 125 126 if( outerWidth > parentouterWidth ){ 127 if( isVisible() ) return submenuWidth; 128 else return parentouterWidth; 129 //return submenuWidth; 130 } 131 else if( parentouterWidth < outerWidth ) return parentWidth; 132 else if( outerWidth == parentouterWidth ) return submenuWidth; 133 else return options.width; 134 } 135 } 136 137 /* 138 // info graphic 139 $submenu.attr('data-width', submenuWidth); 140 $submenu.attr('data-offset', offset.left); 141 $submenu.attr('data-outerwidth', outerWidth); 142 $submenu.attr('data-isvisible', isVisible); 143 $submenu.attr('data-ismegamenu', isMegaMenu); 144 $submenu.attr('data-viewport', viweport); 145 $submenu.attr('data-parentouterwidth', $submenu.parent().outerWidth(true)); 146 */ 147 148 if (options.direction == 'ltr') { 149 150 if( isVisible() ){ 151 marginLeft = moveMenuPX(); 152 } else { 153 marginLeft = -moveMenuPX(); 154 } 155 156 } else { 157 158 if( isVisible() ){ 159 marginLeft = -moveMenuPX(); 160 } else { 161 marginLeft = moveMenuPX(); 162 } 163 } 164 165 166 167 $submenu.find('>.sp-submenu-wrap').css({ 168 'margin-top': options.subOffset.y, 169 'margin-left': options.subOffset.x 170 }); 171 172 if (options.direction == 'rtl') { 173 174 $submenu.css({ 175 'top': 0, 176 'right': 0 177 }); 178 179 $submenu.css({ 180 'top': marginTop, 181 'right': marginLeft 182 }); 183 184 } else { 185 186 $submenu.css({ 187 'top': 0, 188 'left': 0 189 }); 190 191 $submenu.css({ 192 'top': marginTop, 193 'left': marginLeft 194 }); 195 } 196 } 197 198 var $timeer; 199 200 $this.on('mouseenter', function (event) { 201 event.stopImmediatePropagation(); 202 $(this).find('>.sp-submenu').removeClass('open'); 203 $(this).find('>.sp-submenu').addClass('open'); 204 }); 205 206 $this.on('mouseleave', function (event) { 207 var $_this = $(this); 208 $(this).find('>.sp-submenu').removeClass('open'); 209 }); 210 }); 211 }); 212 213 }; 214 215})(jQuery); 216 217 218/** 219* jQuery Mobile Menu 220* Turn unordered list menu into dropdown select menu 221* version 1.0(31-OCT-2011) 222* 223* Built on top of the jQuery library 224* http://jquery.com 225* 226* Documentation 227* http://github.com/mambows/mobilemenu
228*/ 229; 230(function ($) { 231 $.fn.mobileMenu = function (options) { 232 233 var defaults = { 234 defaultText: 'Navigate to...', 235 className: 'select-menu', 236 subMenuClass: 'menu-item', 237 subMenuDash: '-', 238 appendTo: '#sp-mmenu' 239 }, 240 settings = $.extend(defaults, options), 241 el = $(this); 242 mobileMenu = $(settings.appendTo); 243 244 this.each(function () { 245 // ad class to submenu list 246 el.find('ul').addClass(settings.subMenuClass); 247 248 // Create base menu 249 $('<select />', { 250 'class': settings.className 251 }).appendTo(mobileMenu); 252 253 // Create default option 254 $('<option />', { 255 "value": '#', 256 "text": settings.defaultText 257 }).appendTo('.' + settings.className); 258 259 // Create select option from menu 260 el.find('a').each(function () { 261 var $this = $(this), 262 optText = ' ' + $this.find('span.menu-title').text(), 263 optSub = $this.parents('.' + settings.subMenuClass), 264 len = optSub.length, 265 dash; 266 267 // if menu has sub menu 268 if ($this.parents('ul').hasClass(settings.subMenuClass)) { 269 dash = Array(len + 1).join(settings.subMenuDash); 270 optText = dash + optText; 271 } 272 273 // Now build menu and append it 274 $('<option />', { 275 "value": this.href, 276 "html": optText, 277 "selected": (this.href == window.location.href) 278 }).appendTo('.' + settings.className); 279 280 }); // End el.find('a').each 281 282 // Change event on select element 283 $('.' + settings.className).change(function () { 284 var locations = $(this).val(); 285 if (locations !== '#') { 286 window.location.href = $(this).val(); 287 }; 288 }); 289 290 }); // End this.each 291 return this; 292 }; 293})(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.