1var Eventx = { 2 addEvent: function(elem, type, func) { 3 if (document.addEventListener) { 4 elem.addEventListener(type, func, false); 5 } else { 6 elem.attachEvent('on' + type, func); 7 } 8 }, 9 onResizend: function(onResizend) { 10 var actionState = 'normal', 11 taskPtr = null, 12 timeOutTask = function() { 13 taskPtr && clearTimeout(taskPtr); 14 taskPtr = setTimeout(function() { 15 onResizend && onResizend(); 16 actionState = 'normal'; 17 }, 500) 18 }; 19 this.addEvent( 20 window, 'resize', 21 function() { 22 actionState = 'resizing'; 23 timeOutTask(); 24 }); 25 }, 26 onResizestart: function(onResizestart) { 27 var isExecuted = false; 28 this.onResizend(function() { 29 isExecuted = false; 30 }); 31 this.addEvent( 32 window, 'resize', 33 function() { 34 if (!isExecuted) { 35 onResizestart && onResizestart(); 36 isExecuted = true; 37 } 38 }); 39 } 40}; 41/* 42--- 43 44name: Array 45 46description: Contains Array Prototypes like each, contains, and erase. 47 48license: MIT-style license. 49 50requires: Type 51 52provides: Array 53 54... 55*/ 56Array.prototype.every = function(fn, bind) { 57 for (var i = 0, l = this.length >>> 0; i < l; i++) { 58 if ((i in this) && !fn.call(bind, this[i], i, this)) return false; 59 } 60 return true; 61}; 62Array.prototype.filter = function(fn, bind) { 63 var results = []; 64 for (var value, i = 0, l = this.length >>> 0; i < l; i++) 65 if (i in this) { 66 value = this[i]; 67 if (fn.call(bind, value, i, this)) results.push(value); 68 } 69 return results; 70}; 71Array.prototype.indexOf = function(item, from) { 72 var length = this.length >>> 0; 73 for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) { 74 if (this[i] === item) return i; 75 } 76 return -1; 77}; 78Array.prototype.map = function(fn, bind) { 79 var length = this.length >>> 0, 80 results = Array(length); 81 for (var i = 0; i < length; i++) { 82 if (i in this) results[i] = fn.call(bind, this[i], i, this); 83 } 84 return results; 85}; 86Array.prototype.some = function(fn, bind) { 87 for (var i = 0, l = this.length >>> 0; i < l; i++) { 88 if ((i in this) && fn.call(bind, this[i], i, this)) return true; 89 } 90 return false; 91}; /*</!ES5>*/ 92Array.prototype.clean = function() { 93 return this.filter(function(item) { 94 return item != null; 95 }); 96}; 97Array.prototype.invoke = function(methodName) { 98 var args = Array.slice(arguments, 1); 99 return this.map(function(item) { 100 return item[methodName].apply(item, args); 101 }); 102}; 103Array.prototype.associate = function(keys) { 104 var obj = {}, 105 length = Math.min(this.length, keys.length); 106 for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; 107 return obj; 108}; 109Array.prototype.link = function(object) { 110 var result = {}; 111 for (var i = 0, l = this.length; i < l; i++) { 112 for (var key in object) { 113 if (object[key](this[i])) { 114 result[key] = this[i]; 115 delete object[key]; 116 break; 117 } 118 } 119 } 120 return result; 121}; 122Array.prototype.contains = function(item, from) { 123 return this.indexOf(item, from) != -1; 124}; 125Array.prototype.append = function(array) { 126 this.push.apply(this, array); 127 return this; 128}; 129Array.prototype.getLast = function() { 130 return (this.length) ? this[this.length - 1] : null; 131}; 132Array.prototype.getRandom = function() { 133 return (this.length) ? this[Number.random(0, this.length - 1)] : null; 134}; 135Array.prototype.include = function(item) { 136 if (!this.contains(item)) this.push(item); 137 return this; 138}; 139Array.prototype.combine = function(array) { 140 for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); 141 return this; 142}; 143Array.prototype.erase = function(item) { 144 for (var i = this.length; i--;) { 145 if (this[i] === item) this.splice(i, 1); 146 } 147 return this; 148}; 149Array.prototype.empty = function() { 150 this.length = 0; 151 return this; 152}; 153Array.prototype.flatten = function() { 154 var array = []; 155 for (var i = 0, l = this.length; i < l; i++) { 156 var type = typeOf(this[i]); 157 if (type == 'null') continue; 158 array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]); 159 } 160 return array; 161}; 162Array.prototype.pick = function() { 163 for (var i = 0, l = this.length; i < l; i++) { 164 if (this[i] != null) return this[i]; 165 } 166 return null; 167}; 168Array.prototype.hexToRgb = function(array) { 169 if (this.length != 3) return null; 170 var rgb = this.map(function(value) { 171 if (value.length == 1) value += value; 172 return value.toInt(16); 173 }); 174 return (array) ? rgb : 'rgb(' + rgb + ')'; 175}; 176Array.prototype.rgbToHex = function(array) { 177 if (this.length < 3) return null; 178 if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; 179 var hex = []; 180 for (var i = 0; i < 3; i++) { 181 var bit = (this[i] - 0).toString(16); 182 hex.push((bit.length == 1) ? '0' + bit : bit); 183 } 184 return (array) ? hex : '#' + hex.join(''); 185}; 186if (undefined == Function.prototype.bind) { 187 Function.prototype.bind = function(that) { 188 var self = this, 189 args = arguments.length > 1 ? Array.slice(arguments, 1) : null, 190 F = function() {}; 191 var bound = function() { 192 var context = that, 193 length = arguments.length; 194 if (this instanceof bound) { 195 F.prototype = self.prototype; 196 context = new F; 197 } 198 var result = (!args && !length) ? self.call(context) : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments); 199 return context == that ? result : context; 200 }; 201 return bound; 202 } 203}(function($) { 204 $.fn.getLast = function(n) {
205 return $(this).children().last(); 206 }; 207 $.fn.getPrevious = $.fn.prev; 208 $.fn.getFirst = function(n) { 209 return $(this).children().first(); 210 }; 211 $.fn.getNext = $.fn.next; 212 $.fn.fireEvents = function(n) { 213 $(this).each(function(i, d) { 214 $(d).trigger(n); 215 }); 216 }; 217 MenuMatic = window.MenuMatic = function(options) { 218 this.options = { 219 id: 's5_nav', 220 //the id of the main menu (ul or ol) 221 subMenusContainerId: 'subMenusContainer', 222 //id of the container div that will be generated to hold the submenus 223 tabletWidth: 800, 224 //subMenu behavior 225 effect: 'slide & fade', 226 // 'slide', 'fade', 'slide & fade', or null 227 duration: 600, 228 //duration of the effect in milliseconds 229 physics: 'easeOutQuad', 230 //how the effect behaves 231 hideDelay: 1000, 232 //in milliseconds, how long you have after moving your mouse off of the submenus before they dissapear 233 displayDelay: 0, 234 //in milliseconds, how long you have after moving your mouse on the submenus before they appear 235 //layout 236 stretchMainMenu: false, 237 //stretch main menu btn widths to fit within the width {set in the css} of the parent UL or OL 238 matchWidthMode: false, 239 //initial submenus match their parent button's width 240 orientation: 'horizontal', 241 //horizontal or vertical 242 direction: { 243 x: 'right', 244 y: 'down' 245 }, 246 //for submenus ( relative to the parent button )left or right, up or down 247 olddirection: { 248 x: 'right', 249 y: 'down' 250 }, 251 tweakInitial: { 252 x: 0, 253 y: 0 254 }, 255 //if you need to tweak the placement of the initial submenus 256 tweakSubsequent: { 257 x: 0, 258 y: 0 259 }, 260 //if you need to tweak the placement of the subsequent submenus 261 center: false, 262 // will attempt to center main nav element 263 //dynamic style 264 opacity: 95, 265 //of the submenus 266 mmbFocusedClassName: null, 267 //main menu button classname, used for morphing to focused state 268 mmbClassName: null, 269 //main menu button classname, used for morphing back to original state 270 killDivider: null, 271 fullWidth: null, 272 fixHasLayoutBug: false, 273 onHideAllSubMenusNow_begin: (function() {}), 274 onHideAllSubMenusNow_complete: (function() {}), 275 onInit_begin: (function() {}), 276 onInit_complete: (function() {}) 277 }, this.hideAllMenusTimeout = null, this.S5DisplayMenusTimeout = null, this.allSubMenus = [], this.subMenuZindex = 1; 278 this.initialize(options); 279 this.stretch(); 280 this.killDivider(); 281 this.center(); 282 } 283 MenuMatic.prototype.initialize = function(options) { 284 //if(Browser.Engine.webkit419){return;} 285 //this.setOptions(options); 286 // var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); 287 this.options = $.extend(this.options, options); 288 this.options.olddirection.x = this.options.direction.x; 289 this.options.olddirection.y = this.options.direction.y; 290 /* if (this.addEvent) for (var option in options){ 291 if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; 292 this.bind(option, options[option]); 293 delete options[option]; 294 }*/ 295 //console.log(this.options); 296 //this.options.onInit_begin(); 297 if (this.options.opacity > 99) { 298 this.options.opacity = 99.9; 299 } 300 this.options.opacity = this.options.opacity / 100; 301 //initialize directions 302 this.options.direction.x = this.options.direction.x.toLowerCase(); 303 this.options.direction.y = this.options.direction.y.toLowerCase(); 304 if (this.options.direction.x === 'right') { 305 this.options.direction.xInverse = 'left'; 306 } else if (this.options.direction.x === 'left') { 307 this.options.direction.xInverse = 'right'; 308 } 309 if (this.options.direction.y === 'up') { 310 this.options.direction.yInverse = 'down'; 311 } else if (this.options.direction.y === 'down') { 312 this.options.direction.yInverse = 'up'; 313 } 314 var links = $('#' + this.options.id + ' li, span.grouped_sub_parent_item'); // $('#'+this.options.id).getElements('a'); - silviu 315 //silviu create an array to keep the child LI index 316 var LiParent = new Array(); 317 $(links).each((function(index, item) { 318 //store parent links & child menu info 319 $(item).data('parentLinks', $(item). /*getParent().*/ parents('li')); 320 if ($(item).children('ul') && $(item).children('ul').length >= 1) { 321 var child_Menu = $(item).children('ul'); 322 LiParent[index] = ""; 323 } else { 324 var child_Menu = null; 325 } 326 $(item).data('childMenu', child_Menu); 327 if (child_Menu) child_Menu.data('parentMenu', $(item)); //westcowboy 328 //determine submenu type 329 theSubMenuType = 'subsequent'; 330 if ($($(item).parents('ul') || $(item).parents('ol')).attr('id') === this.options.id) { 331 theSubMenuType = 'initial'; 332 } 333 $(item).data('subMenuType', theSubMenuType); 334 //add classes to parents 335 if (theSubMenuType === 'initial' && $($(item).children('ul') || $(item).children('ol'))) { 336 $(item).addClass('mainMenuParentBtn'); 337 } else if ($($(item).children('ul') || $(item).children('ol'))) { 338 $(item).addClass('subMenuParentBtn'); 339 } 340 }).bind(this)); 341 //rip the submenus apart into separate divs inside of subMenusContainer
342 var subMenusContainer = $('<div></div>').attr('id', this.options.subMenusContainerId).appendTo($('body')); 343 var existing_index = new Array(); 344 $('#' + this.options.id + ' ul').each(function(index, item) { 345 //remove the ul elements inside a moduletable div, the module content which can contain ul 346 if ($(item).parents('div[class*=moduletable]').length == 0) { 347 //new index found, add it to existing index and create the div content 348 if ($(item).parents('span.grouped_sub_parent_item').length > 0) { 349 var parent_li_index = links.index($(item).parents('span.grouped_sub_parent_item')); 350 } else { 351 var parent_li_index = links.index($(item).parent('li')); 352 } 353 if (false == existing_index.contains(parent_li_index)) { 354 existing_index.include(parent_li_index); 355 if ($(item).parent().data('subMenuType') == 'initial') { 356 var subMenusContainersmOW = $('<div></div>').addClass('s5_sub_wrap').attr('id', 'ul_child_' + parent_li_index).appendTo(subMenusContainer); 357 } else { 358 var subMenusContainersmOW = $('<div></div>').addClass('s5_sub_wrap_lower').attr('id', 'ul_child_' + parent_li_index).appendTo(subMenusContainer); 359 } 360 var subMenusContainerUl = $('<ul></ul>').appendTo(subMenusContainersmOW); 361 var subMenusContainerLI = $('<li></li>').attr('id', 'li_child_' + parent_li_index).appendTo(subMenusContainerUl).append(item); 362 //subMenusContainerUl.width(); 363 //var subMenusContainers = new Element('div',{'class': 'smOW', 'id': 'ul_child_'+parent_li_index}).inject(subMenusContainer).grab(item); 364 } else { 365 //found existing index, so just add extra ul to the existing content 366 if ($('#li_child_' + parent_li_index)) { 367 $('#li_child_' + parent_li_index).append(item); 368 } 369 } 370 } 371 }); 372 373 // temporarily handle flexmenu with sub-module-content on j4 374 var sub_wrapers = $('div.s5_sub_wrap_lower'); 375 var sub_wraps = $('div.s5_sub_wrap'); 376 if (sub_wrapers && sub_wrapers.length > 0){ 377 var sub_menu_modules = sub_wrapers.find('ul.mod-menu'); 378 if (sub_menu_modules && sub_menu_modules.length > 0) { 379 $.each(sub_wraps, function (idx, el) { 380 var $el = $(el); 381 if ($el.find('div.S5_menu_module_parent_group') && idx === sub_wraps.length - 1) { 382 $el.addClass('s5-j4'); 383 $.each($el.find('li').find('ul'), function (idx1, el1) { 384 var $el1 = $(el1); 385 if ($el1 && $el1.length > 0) { 386 var div_wrap = $el1.find('div.S5_menu_module_group').find('div').first(); 387 var div_content = div_wrap.find('div'); 388 $(sub_menu_modules[idx1]).appendTo(div_content); 389 } 390 }) 391 } 392 }) 393 } 394 } 395 396 //set tabindex to -1 so tabbing through links in page does not go through hidden links in submenus container, since arrow keys can be used to navigate through submenus 397 $('a', subMenusContainer).attr('tabindex', '-1'); 398 links.each((function(index, item) { 399 //item=$(item); 400 //only apply to links with subMenus 401 if (!$(item).data('childMenu')) { 402 return; 403 } 404 //update childMenu pointer to look at smOW DIVs 405 $(item).data('childMenu', $('#ul_child_' + index)); //$(item).data('childMenu').parents('div') 406 $('#ul_child_' + index).data('parentMenu', $(item)); //westcowboy 407 //add to allSubMenus array 408 this.allSubMenus.include($(item).data('childMenu')); 409 //store parentSubMenus 410 //$(item).data('parentSubMenus',$($(item).data('parentLinks')).data('childMenu')); 411 var tmp = []; 412 $(item).data('parentLinks').each(function(index, item2) { 413 // fix for grouped child menus, the else block actually gets the parent sub menu of the current descdent grouped submenu 414 if ($(item2).data('childMenu')) tmp.include($(item2).data('childMenu')[0]); 415 else { 416 tmp.include($(item2).parentsUntil('li').parentsUntil('div').parent()[0]); 417 } 418 }); 419 $(item).data('parentSubMenus', $(tmp)); 420 delete tmp; 421 //$(item).data('parentSubMenus',$(item).data('parentLinks').data('childMenu')); 422 //console.log($($(item).data('parentLinks')).data('childMenu')); 423 //now create the MenuMaticSubMenu class instances 424 //if($(item).data('parentLinks').length>0) { 425 var aSubMenu = new MenuMaticSubMenu(); 426 jQuery(item).data('subMenuInstance', aSubMenu); 427 aSubMenu.initialize(this.options, this, $(item), index); 428 ///} 429 }).bind(this)); 430 //attach event handlers to non-parent main menu buttons 431 var nonParentBtns = $('#' + this.options.id + ' li').filter(function(index, item) { 432 return !$(item).data('childMenu'); 433 }); // silviu removed a 434 //var nonParentBtns1 = $$('div.moduletable'); 435 //var nonParentBtns = nonParentBtns0.concat(nonParentBtns1); 436 //console.log(nonParentBtns); 437 nonParentBtns.each((function(index, item) { 438 $(item).on('mouseenter', (function(e) { 439 e.preventDefault(); 440 this.hideAllSubMenusNow(); 441 if (this.options.mmbClassName && this.options.mmbFocusedClassName) { 442 if (!$(item).data('btnMorph')) $(item).switchClass(this.options.mmbFocusedClassName, '', this.options.duration / 2, this.options.physics); 443 else $(item).data('btnMorph'); 444 } 445 }).bind(this)); 446 $(item).on('focus', (function(e) { 447 e.preventDefault(); 448 this.hideAllSubMenusNow(); 449 if (this.options.mmbClassName && this.options.mmbFocusedClassName) { 450 if (!$(item).data('btnMorph')) $(item).switchClass(this.options.mmbFocusedClassName, '', this.options.duration / 2, this.options.physics); 451 else $(item).data('btnMorph'); 452 } 453 }).bind(this)); 454 $(item).on('mouseleave', (function(e) { 455 e.preventDefault(); 456 if (this.options.mmbClassName && this.options.mmbFocusedClassName) { 457 if (!$(item).data('btnMorph')) $(item).switchClass(this.options.mmbClassName, '', this.options.duration / 2, this.options.physics); 458 else $(item).data('btnMorph'); 459 } 460 }).bind(this)); 461 $(item).on('blur', (function(e) { 462 e.preventDefault(); 463 if (this.options.mmbClassName && this.options.mmbFocusedClassName) { 464 if (!$(item).data('btnMorph')) $(item).switchClass(this.options.mmbClassName, '', this.options.duration / 2, this.options.physics); 465 else $(item).data('btnMorph'); 466 } 467 }).bind(this)); 468 $(item).on('keydown', (function(e) { 469 var event = new Event(e); 470 if (e.key === 'up' || e.key === 'down' || e.key === 'left' || e.key === 'right') { 471 e.stop(); 472 } 473 if (e.key === 'left' && this.options.orientation === 'horizontal' || e.key === 'up' && this.options.orientation === 'vertical') { 474 if ($(item).parents('li').getPrevious('li')) { 475 $(item).parents('li').getPrevious('li').getFirst('a').focus(); 476 } else { 477 $(item).parents('li').parent().getLast('li').getFirst('a').focus(); 478 } 479 } else if (e.key === 'right' && this.options.orientation === 'horizontal' || e.key === 'down' && this.options.orientation === 'vertical') { 480 if ($(item).parents('li').getNext('li')) { 481 $(item).parents('li').getNext('li').getFirst('a').focus(); 482 } else { 483 $(item).parents('li').parent().getFirst('li').getFirst('a').focus(); 484 } 485 } 486 }).bind(this)); 487 }).bind(this)); 488 //showMessage(screen.width); 489 this.onResizeWindow(); 490 Eventx.onResizestart(this.hideAllSubMenusNow.bind(this)); 491 Eventx.onResizend(this.onResizeWindow.bind(this)); 492 } 493 MenuMatic.prototype.getWidth = function() { 494 if (this.options.fullWidth && typeof this.options.fullWidth === "function") { 495 return this.options.fullWidth(); 496 } 497 return "auto"; 498 } 499 /** 500 * For tablet devices with smaller widths, 501 * just swap the event handlers while window width under or above the WIDTH 502 */ 503 MenuMatic.prototype.onResizeWindow = function() { 504 /*function showMessage(message, title, callback, buttonName){ 505 title = title || ""; 506 buttonName = buttonName || 'OK'; 507 if(navigator.notification){ 508 navigator.notification.alert( 509 message, // message 510 callback, // callback 511 title, // title 512 buttonName // buttonName 513 ); 514 }else{ 515 alert(message); 516 if(callback) 517 callback(); 518 } 519 } 520 showMessage(!!('ontouchstart' in window));*/ 521 var thisp = this; 522 //console.log(this.options.tabletWidth); 523 if ($(window).width() >= this.options.tabletWidth) { 524 var needTablet = window.needTablet = 0; 525 if (window.s5menuTablet) var needRevert = window.needRevert = 1; 526 else 527 var needRevert = window.needRevert = 0; 528 } else if ($(window).width() < this.options.tabletWidth && !!(('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) /* is tablet*/ ) { 529 var needRevert = window.needRevert = 0; 530 if (window.s5menuTablet) var needTablet = window.needTablet = 0; 531 else 532 var needTablet = window.needTablet = 1; 533 } 534 //console.log(needRevert,needTablet); 535 if (needTablet || needRevert) { 536 var links = jQuery('.mainMenuParentBtn,.subMenuParentBtn,.mainParentBtn,.subParentBtn'); 537 links.each(function(i, d) { 538 if (!$(d).data('childMenu')) { 539 if (needTablet) { 540 $(d).off('mouseenter').on('mouseenter', function() { 541 jQuery('.mainParentBtnFocused').removeClass('mainParentBtnFocused'); 542 jQuery(this).addClass('mainParentBtnFocused'); 543 }); 544 $(d).off('mouseleave').on('mouseleave', function() { 545 jQuery(this).removeClass('mainParentBtnFocused'); 546 }); 547 } 548 if (needRevert) { 549 $(d).off('mouseenter').on('mouseenter', thisp.hideAllSubMenusNow.bind(thisp)); 550 } 551 return; 552 } 553 var that = $(d).data('subMenuInstance'); 554 if (needTablet) { 555 //console.log(needTablet); 556 window.s5menuTablet = 1; 557 var mouseEnterH = function(e) { 558 e.preventDefault(); 559 jQuery(this).css({ 560 background: '' 561 }); 562 if (that.subMenuType == 'initial') { 563 //jQuery('.mainMenuParentBtnFocused').removeClass('mainMenuParentBtnFocused'); 564 jQuery(this).addClass('mainMenuParentBtnFocused'); 565 } else { 566 //jQuery('.subMenuParentBtnFocused').removeClass('subMenuParentBtnFocused'); 567 jQuery(this).addClass('subMenuParentBtn').addClass('subMenuParentBtnFocused'); 568 //console.log('enter'); 569 } 570 if (that.subMenuType === 'initial' && that.options.mmbClassName && that.options.mmbFocusedClassName) { 571 if ($(this).data('btnMorph')) $(this).data('btnMorph'); 572 else $(this).switchClass(that.options.mmbFocusedClassName, '', that.options.duration / 2, that.options.physics); 573 } 574 }; 575 var mouseLeaveH = function(e) { 576 if (!$(this).data('menuOpened')) { 577 if (that.subMenuType == 'initial') jQuery(this).removeClass('mainMenuParentBtnFocused').removeClass('mainMenuParentBtnTablet'); 578 else jQuery(this).removeClass('subMenuParentBtnFocused'); 579 } 580 return false;
581 } 582 var clickH = function(e) { 583 //console.log(e.target, e.target.hasAttribute('onclick') && e.target.getAttribute('onclick').indexOf('javascript:;')); 584 if (e.target.nodeName == 'SPAN' && e.target.hasAttribute('onclick') && e.target.getAttribute('onclick').indexOf('javascript:;') == -1) { 585 e.target.click(); 586 return false; 587 } 588 if (that.subMenuType == 'initial') jQuery(this).removeClass('mainMenuParentBtnTablet'); 589 else jQuery(this).find('.S5_submenu_item').removeClass('S5_submenu_itemTablet'); 590 if ($(this).data('menuOpened')) { 591 that.hideSubMenu(true); 592 var tmp = $(this).data('childMenu').find('li').filter(function(i, cli) { 593 return $(cli).data('childMenu') && $(cli).data('menuOpened'); 594 }); 595 tmp.each(function(i, cli) { 596 $(cli).data('subMenuInstance').hideSubMenu(); 597 var tmp2 = $(cli).data('childMenu').find('li').filter(function(i, cli2) { 598 return $(cli2).data('childMenu') && $(cli2).data('menuOpened'); 599 }); 600 tmp2.each(function(i, cli3) { 601 $(cli3).data('subMenuInstance').hideSubMenu(); 602 }); 603 }); 604 $(this).data('menuOpened', false); 605 if (that.subMenuType == 'initial') { 606 jQuery(this).removeClass('mainMenuParentBtnFocused').addClass('mainMenuParentBtnTablet'); 607 } else { 608 jQuery(this).find('.S5_submenu_item'). /*removeClass('S5_submenu_item').*/ 609 addClass('S5_submenu_itemTablet'); 610 } 611 return false; 612 } 613 $(this).data('menuOpened', true); 614 e.preventDefault(); 615 that.cancellHideAllSubMenus(); 616 that.hideOtherSubMenus(); 617 //if(that.options.opacity == that.btn.parents('ul').getStyle('opacity') || that.btn.parents('ul').getStyle('opacity') == 1){ 618 setTimeout(function() { 619 that.showSubMenu(); 620 }, 10); 621 //} 622 if (that.subMenuType === 'initial' && that.options.mmbClassName && that.options.mmbFocusedClassName) { 623 if ($(this).data('btnMorph')) $(this).data('btnMorph'); 624 else $(this).switchClass(that.options.mmbFocusedClassName, '', that.options.duration / 2, that.options.physics); 625 } 626 }; 627 } 628 if (needRevert) { 629 window.s5menuTablet = 0; 630 var mouseEnterH = $(d).data('mouseenterH'); 631 var mouseLeaveH = $(d).data('mouseleaveH'); 632 var clickH = function(e) { 633 e.target.click(); 634 } 635 } 636 $(d).off('mouseenter').on('mouseenter', mouseEnterH).off('mouseleave').on('mouseleave', mouseLeaveH).off('click').on('click', clickH); 637 }); 638 jQuery('li[id*=li_child_] ul').each(function(i, d) { 639 var pmenu = $(d).data('parentMenu'); 640 if (pmenu) { 641 var that = pmenu.data('subMenuInstance'); 642 if (needTablet || needRevert) { 643 if (needTablet) { 644 var mouseEnterH = function() { 645 if (that.subMenuType == 'initial') pmenu.addClass('mainMenuParentBtnFocused'); 646 else pmenu.addClass('subMenuParentBtnFocused'); 647 }; 648 } 649 if (needRevert) { 650 var mouseEnterH = pmenu.data('mouseenterH'); 651 } 652 $(d).on('mouseenter', mouseEnterH); 653 } 654 } 655 $(d).children('li').each(function(i, dd) { 656 //return false;
657 if ($(dd).data('childMenu')) { 658 var that = $(dd).data('subMenuInstance'); 659 if (needTablet || needRevert) { 660 if (needTablet) { 661 var mouseLeaveH = function() { 662 if ($(dd).data('menuOpened') == false) { 663 if (that.subMenuType == 'initial') $(this).removeClass('mainMenuParentBtnFocused'); 664 else $(this).removeClass('subMenuParentBtnFocused'); 665 } 666 }; 667 var mouseEnterH = function() { 668 //console.log('enter'); 669 if (that.subMenuType == 'initial') $(this).addClass('mainMenuParentBtnFocused'); 670 else $(this).addClass('subMenuParentBtnFocused').find('.S5_submenu_itemTablet').removeClass('S5_submenu_itemTablet'); 671 }; 672 } 673 if (needRevert) { 674 var mouseLeaveH = $(dd).data('mouseleaveH'); 675 var mouseEnterH = $(dd).data('mouseenterH'); 676 //console.log(mouseEnterH); 677 } 678 $(dd).off('mouseleave').on('mouseleave', mouseLeaveH).off('mouseenter').on('mouseenter', mouseEnterH); 679 } 680 } else { 681 //if(needTablet)$(dd).off('mouseleave').off('mouseenter'); 682 //if(needRevert){ 683 var mouseLeaveH = $(dd).data('mouseleaveH'); 684 var mouseEnterH = $(dd).data('mouseenterH'); 685 //console.log(dd); 686 //console.log(mouseEnterH); 687 if (needRevert) { 688 $(dd).off('mouseleave').on('mouseleave', mouseLeaveH).off('mouseenter').on('mouseenter', mouseEnterH); 689 } 690 if (needTablet) { 691 // console.log(mouseEnterH); 692 $(dd).off('mouseleave').off('mouseenter').on('click', mouseEnterH); 693 } 694 //} 695 } 696 }); 697 }); 698 } 699 }; 700 MenuMatic.prototype.center = function() { 701 if (!this.options.center) { 702 return; 703 } 704 $('#' + this.options.id).css({ 705 'left': '50%', 706 'marginLeft': -($('#' + this.options.id).width() / 2) 707 }); 708 }; 709 MenuMatic.prototype.stretch = function() { 710 //stretch main menu btn widths to fit within the width of the parent UL or OL 711 if (this.options.stretchMainMenu && this.options.orientation === 'horizontal') { 712 var targetWidth = parseFloat($('#' + this.options.id).width()); 713 var totalBtnWidth = 0; 714 var mainBtns = $('#' + this.options.id + ' li'); // silviu removed a 715 mainBtns.css({ 716 'paddingLeft': 0, 717 'paddingRight': 0 718 }); 719 mainBtns.each((function(index, item) { 720 totalBtnWidth += $(item).width(); 721 }).bind(this)); 722 if (targetWidth < totalBtnWidth) { 723 return; 724 } 725 var increment = (targetWidth - totalBtnWidth) / mainBtns.length; 726 mainBtns.each((function(index, item) { 727 $(item).css('width', $(item).width() + increment); 728 }).bind(this)); 729 mainBtns.getLast().css('width', mainBtns.getLast().width() - 1); 730 } 731 }; 732 MenuMatic.prototype.killDivider = function() { 733 if (this.options.killDivider && this.options.killDivider.toLowerCase() === 'first') { 734 $($('#' + this.options.id + ' li')[0]).css({ 735 'background': 'none' 736 }); 737 } else if (this.options.killDivider && this.options.killDivider.toLowerCase() === 'last') { 738 $($('#' + this.options.id + ' li').getLast()).css({ 739 'background': 'none' 740 }); 741 } 742 }; 743 MenuMatic.prototype.hideAllSubMenusNow = function() { 744 //this.options.onHideAllSubMenusNow_begin(); 745 clearTimeout(this.hideAllMenusTimeout); 746 $(this.allSubMenus).fireEvents('hidex'); 747 //this.options.onHideAllSubMenusNow_complete(); 748 }; 749 var MenuMaticSubMenu = function() { 750 this.options = { 751 onSubMenuInit_begin: (function(subMenuClass) {}), 752 onSubMenuInit_complete: (function(subMenuClass) {}), 753 onMatchWidth_begin: (function(subMenuClass) {}), 754 onMatchWidth_complete: (function(subMenuClass) {}), 755 onHideSubMenu_begin: (function(subMenuClass) {}), 756 onHideSubMenu_complete: (function(subMenuClass) {}), 757 onHideOtherSubMenus_begin: (function(subMenuClass) {}), 758 onHideOtherSubMenus_complete: (function(subMenuClass) {}), 759 onHideAllSubMenus_begin: (function(subMenuClass) {}), 760 onHideAllSubMenus_complete: (function(subMenuClass) {}), 761 onPositionSubMenu_begin: (function(subMenuClass) {}), 762 onPositionSubMenu_complete: (function(subMenuClass) {}), 763 onShowSubMenu_begin: (function(subMenuClass) {}), 764 onShowSubMenu_complete: (function(subMenuClass) {}) 765 }; 766 this.root = null; 767 this.btn = null;; 768 this.hidden = true; 769 this.myEffect = null; 770 } 771 MenuMaticSubMenu.prototype.matchWidth = function() { 772 if (this.widthMatched || !this.options.matchWidthMode || this.subMenuType === 'subsequent') { 773 // console.log('ret'); 774 return; 775 } 776 //this.options.onMatchWidth_begin(this); 777 if (this.btn.is('li') == false) var bw = this.btn.parentsUntil('li').eq(0).outerWidth(); 778 else 779 var bw = this.btn.outerWidth(); 780 var parentWidth = bw; 781 $('li', $(this.childMenu)).each((function(index, item) { // silviu removed a 782 var borderWidth = parseFloat($(this.childMenu).getFirst().getStyle('borderLeftWidth')) + parseFloat($(this.childMenu).getFirst().getStyle('borderRightWidth')); 783 var paddingWidth = parseFloat($(item).getStyle('paddingLeft')) + parseFloat($(item).getStyle('paddingRight')); 784 var offset = borderWidth + paddingWidth; 785 if (parentWidth > $(item).width()) { 786 $(item).css('width', parentWidth - offset + 1); 787 $(item).css('margin-right', -borderWidth); 788 } 789 }).bind(this)); 790 this.width = this.childMenu.getFirst().width() + 1; 791 this.widthMatched = true; 792 //this.options.onMatchWidth_complete(this); 793 }; 794 MenuMaticSubMenu.prototype.hideSubMenu = function(keepClass) { 795 if (this.childMenu.data('status') === 'closed') { 796 return; 797 } 798 //this.options.onHideSubMenu_begin(this); 799 if (keepClass == undefined) { 800 if (this.subMenuType == 'initial') { 801 if (this.options.mmbClassName && this.options.mmbFocusedClassName) { 802 if ($(this.btn).data('btnMorph')) $(this.btn).data('btnMorph'); 803 else this.btn.switchClass(this.options.mmbClassName, '', this.options.duration, this.options.physics, (function() { 804 $(this.btn).removeClass('mainMenuParentBtnFocused'); 805 $(this.btn).addClass('mainMenuParentBtn'); 806 }).bind(this)); 807 } else { 808 $(this.btn).removeClass('mainMenuParentBtnFocused'); 809 $(this.btn).addClass('mainMenuParentBtn'); 810 } 811 } else { 812 $(this.btn).removeClass('subMenuParentBtnFocused'); 813 $(this.btn).addClass('subMenuParentBtn'); 814 } 815 } 816 if (this.options.effect && this.options.effect.toLowerCase() === 'slide') { 817 if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal' && this.options.direction.y === 'down') { 818 $(this.childMenu).getFirst().animate({ 819 'marginTop': -this.height 820 }, { 821 'duration': this.options.duration, 822 'easing': this.options.physics, 823 'queue': false, 824 'complete': (function() { 825 this.childMenu.css({ 826 left: 0, 827 display: 'none', 828 'zIndex': -100 829 }); 830 }).bind(this) 831 }); 832 } else if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal' && this.options.direction.y === 'up') { 833 $(this.childMenu).getFirst().animate({ 834 'marginTop': this.height 835 }, { 836 'duration': this.options.duration, 837 'easing': this.options.physics, 838 'queue': false, 839 'complete': (function() { 840 this.childMenu.css({ 841 left: 0, 842 display: 'none', 843 'zIndex': -100 844 }); 845 }).bind(this) 846 }); 847 } else if (this.options.direction.x === 'right') { 848 $(this.childMenu).getFirst().animate({ 849 'marginLeft': -this.width 850 }, { 851 'duration': this.options.duration, 852 'easing': this.options.physics, 853 'queue': false, 854 'complete': (function() { 855 this.childMenu.css({ 856 left: 0, 857 display: 'none', 858 'zIndex': -100 859 }); 860 }).bind(this) 861 }); 862 } else if (this.options.direction.x === 'left') { 863 $(this.childMenu).getFirst().animate({ 864 'marginLeft': this.width 865 }, { 866 'duration': this.options.duration, 867 'easing': this.options.physics, 868 'queue': false, 869 'complete': (function() { 870 this.childMenu.css({ 871 left: 0, 872 display: 'none', 873 'zIndex': -100 874 }); 875 }).bind(this) 876 }); 877 } 878 } else if (this.options.effect == 'fade') { 879 $(this.childMenu).getFirst().animate({ 880 'opacity': 0 881 }, { 882 'duration': this.options.duration, 883 'easing': this.options.physics, 884 'queue': false, 885 'complete': (function() { 886 this.childMenu.css({ 887 left: 0, 888 display: 'none', 889 'zIndex': -100 890 }); 891 }).bind(this) 892 }); 893 } else if (this.options.effect == 'slide & fade') { 894 //console.log(this.childMenu.css('display')); 895 if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal' && this.options.direction.y === 'down') { 896 $(this.childMenu).getFirst().animate({ 897 'marginTop': -this.height, 898 opacity: 0 899 }, { 900 'duration': this.options.duration, 901 'easing': this.options.physics, 902 'queue': false, 903 'complete': (function() { 904 this.childMenu.css({ 905 left: 0, 906 display: 'none', 907 'zIndex': -100 908 }); 909 }).bind(this) 910 }); 911 } else if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal' && this.options.direction.y === 'up') { 912 $(this.childMenu).getFirst().animate({ 913 'marginTop': this.height, 914 opacity: 0 915 }, { 916 'duration': this.options.duration, 917 'easing': this.options.physics, 918 'queue': false, 919 'complete': (function() { 920 this.childMenu.css({ 921 left: 0, 922 display: 'none', 923 'zIndex': -100 924 }); 925 }).bind(this) 926 }); 927 } else if (this.options.direction.x === 'right') { 928 $(this.childMenu).getFirst().animate({ 929 'marginLeft': -this.width, 930 opacity: 0 931 }, { 932 'duration': this.options.duration, 933 'easing': this.options.physics, 934 'queue': false, 935 'complete': (function() { 936 this.childMenu.css({ 937 left: 0, 938 display: 'none', 939 'zIndex': -100 940 }); 941 }).bind(this) 942 }); 943 } else if (this.options.direction.x === 'left') { 944 $(this.childMenu).getFirst().animate({ 945 'marginLeft': this.width, 946 opacity: 0 947 }, { 948 'duration': this.options.duration, 949 'easing': this.options.physics, 950 'queue': false, 951 'complete': (function() { 952 this.childMenu.css({ 953 left: 0, 954 display: 'none', 955 'zIndex': -100 956 }); 957 }).bind(this) 958 }); 959 } 960 } else {
961 this.childMenu[0].style.left = "0px"; 962 this.childMenu[0].style.visiblity = "hidden"; 963 this.childMenu.css('zIndex', -100); 964 } 965 this.childMenu.data('status', 'closed'); 966 //console.log(this.childMenu.css('display')); 967 //this.options.onHideSubMenu_complete(this); 968 }; 969 MenuMaticSubMenu.prototype.hideOtherSubMenus = function() { 970 //this.options.onHideOtherSubMenus_begin(this); 971 //set up otherSubMenus element collection 972 if (!this.btn.data('otherSubMenus')) { 973 this.btn.data('otherSubMenus', $(this.root.allSubMenus.filter((function(item) { 974 return this.btn.data('parentSubMenus').index(item) == -1 && item != this.childMenu; 975 }).bind(this)))); 976 } 977 this.parentSubMenus.fireEvents('show'); 978 //console.log(this.btn.data('otherSubMenus').size()); 979 this.btn.data('otherSubMenus').fireEvents('hidex'); 980 //console.log(this.btn.data('otherSubMenus')); 981 this.btn.data('otherSubMenus').each(function(i, d) { // westcowboy 982 $(d).data('parentMenu').data('menuOpened', false); 983 }); 984 //this.options.onHideOtherSubMenus_complete(this); 985 }; 986 MenuMaticSubMenu.prototype.hideAllSubMenus = function(btn) { 987 //this.options.onHideAllSubMenus_begin(this); 988 clearTimeout(this.root.hideAllMenusTimeout); 989 this.root.hideAllMenusTimeout = setTimeout((function() { 990 clearTimeout(this.root.hideAllMenusTimeout); 991 if (btn) { 992 btn.data('childMenu').fireEvents('hidex'); 993 } else { 994 $(this.root.allSubMenus).fireEvents('hidex'); 995 } 996 }).bind(this), this.options.hideDelay); 997 //this.options.onHideAllSubMenus_complete(this); 998 }; 999 MenuMaticSubMenu.prototype.cancellHideAllSubMenus = function() { 1000 //this.childMenu.getFirst().stop(); 1001 //$(this.root.allSubMenus).stop(); 1002 //console.log($(this.root.allSubMenus.filter((function(item){ return this.btn.data('parentSubMenus').index(item)==-1 && item != this.childMenu;}).bind(this)))); 1003 clearTimeout(this.root.hideAllMenusTimeout); 1004 //$(this.root.allSubMenus.filter((function(item){ return this.btn.data('parentSubMenus').index(item)==-1 && item != this.childMenu;}).bind(this))).each(function(i,d){$(d).stop();}); 1005 this.options.direction.x = this.options.olddirection.x; 1006 }; 1007 MenuMaticSubMenu.prototype.showSubMenu = function() { 1008 //console.log('it is now '+this.options.direction.x); 1009 S5DisplayMenusTimeout = setTimeout((function() { 1010 this.S5showSubMenu(); 1011 }).bind(this), this.options.displayDelay); 1012 }; 1013 MenuMaticSubMenu.prototype.S5showSubMenu = function(now) { 1014 if (this.childMenu.data('status') === 'open') { 1015 return; 1016 } 1017 //this.options.onShowSubMenu_begin(this); 1018 if (this.subMenuType == 'initial') { 1019 $(this.btn).removeClass('mainMenuParentBtn'); 1020 $(this.btn).addClass('mainMenuParentBtnFocused'); 1021 } else { 1022 $(this.btn).removeClass('subMenuParentBtn'); 1023 $(this.btn).addClass('subMenuParentBtnFocused'); 1024 } 1025 this.root.subMenuZindex++; 1026 this.childMenu.css({ 1027 'display': 'block', 1028 'visibility': 'hidden', 1029 'zIndex': this.root.subMenuZindex 1030 }); 1031 if (!this.height || !this.width) { 1032 //console.log(this.childMenu.getFirst().outerHeight()); 1033 //this.height = this.childMenu.getFirst().getCoordinates().height; 1034 //silviu changes to get all the childrens content height 1035 //this.height = 0; 1036 this.height = this.childMenu.getFirst().outerHeight(); 1037 //this.width = this.childMenu.getFirst().getCoordinates().width; 1038 this.width = this.childMenu.getFirst().outerWidth(); 1039 //this.childMenu.css({'height':this.height,'width':this.width}/*,'border'*/); 1040 if (this.options.effect === 'slide' || this.options.effect === 'slide & fade') { 1041 if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal') { 1042 this.childMenu.getFirst().css('marginTop', '0'); 1043 if (this.options.direction.y === 'down') { 1044 $(this.childMenu).getFirst().css({ 1045 'marginTop': -this.height 1046 }); 1047 } else if (this.options.direction.y === 'up') { 1048 $(this.childMenu).getFirst().css({ 1049 'marginTop': this.height 1050 }); 1051 } 1052 } else { 1053 if (this.options.direction.x === 'left') { 1054 $(this.childMenu).getFirst().css({ 1055 'marginLeft': this.width 1056 }); 1057 } else { 1058 $(this.childMenu).getFirst().css({ 1059 'marginLeft': -this.width 1060 }); 1061 } 1062 } 1063 } 1064 } 1065 this.matchWidth(); 1066 this.positionSubMenu(); 1067 if (this.options.effect === 'slide') { 1068 this.childMenu.css({ 1069 'display': 'block', 1070 'visibility': 'visible' 1071 }); 1072 if (this.subMenuType === 'initial' && this.options.orientation === 'horizontal') { 1073 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top + $(this.btn).outerHeight() - $(window).scrollTop()); 1074 1075 if (document.getElementById("s5_menu_wrap")) { 1076 1077 var s5_menu_wrap_parent6 = ""; 1078 var s5_menu_wrap_parent6_top = ""; 1079 var s5_menu_wrap_parent5 = ""; 1080 var s5_menu_wrap_parent5_top = ""; 1081 var s5_menu_wrap_parent4 = ""; 1082 var s5_menu_wrap_parent4_top = ""; 1083 var s5_menu_wrap_parent3 = ""; 1084 var s5_menu_wrap_parent3_top = ""; 1085 var s5_menu_wrap_parent2 = ""; 1086 var s5_menu_wrap_parent2_top = ""; 1087 1088 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1089 1090 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1091 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1092 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1093 s5_menu_wrap_parent6_top = s5_menu_wrap_parent6_style.getPropertyValue('position'); 1094 } 1095 1096 1097 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1098 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1099 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1100 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1101 } 1102 1103 1104 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1105 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1106 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1107 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1108 } 1109 1110 1111 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1112 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1113 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1114 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1115 } 1116 1117 1118 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1119 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1120 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1121 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1122 } 1123 1124 } 1125 1126 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1127 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1128 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1129 1130 1131 var s5_menu_wrap_check1 = "no"; 1132 var s5_menu_wrap_check2 = "no"; 1133 var s5_menu_wrap_check3 = "no"; 1134 var s5_menu_wrap_check4 = "no"; 1135 var s5_menu_wrap_check5 = "no"; 1136 var s5_menu_wrap_check6 = "no"; 1137 1138 if (document.getElementById("s5_menu_wrap").className) { 1139 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1140 s5_menu_wrap_check1 = "yes"; 1141 } 1142 } 1143 1144 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1145 1146 if (document.getElementById("s5_menu_wrap").parentNode) { 1147 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1148 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1149 s5_menu_wrap_check2 = "yes"; 1150 } 1151 } 1152 } 1153 1154 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1155 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1156 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1157 s5_menu_wrap_check3 = "yes"; 1158 } 1159 } 1160 } 1161 1162 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1163 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1164 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1165 s5_menu_wrap_check4 = "yes"; 1166 } 1167 } 1168 } 1169 1170 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1171 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1172 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1173 s5_menu_wrap_check5 = "yes"; 1174 } 1175 } 1176 } 1177 1178 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1179 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1180 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1181 s5_menu_wrap_check6 = "yes"; 1182 } 1183 } 1184 } 1185 1186 } 1187 1188 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1189 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top + $(this.btn).outerHeight()); 1190 } 1191 } 1192 if (now) { 1193 $(this.childMenu).getFirst().stop().animate({ 1194 'marginTop': 0 1195 }, { 1196 'duration': 0, 1197 'easing': this.options.physics, 1198 'queue': false, 1199 'complete': (function() { 1200 this.showSubMenuComplete(); 1201 }).bind(this) 1202 }); 1203 } else { 1204 $(this.childMenu).getFirst().stop().animate({ 1205 'marginTop': 0 1206 }, { 1207 'duration': this.options.duration, 1208 'queue': false, 1209 'easing': this.options.physics, 1210 'complete': (function() { 1211 this.showSubMenuComplete(); 1212 }).bind(this) 1213 }); 1214 } 1215 } else { 1216 if (this.subMenuType === 'subsequent' && this.options.orientation === 'horizontal') { 1217 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top - $(window).scrollTop()); 1218 if (document.getElementById("s5_menu_wrap")) { 1219 1220 var s5_menu_wrap_parent6 = ""; 1221 var s5_menu_wrap_parent6_top = ""; 1222 var s5_menu_wrap_parent5 = ""; 1223 var s5_menu_wrap_parent5_top = ""; 1224 var s5_menu_wrap_parent4 = ""; 1225 var s5_menu_wrap_parent4_top = ""; 1226 var s5_menu_wrap_parent3 = ""; 1227 var s5_menu_wrap_parent3_top = ""; 1228 var s5_menu_wrap_parent2 = ""; 1229 var s5_menu_wrap_parent2_top = ""; 1230 1231 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1232 1233 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1234 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1235 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1236 s5_menu_wrap_parent6_top = s5_menu_wra
1236p_parent6_style.getPropertyValue('position'); 1237 } 1238 1239 1240 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1241 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1242 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1243 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1244 } 1245 1246 1247 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1248 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1249 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1250 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1251 } 1252 1253 1254 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1255 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1256 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1257 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1258 } 1259 1260 1261 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1262 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1263 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1264 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1265 } 1266 1267 } 1268 1269 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1270 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1271 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1272 1273 1274 var s5_menu_wrap_check1 = "no"; 1275 var s5_menu_wrap_check2 = "no"; 1276 var s5_menu_wrap_check3 = "no"; 1277 var s5_menu_wrap_check4 = "no"; 1278 var s5_menu_wrap_check5 = "no"; 1279 var s5_menu_wrap_check6 = "no"; 1280 1281 if (document.getElementById("s5_menu_wrap").className) { 1282 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1283 s5_menu_wrap_check1 = "yes"; 1284 } 1285 } 1286 1287 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1288 1289 if (document.getElementById("s5_menu_wrap").parentNode) { 1290 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1291 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1292 s5_menu_wrap_check2 = "yes"; 1293 } 1294 } 1295 } 1296 1297 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1298 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1299 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1300 s5_menu_wrap_check3 = "yes"; 1301 } 1302 } 1303 } 1304 1305 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1306 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1307 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1308 s5_menu_wrap_check4 = "yes"; 1309 } 1310 } 1311 } 1312 1313 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1314 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1315 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1316 s5_menu_wrap_check5 = "yes"; 1317 } 1318 } 1319 } 1320 1321 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1322 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1323 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1324 s5_menu_wrap_check6 = "yes"; 1325 } 1326 } 1327 } 1328 1329 } 1330 1331 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1332 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top); 1333 } 1334 } 1335 1336 } 1337 if (now) { 1338 $(this.childMenu).getFirst().stop().animate({ 1339 'marginLeft': 0 1340 }, { 1341 'duration': 0, 1342 'easing': this.options.physics, 1343 'queue': false, 1344 'complete': (function() { 1345 this.showSubMenuComplete(); 1346 }).bind(this) 1347 }); 1348 } else { 1349 $(this.childMenu).getFirst().stop().animate({ 1350 'marginLeft': 0 1351 }, { 1352 'duration': this.options.duration, 1353 'easing': this.options.physics, 1354 'queue': false, 1355 'complete': (function() { 1356 this.showSubMenuComplete(); 1357 }).bind(this) 1358 }); 1359 } 1360 } 1361 } else if (this.options.effect === 'fade') { 1362 if (this.subMenuType === 'initial' && this.options.orientation === 'horizontal') { 1363 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top + $(this.btn).outerHeight() - $(window).scrollTop()); 1364 if (document.getElementById("s5_menu_wrap")) { 1365 1366 var s5_menu_wrap_parent6 = ""; 1367 var s5_menu_wrap_parent6_top = ""; 1368 var s5_menu_wrap_parent5 = ""; 1369 var s5_menu_wrap_parent5_top = ""; 1370 var s5_menu_wrap_parent4 = ""; 1371 var s5_menu_wrap_parent4_top = ""; 1372 var s5_menu_wrap_parent3 = ""; 1373 var s5_menu_wrap_parent3_top = ""; 1374 var s5_menu_wrap_parent2 = ""; 1375 var s5_menu_wrap_parent2_top = ""; 1376 1377 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1378 1379 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1380 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1381 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1382 s5_menu_wrap_parent6_top = s5_menu_wrap_parent6_style.getPropertyValue('position'); 1383 } 1384 1385 1386 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1387 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1388 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1389 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1390 } 1391 1392 1393 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1394 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1395 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1396 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1397 } 1398 1399 1400 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1401 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1402 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1403 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1404 } 1405 1406 1407 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1408 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1409 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1410 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1411 } 1412 1413 } 1414 1415 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1416 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1417 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1418 1419 1420 var s5_menu_wrap_check1 = "no"; 1421 var s5_menu_wrap_check2 = "no"; 1422 var s5_menu_wrap_check3 = "no"; 1423 var s5_menu_wrap_check4 = "no"; 1424 var s5_menu_wrap_check5 = "no"; 1425 var s5_menu_wrap_check6 = "no"; 1426 1427 if (document.getElementById("s5_menu_wrap").className) { 1428 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1429 s5_menu_wrap_check1 = "yes"; 1430 } 1431 } 1432 1433 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1434 1435 if (document.getElementById("s5_menu_wrap").parentNode) { 1436 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1437 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1438 s5_menu_wrap_check2 = "yes"; 1439 } 1440 } 1441 } 1442 1443 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1444 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1445 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1446 s5_menu_wrap_check3 = "yes"; 1447 } 1448 } 1449 } 1450 1451 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1452 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1453 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1454 s5_menu_wrap_check4 = "yes"; 1455 } 1456 } 1457 } 1458 1459 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1460 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1461 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1462 s5_menu_wrap_check5 = "yes"; 1463 } 1464 } 1465 } 1466 1467 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1468 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1469 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1470 s5_menu_wrap_check6 = "yes"; 1471 } 1472 } 1473 } 1474 1475 } 1476 1477 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1478 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).off
1478set().top + $(this.btn).outerHeight()); 1479 } 1480 } 1481 } 1482 this.childMenu.css({ 1483 'display': 'block', 1484 'visibility': 'visible' 1485 }); 1486 if (now) { 1487 $(this.childMenu).getFirst().stop().animate({ 1488 'opacity': this.options.opacity 1489 }, { 1490 'duration': 0, 1491 'easing': this.options.physics, 1492 'queue': false, 1493 'complete': (function() { 1494 this.showSubMenuComplete(); 1495 }).bind(this) 1496 }); 1497 } else { 1498 $(this.childMenu).getFirst().stop().animate({ 1499 'opacity': this.options.opacity 1500 }, { 1501 'duration': this.options.duration, 1502 'easing': this.options.physics, 1503 'queue': false, 1504 'complete': (function() { 1505 this.showSubMenuComplete(); 1506 }).bind(this) 1507 }); 1508 } 1509 if (this.subMenuType === 'subsequent' && this.options.orientation === 'horizontal') { 1510 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top - $(window).scrollTop()); 1511 if (document.getElementById("s5_menu_wrap")) { 1512 1513 var s5_menu_wrap_parent6 = ""; 1514 var s5_menu_wrap_parent6_top = ""; 1515 var s5_menu_wrap_parent5 = ""; 1516 var s5_menu_wrap_parent5_top = ""; 1517 var s5_menu_wrap_parent4 = ""; 1518 var s5_menu_wrap_parent4_top = ""; 1519 var s5_menu_wrap_parent3 = ""; 1520 var s5_menu_wrap_parent3_top = ""; 1521 var s5_menu_wrap_parent2 = ""; 1522 var s5_menu_wrap_parent2_top = ""; 1523 1524 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1525 1526 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1527 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1528 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1529 s5_menu_wrap_parent6_top = s5_menu_wrap_parent6_style.getPropertyValue('position'); 1530 } 1531 1532 1533 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1534 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1535 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1536 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1537 } 1538 1539 1540 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1541 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1542 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1543 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1544 } 1545 1546 1547 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1548 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1549 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1550 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1551 } 1552 1553 1554 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1555 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1556 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1557 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1558 } 1559 1560 } 1561 1562 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1563 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1564 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1565 1566 1567 var s5_menu_wrap_check1 = "no"; 1568 var s5_menu_wrap_check2 = "no"; 1569 var s5_menu_wrap_check3 = "no"; 1570 var s5_menu_wrap_check4 = "no"; 1571 var s5_menu_wrap_check5 = "no"; 1572 var s5_menu_wrap_check6 = "no"; 1573 1574 if (document.getElementById("s5_menu_wrap").className) { 1575 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1576 s5_menu_wrap_check1 = "yes"; 1577 } 1578 } 1579 1580 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1581 1582 if (document.getElementById("s5_menu_wrap").parentNode) { 1583 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1584 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1585 s5_menu_wrap_check2 = "yes"; 1586 } 1587 } 1588 } 1589 1590 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1591 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1592 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1593 s5_menu_wrap_check3 = "yes"; 1594 } 1595 } 1596 } 1597 1598 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1599 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1600 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1601 s5_menu_wrap_check4 = "yes"; 1602 } 1603 } 1604 } 1605 1606 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1607 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1608 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1609 s5_menu_wrap_check5 = "yes"; 1610 } 1611 } 1612 } 1613 1614 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1615 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1616 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1617 s5_menu_wrap_check6 = "yes"; 1618 } 1619 } 1620 } 1621 1622 } 1623 1624 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1625 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top); 1626 } 1627 } 1628 1629 } 1630 } else if (this.options.effect == 'slide & fade') { 1631 this.childMenu.css({ 1632 'display': 'block', 1633 'visibility': 'visible' 1634 }); 1635 this.childMenu.getFirst().css({ 1636 'left': 0 1637 }); 1638 if (this.subMenuType === 'initial' && this.options.orientation === 'horizontal') { 1639 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top + $(this.btn).outerHeight() - $(window).scrollTop()); 1640 if (document.getElementById("s5_menu_wrap")) { 1641 1642 var s5_menu_wrap_parent6 = ""; 1643 var s5_menu_wrap_parent6_top = ""; 1644 var s5_menu_wrap_parent5 = ""; 1645 var s5_menu_wrap_parent5_top = ""; 1646 var s5_menu_wrap_parent4 = ""; 1647 var s5_menu_wrap_parent4_top = ""; 1648 var s5_menu_wrap_parent3 = ""; 1649 var s5_menu_wrap_parent3_top = ""; 1650 var s5_menu_wrap_parent2 = ""; 1651 var s5_menu_wrap_parent2_top = ""; 1652 1653 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1654 1655 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1656 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1657 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1658 s5_menu_wrap_parent6_top = s5_menu_wrap_parent6_style.getPropertyValue('position'); 1659 } 1660 1661 1662 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1663 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1664 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1665 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1666 } 1667 1668 1669 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1670 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1671 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1672 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1673 } 1674 1675 1676 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1677 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1678 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1679 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1680 } 1681 1682 1683 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1684 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1685 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1686 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1687 } 1688 1689 } 1690 1691 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1692 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1693 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1694 1695 1696 var s5_menu_wrap_check1 = "no"; 1697 var s5_menu_wrap_check2 = "no"; 1698 var s5_menu_wrap_check3 = "no"; 1699 var s5_menu_wrap_check4 = "no"; 1700 var s5_menu_wrap_check5 = "no"; 1701 var s5_menu_wrap_check6 = "no"; 1702 1703 if (document.getElementById("s5_menu_wrap").className) { 1704 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1705 s5_menu_wrap_check1 = "yes"; 1706 } 1707 } 1708 1709 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1710 1711 if (document.getElementById("s5_menu_wrap").parentNode) { 1712 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1713 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1714 s5_menu_wrap_check2 = "yes"; 1715 } 1716 } 1717 } 1718 1719 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1720 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1721 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1722 s5_menu_wrap_check3 = "yes"; 1723 } 1724 } 1725 } 1726 1727 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1728 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1729 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1730 s5_menu_wrap_check4 = "yes"; 1731 } 1732 } 1733 } 1734 1735 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1736 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1737
1737 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1738 s5_menu_wrap_check5 = "yes"; 1739 } 1740 } 1741 } 1742 1743 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1744 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1745 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1746 s5_menu_wrap_check6 = "yes"; 1747 } 1748 } 1749 } 1750 1751 } 1752 1753 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1754 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /*&& $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top + $(this.btn).outerHeight()); 1755 } 1756 } 1757 1758 if (now) { 1759 $(this.childMenu).getFirst().stop().animate({ 1760 'marginTop': 0, 1761 'opacity': this.options.opacity 1762 }, { 1763 'duration': 0, 1764 'queue': false, 1765 'easing': this.options.physics, 1766 'complete': (function() { 1767 this.showSubMenuComplete(); 1768 }).bind(this) 1769 }); 1770 } else { 1771 $(this.childMenu).getFirst().stop().animate({ 1772 'marginTop': 0, 1773 'opacity': this.options.opacity 1774 }, { 1775 'duration': this.options.duration, 1776 'queue': false, 1777 'easing': this.options.physics, 1778 'complete': (function() { 1779 this.showSubMenuComplete(); 1780 }).bind(this) 1781 }); 1782 } 1783 } else { 1784 if (this.subMenuType === 'subsequent' && this.options.orientation === 'horizontal') { 1785 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top - $(window).scrollTop()); 1786 1787 if (document.getElementById("s5_menu_wrap")) { 1788 1789 var s5_menu_wrap_parent6 = ""; 1790 var s5_menu_wrap_parent6_top = ""; 1791 var s5_menu_wrap_parent5 = ""; 1792 var s5_menu_wrap_parent5_top = ""; 1793 var s5_menu_wrap_parent4 = ""; 1794 var s5_menu_wrap_parent4_top = ""; 1795 var s5_menu_wrap_parent3 = ""; 1796 var s5_menu_wrap_parent3_top = ""; 1797 var s5_menu_wrap_parent2 = ""; 1798 var s5_menu_wrap_parent2_top = ""; 1799 1800 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1801 1802 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.tagName) { 1803 s5_menu_wrap_parent6 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode, 1804 s5_menu_wrap_parent6_style = window.getComputedStyle(s5_menu_wrap_parent6), 1805 s5_menu_wrap_parent6_top = s5_menu_wrap_parent6_style.getPropertyValue('position'); 1806 } 1807 1808 1809 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.tagName) { 1810 s5_menu_wrap_parent5 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode, 1811 s5_menu_wrap_parent5_style = window.getComputedStyle(s5_menu_wrap_parent5), 1812 s5_menu_wrap_parent5_top = s5_menu_wrap_parent5_style.getPropertyValue('position'); 1813 } 1814 1815 1816 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.tagName) { 1817 s5_menu_wrap_parent4 = document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode, 1818 s5_menu_wrap_parent4_style = window.getComputedStyle(s5_menu_wrap_parent4), 1819 s5_menu_wrap_parent4_top = s5_menu_wrap_parent4_style.getPropertyValue('position'); 1820 } 1821 1822 1823 if (document.getElementById("s5_menu_wrap").parentNode.parentNode && document.getElementById("s5_menu_wrap").parentNode.parentNode.tagName) { 1824 s5_menu_wrap_parent3 = document.getElementById("s5_menu_wrap").parentNode.parentNode, 1825 s5_menu_wrap_parent3_style = window.getComputedStyle(s5_menu_wrap_parent3), 1826 s5_menu_wrap_parent3_top = s5_menu_wrap_parent3_style.getPropertyValue('position'); 1827 } 1828 1829 1830 if (document.getElementById("s5_menu_wrap").parentNode && document.getElementById("s5_menu_wrap").parentNode.tagName) { 1831 s5_menu_wrap_parent2 = document.getElementById("s5_menu_wrap").parentNode, 1832 s5_menu_wrap_parent2_style = window.getComputedStyle(s5_menu_wrap_parent2), 1833 s5_menu_wrap_parent2_top = s5_menu_wrap_parent2_style.getPropertyValue('position'); 1834 } 1835 1836 } 1837 1838 var s5_menu_wrap_parent1 = document.getElementById("s5_menu_wrap"), 1839 s5_menu_wrap_parent1_style = window.getComputedStyle(s5_menu_wrap_parent1), 1840 s5_menu_wrap_parent1_top = s5_menu_wrap_parent1_style.getPropertyValue('position'); 1841 1842 1843 var s5_menu_wrap_check1 = "no"; 1844 var s5_menu_wrap_check2 = "no"; 1845 var s5_menu_wrap_check3 = "no"; 1846 var s5_menu_wrap_check4 = "no"; 1847 var s5_menu_wrap_check5 = "no"; 1848 var s5_menu_wrap_check6 = "no"; 1849 1850 if (document.getElementById("s5_menu_wrap").className) { 1851 if (document.getElementById("s5_menu_wrap").className.indexOf('wrap_fmfullwidth') >= 1) { 1852 s5_menu_wrap_check1 = "yes"; 1853 } 1854 } 1855 1856 if (document.getElementById("s5_menu_wrap").parentNode.tagName != "BODY") { 1857 1858 if (document.getElementById("s5_menu_wrap").parentNode) { 1859 if (document.getElementById("s5_menu_wrap").parentNode.className) { 1860 if (document.getElementById("s5_menu_wrap").parentNode.className.indexOf('floating_header') >= 1) { 1861 s5_menu_wrap_check2 = "yes"; 1862 } 1863 } 1864 } 1865 1866 if (document.getElementById("s5_menu_wrap").parentNode.parentNode) { 1867 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className) { 1868 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1869 s5_menu_wrap_check3 = "yes"; 1870 } 1871 } 1872 } 1873 1874 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode) { 1875 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className) { 1876 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1877 s5_menu_wrap_check4 = "yes"; 1878 } 1879 } 1880 } 1881 1882 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode) { 1883 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className) { 1884 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1885 s5_menu_wrap_check5 = "yes"; 1886 } 1887 } 1888 } 1889 1890 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode) { 1891 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className) { 1892 if (document.getElementById("s5_menu_wrap").parentNode.parentNode.parentNode.parentNode.parentNode.className.indexOf('floating_header') >= 1) { 1893 s5_menu_wrap_check6 = "yes"; 1894 } 1895 } 1896 } 1897 1898 } 1899 1900 if (document.getElementById("s5_menu_wrap").className != "s5_wrap" && s5_menu_wrap_check1 == "no" && s5_menu_wrap_check2 == "no" && s5_menu_wrap_check3 == "no" && s5_menu_wrap_check4 == "no" && s5_menu_wrap_check5 == "no" && s5_menu_wrap_check6 == "no" && s5_menu_wrap_parent1_top != "fixed" && s5_menu_wrap_parent2_top != "fixed" && s5_menu_wrap_parent3_top != "fixed" && s5_menu_wrap_parent4_top != "fixed" && s5_menu_wrap_parent5_top != "fixed" && s5_menu_wrap_parent6_top != "fixed") { 1901 if ($('#' + this.options.id).offset().top != $('#' + this.options.id).position().top /* && $('#'+this.options.id)[0].offsetTop!=0*/ ) $(this.childMenu).css('top', $(this.btn).offset().top); 1902 } 1903 } 1904 1905 } 1906 if (now) { 1907 if (this.options.direction.x === 'right') { 1908 $(this.childMenu).getFirst().stop().animate({ 1909 'marginLeft': 0, 1910 'opacity': this.options.opacity 1911 }, { 1912 'duration': 0, 1913 'easing': this.options.physics, 1914 'queue': false, 1915 'complete': (function() { 1916 this.showSubMenuComplete(); 1917 }).bind(this) 1918 }); 1919 } else if (this.options.direction.x === 'left') { 1920 $(this.childMenu).getFirst().stop().animate({ 1921 'marginLeft': 0, 1922 'opacity': this.options.opacity 1923 }, { 1924 'duration': 0, 1925 'easing': this.options.physics, 1926 'queue': false, 1927 'complete': (function() { 1928 this.showSubMenuComplete(); 1929 }).bind(this) 1930 }); 1931 } 1932 } else { 1933 if (this.options.direction.x === 'right') { 1934 $(this.childMenu).getFirst().css('marginLeft', -this.width); 1935 $(this.childMenu).getFirst().stop().animate({ 1936 'marginLeft': 0, 1937 'opacity': this.options.opacity 1938 }, { 1939 'duration': this.options.duration, 1940 'easing': this.options.physics, 1941 'queue': false, 1942 'complete': (function() { 1943 this.showSubMenuComplete(); 1944 }).bind(this) 1945 }); 1946 } else if (this.options.direction.x === 'left') { 1947 $(this.childMenu).getFirst().stop().animate({ 1948 'marginLeft': 0, 1949 'opacity': this.options.opacity 1950 }, { 1951 'duration': this.options.duration, 1952 'easing': this.options.physics, 1953 'queue': false, 1954 'complete': (function() { 1955 this.showSubMenuComplete(); 1956 }).bind(this) 1957 }); 1958 } 1959 } 1960 } 1961 } else { 1962 this.childMenu.stop().animate({ 1963 'display': 'block', 1964 'visibility': 'visible' 1965 }, { 1966 'duration': 0, 1967 'easing': this.options.physics, 1968 'queue': false, 1969 'complete': (function() { 1970 this.showSubMenuComplete(); 1971 }).bind(this) 1972 }); 1973 } 1974 this.childMenu.data('status', 'open'); 1975 }; 1976 MenuMaticSubMenu.prototype.showSubMenuComplete = function() { 1977 //this.options.onShowSubMenu_complete(this); 1978 if (this.options.olddirection.x) this.options.direction.x = this.options.olddirection.x; 1979 return; 1980 if ((parseInt(this.childMenu[0].style.top) != this.btn.offset().top 1981 && this.btn.offset().top != $('#' + this.options.id).offset().top 1982 && parseInt(this.btn.css('marginTop')) == 0) 1983 && $('#' + this.options.id)[0].offsetTop != 0 1984 ) { 1985 if (this.btn.data('subMenuType') == 'initial') { 1986 if (this.options.orientation == 'horizontal') { 1987 if (this.btn.is('li') == false) var t = this.btn.parentsUntil('li').eq(0).outerHeight(); 1988 else 1989 var t = this.btn.outerHeight(); 1990 } else 1991 var t = this.btn.offset().top + this.btn.outerHeight(); 1992 t -= this.subtractScrollTop(); 1993 $(this.childMenu).animate({ 1994 'top': t 1995 }, this.options.duration, this.options.physics); 1996 } else { 1997 var totop = this.btn.offset().top - this.subtractScrollTop(); 1998 $(this.childMenu).animate({ 1999 'top': totop 2000 }, this.options.duration, this.options.physics); 2001 } 2002 } 2003 }; 2004 MenuMaticSubMenu.prototype.positionSubMenu = function() { 2005 //this.options.onPositionSubMenu_begin(this); 2006 this.childMenu.css('width', this.width); 2007 //this.childMenu.getFirst().css('width', this.width); 2008 var ul = this.childMenu.getFirst(); 2009 var li = ul.getFirst(); 2010 var ul2 = li.find('ul'); 2011 var w =
2011 0; 2012 ul2.each(function(i, d) { 2013 w += d.offsetWidth; 2014 }); 2015 this.childMenu.getFirst().css('width', w + 1); 2016 this.childMenu.css('width', w + 1); 2017 // console.log(this.childMenu.getFirst()); 2018 //if parent is ltr className all childrens must be ltr 2019 if (this.btn.parents('div').className == 's5_sub_wrap_rtl' || this.btn.parents('div').className == 's5_sub_wrap_lower_rtl') { 2020 //this.childMenu.className = 's5_sub_wrap_rtl'; 2021 this.childMenu.className = 's5_sub_wrap_lower_rtl'; 2022 } 2023 //if any parent has bounced off a viewport edge, inherit that new direction 2024 if (this.subMenuType === 'subsequent') { 2025 if (this.parentSubMenu && this.options.direction.x != this.parentSubMenu.options.direction.x) { 2026 if (this.parentSubMenu.options.direction.x === 'left' && this.options.effect && this.options.effect.contains('slide')) { 2027 $(this.childMenu).getFirst().css({ 2028 'marginLeft': this.width 2029 }); 2030 } 2031 } 2032 this.options.direction.x = this.parentSubMenu.options.direction.x; 2033 this.options.direction.xInverse = this.parentSubMenu.options.direction.xInverse; 2034 this.options.direction.y = this.parentSubMenu.options.direction.y; 2035 this.options.direction.yInverse = this.parentSubMenu.options.direction.yInverse; 2036 } 2037 var top; 2038 var overlap 2039 if (this.subMenuType == 'initial') { 2040 if (this.options.direction.y === 'up') { 2041 if (this.options.orientation === 'vertical') { 2042 if (this.btn.is('li') == false) var t = this.btn.parentsUntil('li').eq(0).outerHeight(); 2043 else 2044 var t = this.btn.outerHeight(); 2045 top = this.btn.offset().top - this.subtractScrollTop() + t - this.height + this.options.tweakInitial.y; 2046 } else { 2047 top = this.btn.offset().top - this.subtractScrollTop() - this.height + this.options.tweakInitial.y; 2048 } 2049 //console.log(top); 2050 this.childMenu[0].style.top = top + 'px'; 2051 } else if (this.options.orientation == 'horizontal') { 2052 if (this.btn.is('li') == false) var t = this.btn.parentsUntil('li').eq(0).outerHeight(); 2053 else 2054 var t = this.btn.outerHeight(); 2055 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + t + this.options.tweakInitial.y + 'px'; 2056 } else if (this.options.orientation == 'vertical') { 2057 top = this.btn.offset().top - this.subtractScrollTop() + this.options.tweakInitial.y; 2058 //console.log(top); 2059 /* commented out at 3/15/2013 ,vertical menu bug 2060 * if((top + this.childMenu.height()) >= $(document.body).scrollTop()){ 2061 overlap = (top + this.childMenu.height()) - $(document.body).scrollTop() ; 2062 top = top - overlap - 20; 2063 } */ 2064 //console.log(top); 2065 top += this.btn.outerHeight(); 2066 this.childMenu[0].style.top = top + 'px'; 2067 } 2068 if (this.options.orientation == 'horizontal') { 2069 var child_width = this.childMenu.outerWidth(); 2070 var mouse_poz = this.btn.offset().left; 2071 if (this.btn.is('li') == false) var btn_width = this.btn.parentsUntil('li').eq(0).outerWidth(); 2072 else 2073 var btn_width = this.btn.outerWidth(); 2074 var sceen = $(window).width(); 2075 if (this.options.direction.x == 'left') { 2076 if ((mouse_poz - child_width) < 0) { 2077 if (this.btn.offset().left - child_width + btn_width < 0 && this.btn.offset().left + child_width > sceen) { //console.log(this.btn.offset().left + child_width > sceen); 2078 this.childMenu[0].style.width = this.root.getWidth(); 2079 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2080 this.childMenu.children().each(function(ii, tt) { 2081 $(tt).css({ 2082 'float': 'none', 2083 'width': 'auto' 2084 }); 2085 $(tt).children().each(function(jj, zz) { 2086 $(zz).children().each(function(kk, zzz) { 2087 $(zzz).css({ 2088 'float': 'none' 2089 }); 2090 }); 2091 }); 2092 }); 2093 } else { 2094 this.childMenu[0].style.width = this.root.getWidth(); 2095 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2096 this.childMenu.css({ 2097 /*'width': 'auto', 2098 'float': 'left',*/ 2099 'clear': 'none' 2100 }); 2101 this.childMenu.children().each(function(ii, tt) { 2102 $(tt).css({ 2103 'float': 'left', 2104 'width': 'auto', 2105 'clear': 'none' 2106 }).children().each(function(jj, zz) { 2107 $(zz).children().each(function(kk, zzz) { 2108 $(zzz).css({ 2109 'float': 'left', 2110 'clear': 'none' 2111 }); 2112 }); 2113 }); 2114 }); 2115 } 2116 child_width = $(this.childMenu).outerWidth(); 2117 if (this.btn.offset().left - child_width + btn_width < 20 /* changed from 0 to 20*/ ) { 2118 toleft = this.btn.offset().left; 2119 need = 1; 2120 toleft -= 24; // left+right padding of the menu item class 2121 } else { 2122 toleft = this.btn.offset().left - child_width + btn_width; 2123 need = 0; 2124 } 2125 this.childMenu[0].style.left = toleft + 'px'; 2126 if (need) this.childMenu.className = 's5_sub_wrap_rtl'; 2127 else this.childMenu.className = 's5_sub_wrap'; 2128 } else { 2129 this.childMenu[0].style.width = this.root.getWidth(); 2130 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2131 this.childMenu.css({ 2132 /*'width': 'auto', 2133 'float': 'left',*/ 2134 'clear': 'none' 2135 }); 2136 this.childMenu.children().each(function(ii, tt) { 2137 $(tt).css({ 2138 'width': 'auto', 2139 'float': 'left', 2140 'clear': 'none' 2141 }).children().each(function(jj, zz) { 2142 $(zz).children().each(function(kk, zzz) { 2143 $(zzz).css({ 2144 'float': 'left', 2145 'clear': 'none' 2146 }); 2147 }); 2148 }); 2149 }); 2150 this.childMenu[0].className = 's5_sub_wrap'; 2151 this.childMenu[0].style.marginLeft = '5px'; 2152 child_width = this.childMenu.outerWidth(); 2153 this.childMenu[0].style.left = (this.btn.offset().left - child_width + btn_width) + 'px'; //this.btn.offset().left + this.options.tweakInitial.x + 'px'; 2154 } 2155 } else { 2156 if ((child_width + mouse_poz) > sceen) { 2157 if (this.btn.offset().left - child_width + btn_width < 0) { 2158 this.childMenu[0].style.width = this.root.getWidth(); 2159 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2160 /*this.childMenu.css({ 2161 'width': 'auto', 2162 float: 'none' 2163 });*/ 2164 this.childMenu.children().each(function(ii, tt) { 2165 $(tt).css({ 2166 'width': 'auto', 2167 float: 'none' 2168 }).children().each(function(jj, zz) { 2169 $(zz).children().each(function(kk, zzz) { 2170 $(zzz).css('float', 'none'); 2171 }); 2172 }); 2173 }); 2174 this.childMenu.className = 's5_sub_wrap_rtl'; 2175 } else { 2176 this.childMenu[0].style.width = this.root.getWidth(); 2177 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2178 this.childMenu.css({ 2179 /*'width': 'auto', 2180 'float': 'left',*/ 2181 'clear': 'none' 2182 }); 2183 this.childMenu.children().each(function(ii, tt) { 2184 $(tt).css({ 2185 'float': 'left', 2186 'width': 'auto', 2187 'clear': 'none' 2188 }).children().each(function(jj, zz) { 2189 $(zz).children().each(function(kk, zzz) { 2190 $(zzz).css({ 2191 'float': 'left', 2192 'clear': 'none' 2193 }); 2194 }); 2195 }); 2196 }); 2197 } 2198 child_width = this.childMenu.width(); 2199 if (child_width + this.btn.offset().left < sceen - 20 /* changed from sceen to sceen - 20*/ ) toleft = this.btn.offset().left; 2200 else { 2201 var toleft = this.btn.offset().left - child_width + btn_width; 2202 if (toleft < 0) toleft = this.btn.offset().left; 2203 } 2204 this.childMenu[0].style.left = toleft + 'px'; 2205 if (child_width + this.btn.offset().left < sceen) this.childMenu.className = 's5_sub_wrap'; 2206 else this.childMenu.className = 's5_sub_wrap_rtl'; 2207 } else { 2208 this.childMenu[0].style.width = this.root.getWidth(); 2209 this.childMenu[0].style['cssFloat'] = (this.childMenu[0].style.width == 'auto') ? 'left' : 'none'; 2210 this.childMenu.children().each(function(ii, tt) { 2211 $(tt).css({ 2212 'float': 'left', 2213 'width': 'auto', 2214 'clear': 'none' 2215 }).children().each(function(jj, zz) { 2216 $(zz).children().each(function(kk, zzz) { 2217 $(zzz).css({ 2218 'float': 'left', 2219 'clear': 'none' 2220 }); 2221 }); 2222 }); 2223 }); 2224 this.childMenu.className = 's5_sub_wrap'; 2225 //this.childMenu[0].style.background='white'; 2226 this.childMenu[0].style.left = this.btn.offset().left + this.options.tweakInitial.x + 'px'; 2227 } 2228 } 2229 } else if (this.options.direction.x == 'left') { 2230 this.childMenu[0].style.left = this.btn.offset().left - this.childMenu.width() + this.options.tweakInitial.x + 'px'; 2231 } else if (this.options.direction.x == 'right') { 2232 if (this.btn.is('li') == false) var bw = this.btn.parentsUntil('li').eq(0).outerWidth(); 2233 else 2234 var bw = this.btn.outerWidth(); 2235 this.childMenu[0].style.left = this.btn.offset().left + bw + this.options.tweakInitial.x + 'px'; 2236 } 2237 } else if (this.subMenuType == 'subsequent') { 2238 if (this.options.direction.y === 'down') { 2239 if ((this.btn.offset().top + this.options.tweakSubsequent.y + this.childMenu.height()) >= $(document.body).scrollTop()) { 2240 overlap = (this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.y + this.childMenu.height()); 2241 this.childMenu[0].style.top = (this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.y) - overlap - 20 + 'px'; 2242 } else { 2243 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.y + 'px'; 2244 } 2245 } else if (this.options.direction.y === 'up') { 2246 if (this.btn.is('li') == false) var t = this.btn.parentsUntil('li').eq(0).outerHeight(); 2247 else 2248 var t = this.btn.outerHeight(); 2249 if ((this.btn.offset().top + t - this.subtractScrollTop() - this.height + this.options.tweakSubsequent.y) < 1) { 2250 this.options.direction.y = 'down'; 2251 this.options.direction.yInverse = 'up'; 2252 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.y + 'px'; 2253 } else { 2254 if (this.btn.is('li') == false) var t = this.btn.parentsUntil('li').eq(0).outerHeight(); 2255 else 2256 var t = this.btn.outerHeight(); 2257 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + t - this.height + this.options.tweakSubsequent.y + 'px'; 2258 } 2259 } 2260 if (this.options.direction.x == 'left') { 2261 this.childMenu[0].style.left = this.btn.offset().left - this.childMenu.width() + this.options.tweakSubsequent.x + 'px'; 2262 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.x + 'px'; 2263 if (this.childMenu.offset().left < 20) { 2264 //console.log('it was '+this.options.direction.x); 2265 this.options.olddirection.x = this.options.direction.x; 2266 this.options.direction.x = 'right'; 2267 //console.log('to right'); 2268 this.options.direction.xInverse = 'left'; 2269 if (this.btn.is('li') == false) var bw = this.btn.parentsUntil('li').eq(0).outerWidth(); 2270 else 2271 var bw = this.btn.outerWidth(); 2272 this.childMenu[0].style.left = this.btn.offset().left + bw + this.options.tweakSubsequent.x + 'px'; 2273 this.childMenu.className = 's5_sub_wrap_lower_rtl'; 2274 if (this.options.effect === 'slide' || this.options.effect === 'slide & fade') { 2275 $(this.childMenu).getFir
2275st().css({ 2276 'marginLeft': -this.width, 2277 'opacity': this.options.opacity 2278 }); 2279 } 2280 } 2281 } else if (this.options.direction.x == 'right') { 2282 // console.log('r'); 2283 if (this.btn.is('li') == false) var bw = this.btn.parentsUntil('li').eq(0).outerWidth(); 2284 else 2285 var bw = this.btn.outerWidth(); 2286 this.childMenu[0].style.top = this.btn.offset().top - this.subtractScrollTop() + this.options.tweakSubsequent.x + 'px'; 2287 this.childMenu[0].style.left = this.btn.offset().left + bw + this.options.tweakSubsequent.x + 'px'; 2288 2289 var smRight = this.childMenu.offset().left + this.childMenu.width(); 2290 var viewportRightEdge = $(window).width() + $(window).scrollLeft() - 20; 2291 if (smRight > viewportRightEdge) { 2292 //console.log('it was '+this.options.direction.x); 2293 this.options.olddirection.x = this.options.direction.x; 2294 this.options.direction.x = 'left'; 2295 //console.log(' to left'); 2296 this.options.direction.xInverse = 'right'; 2297 var child_width = this.childMenu.outerWidth(); 2298 var mouse_poz = this.btn.offset().left; 2299 var sceen = $(window).width(); 2300 //reverse orientation if sub hits screen end 2301 if (((child_width * 2) + mouse_poz) <= sceen) { 2302 this.childMenu[0].style.right = this.btn.offset().left + this.options.tweakSubsequent.x + 'px'; 2303 } else { 2304 this.childMenu[0].style.left = this.btn.offset().left - this.childMenu.width() + this.options.tweakSubsequent.x + 'px'; 2305 this.childMenu.className = 's5_sub_wrap_lower_rtl'; 2306 } 2307 if (this.options.effect === 'slide' || this.options.effect === 'slide & fade') { 2308 $(this.childMenu).getFirst().css({ 2309 'marginLeft': this.width, 2310 'opacity': this.options.opacity 2311 }); 2312 } 2313 } 2314 } 2315 } 2316 //this.options.onPositionSubMenu_complete(this); 2317 }; 2318 MenuMaticSubMenu.prototype.subtractScrollTop = function() { 2319 return $('#' + this.options.id).offset().top != $('#' + this.options.id).position().top ? $(window).scrollTop() : 0; 2320 } 2321 MenuMaticSubMenu.prototype.initialize = function(options, root2, btn2, current_index) { 2322 //var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); 2323 this.options = $.extend(options, this.options); 2324 /* if (this.addEvent) for (var option in options){ 2325 if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; 2326 this.bind(option, options[option]); 2327 delete options[option]; 2328 } 2329 */ 2330 this.root = root2; 2331 this.btn = btn2; 2332 this.childMenu = $(this.btn).data('childMenu'); 2333 if (!this.childMenu) return; 2334 this.subMenuType = this.btn.data('subMenuType'); 2335 //this.childMenu = this.btn.data('childMenu'); 2336 this.parentSubMenus = $(this.btn.data('parentSubMenus')); 2337 this.parentLinks = this.btn.data('parentLinks'); 2338 //console.log(this.btn.data('parentLinks')); 2339 //if(this.parentLinks.length==0) return; 2340 if (this.parentSubMenus) this.parentSubMenu = $(this.parentSubMenus[0]); 2341 else this.parentSubMenu = null; 2342 if (this.parentSubMenu) { 2343 this.parentSubMenu = this.parentSubMenu.data('class'); 2344 } 2345 this.childMenu.data('class', this); 2346 this.btn.data('class', this); 2347 this.childMenu.data('status', 'closed'); 2348 //this.options.onSubMenuInit_begin(this); 2349 //add hide Event 2350 this.childMenu.on('hidex', (function() { 2351 this.hideSubMenu(); 2352 }).bind(this)); // silviu commented 2353 //add show Event 2354 this.childMenu.on('show', (function() { 2355 this.showSubMenu(); 2356 }).bind(this)); 2357 if (this.options.effect) { 2358 /*this.myEffect = new Fx.Morph( 2359 $(this.childMenu).getFirst(), { duration: this.options.duration, transition: this.options.physics, link: 'cancel' } 2360 );*/ 2361 } 2362 if (this.options.effect === 'slide' || this.options.effect === 'slide & fade') { 2363 if (this.subMenuType == 'initial' && this.options.orientation === 'horizontal') { 2364 this.childMenu.getFirst().css('marginTop', '0'); 2365 } else { 2366 this.childMenu.getFirst().css('marginLeft', '0'); 2367 } 2368 } else if (this.options.effect === 'fade' || this.options.effect === 'slide & fade') { 2369 this.childMenu.getFirst().css('opacity', 0); 2370 } 2371 if (this.options.effect != 'fade' && this.options.effect != 'slide & fade') { 2372 this.childMenu.getFirst().css('opacity', this.options.opacity); 2373 } 2374 this.childMenu.getFirst().css('float', 'left'); 2375 //attach event handlers to non-parent sub menu buttons 2376 //var nonParentBtns = $(this.childMenu).getElements('li').filter(function(item, index){ return !$(item).data('childMenu'); }); 2377 var nonParentBtnsP = $("#li_child_" + current_index + ' ul'); 2378 nonParentBtnsP.each((function(index, item) { 2379 var nonParentBtns = $('li', $(item)).filter(function(index, item) { 2380 return !$(item).data('childMenu'); 2381 }); 2382 nonParentBtns.each((function(index, item) { 2383 $(item).addClass('subMenuBtn'); 2384 $(item).on('mouseenter', (function(e) { 2385 this.childMenu.trigger('show'); 2386 this.cancellHideAllSubMenus(); 2387 this.hideOtherSubMenus(); 2388 }).bind(this)); 2389 $(item).parentsUntil('div').parent().on('mouseenter', (function(e) { 2390 this.cancellHideAllSubMenus(); 2391 }).bind(this)); 2392 2393 $(item).data('mouseenterH', (function(e) { 2394 this.childMenu.trigger('show'); 2395 this.cancellHideAllSubMenus(); 2396 this.hideOtherSubMenus(); 2397 }).bind(this)); 2398 $(item).on('focus', (function(e) { 2399 this.childMenu.trigger('show'); 2400 this.cancellHideAllSubMenus(); 2401 this.hideOtherSubMenus(); 2402 }).bind(this)); 2403 $(item).on('mouseleave', (function(e) { // return false;
2404 this.cancellHideAllSubMenus(); 2405 //this.hideAllSubMenus(); 2406 }).bind(this)); 2407 $(item).data('mouseleaveH', (function(e) { // return false; 2408 this.cancellHideAllSubMenus(); 2409 this.hideAllSubMenus(); 2410 }).bind(this)); 2411 $(item).on('blur', (function(e) { 2412 this.cancellHideAllSubMenus(); 2413 this.hideAllSubMenus(); 2414 }).bind(this)); 2415 $(item).on('keydown', (function(e) { 2416 var event = new Event(e); 2417 if (e.key === 'up' || e.key === 'down' || e.key === 'left' || e.key === 'right' || e.key === 'tab') { 2418 e.stop(); 2419 } 2420 if (e.key === 'up') { 2421 if ($(item).parents('li').getPrevious('li')) { 2422 //move focus to the next link up if possible 2423 $(item).parents('li').getPrevious('li').getFirst('a').focus(); 2424 } else if (this.options.direction.y === 'down') { 2425 //move focus to the parent link 2426 this.btn.focus(); 2427 } else if (this.options.direction.y === 'up') { 2428 //move focus to the last link in the subMenu 2429 $(item).parents('li').parent().getLast('li').getFirst('a').focus(); 2430 } 2431 } else if (e.key === 'down') { 2432 if ($(item).parents('li').getNext('li')) { 2433 //move focus to the next link down if possible 2434 $(item).parents('li').getNext('li').getFirst('a').focus(); 2435 } else if (this.options.direction.y === 'down') { 2436 //move focus to the first link in the submenu 2437 $(item).parents('li').parent().getFirst('li').getFirst('a').focus(); 2438 } else if (this.options.direction.y === 'up') { 2439 //move focus to the parent link 2440 this.btn.focus(); 2441 } 2442 } else if (e.key === this.options.direction.xInverse) { 2443 this.btn.focus(); 2444 } 2445 }).bind(this)); 2446 }).bind(this)); 2447 }).bind(this)); 2448 this.btn.removeClass('subMenuBtn'); 2449 if (this.subMenuType == 'initial') { 2450 this.btn.addClass('mainParentBtn'); 2451 } else { 2452 this.btn.addClass('subParentBtn'); 2453 } 2454 //attach event handlers to parent button 2455 this.btn.on('mouseenter', (function(e) { 2456 e.preventDefault(); 2457 this.cancellHideAllSubMenus(); 2458 this.hideOtherSubMenus(); 2459 //if(this.options.opacity == this.btn.parents('ul').getStyle('opacity') || this.btn.parents('ul').getStyle('opacity') == 1){ 2460 setTimeout((function() { 2461 this.showSubMenu(); 2462 }).bind(this), 10); 2463 //} 2464 if (this.subMenuType === 'initial' && this.options.mmbClassName && this.options.mmbFocusedClassName) { 2465 if ($(this.btn).data('btnMorph')) $(this.btn).data('btnMorph'); 2466 else this.btn.switchClass(this.options.mmbFocusedClassName, '', this.options.duration / 2, this.options.physics); 2467 } 2468 }).bind(this)).data('mouseenterH', (function(e) { 2469 e.preventDefault(); 2470 this.cancellHideAllSubMenus(); 2471 this.hideOtherSubMenus(); 2472 //if(this.options.opacity == this.btn.parents('ul').getStyle('opacity') || this.btn.parents('ul').getStyle('opacity') == 1){ 2473 setTimeout((function() { 2474 this.showSubMenu(); 2475 }).bind(this), 10); 2476 //} 2477 if (this.subMenuType === 'initial' && this.options.mmbClassName && this.options.mmbFocusedClassName) { 2478 if ($(this.btn).data('btnMorph')) $(this.btn).data('btnMorph'); 2479 else this.btn.switchClass(this.options.mmbFocusedClassName, '', this.options.duration / 2, this.options.physics); 2480 } 2481 }).bind(this)); 2482 this.btn.on('focus', (function(e) { 2483 e.preventDefault(); 2484 this.cancellHideAllSubMenus(); 2485 this.hideOtherSubMenus(); 2486 this.showSubMenu(); 2487 if (this.subMenuType === 'initial' && this.options.mmbClassName && this.options.mmbFocusedClassName) { 2488 if ($(this.btn).data('btnMorph')) $(this.btn).data('btnMorph'); 2489 else this.btn.switchClass(this.options.mmbFocusedClassName, '', this.options.duration / 2, this.options.physics); 2490 } 2491 }).bind(this)); 2492 this.btn.data('childMenu').on('mouseleave', (function(e) { //return false;
2493 e.preventDefault(); 2494 this.cancellHideAllSubMenus(); 2495 this.hideAllSubMenus(); 2496 }).bind(this)).data('mouseleaveHander', (function(e) { //return false; 2497 e.preventDefault(); 2498 this.cancellHideAllSubMenus(); 2499 this.hideAllSubMenus(); 2500 }).bind(this)); 2501 2502 this.btn.on('mouseleave', (function(e) { //return false; 2503 e.preventDefault(); 2504 this.cancellHideAllSubMenus(); 2505 this.hideAllSubMenus(this.btn); 2506 }).bind(this)).data('mouseleaveHander', (function(e) { //return false; 2507 e.preventDefault(); 2508 this.cancellHideAllSubMenus(); 2509 this.hideAllSubMenus(); 2510 }).bind(this)); 2511 2512 this.btn.on('blur', (function(e) { 2513 e.preventDefault(); 2514 this.cancellHideAllSubMenus(); 2515 this.hideAllSubMenus(); 2516 }).bind(this)); 2517 this.btn.on('keydown', (function(e) { 2518 e = new Event(e) 2519 if (e.key === 'up' || e.key === 'down' || e.key === 'left' || e.key === 'right') { 2520 e.stop(); 2521 } 2522 if (!this.parentSubMenu) { 2523 //main menu parent buttons 2524 if ( 2525 this.options.orientation === 'horizontal' && e.key === this.options.direction.y || this.options.orientation === 'vertical' && e.key === this.options.direction.x) { 2526 if (this.options.direction.y === 'down') { 2527 //move focus to the first link in the child menu 2528 this.childMenu.getFirst().getFirst('li').getFirst('a').focus(); 2529 } else if (this.options.direction.y === 'up') { 2530 //move focus to the first link in the child menu 2531 this.childMenu.getFirst().getLast('li').getFirst('a').focus(); 2532 } 2533 } else if ( 2534 this.options.orientation === 'horizontal' && e.key === 'left' || this.options.orientation === 'vertical' && e.key === this.options.direction.yInverse) { 2535 //move focus to the previous link if possible, if not, move focus to the last link in the menu 2536 if (this.btn.parent().getPrevious()) { 2537 this.btn.parent().getPrevious().getFirst().focus(); 2538 } else { 2539 this.btn.parent().parent().getLast().getFirst().focus(); 2540 } 2541 } else if ( 2542 this.options.orientation === 'horizontal' && e.key === 'right' || this.options.orientation === 'vertical' && e.key === this.options.direction.y) { 2543 //move focus to the next link if possible, if not, move focus to the first link in the menu 2544 if (this.btn.parent().getNext()) { 2545 this.btn.parent().getNext().getFirst().focus(); 2546 } else { 2547 this.btn.parent().parent().getFirst().getFirst().focus(); 2548 } 2549 } 2550 } else { 2551 if (e.key === 'tab') { 2552 e.stop(); 2553 } 2554 //submenu parent buttons 2555 if (e.key === 'up') { 2556 if (this.btn.parents('li').getPrevious('li')) { 2557 //move focus to the next link up 2558 this.btn.parents('li').getPrevious('li').getFirst('a').focus(); 2559 } else if (this.options.direction.y === 'down') { 2560 //move focus to the parent link 2561 this.parentSubMenu.btn.focus(); 2562 } else if (this.options.direction.y === 'up') { 2563 //move focus to the bottom link in this submenu 2564 this.btn.parents('li').parent().getLast('li').getFirst('a').focus(); 2565 } 2566 } else if (e.key === 'down') { 2567 if (this.btn.parents('li').getNext('li')) { 2568 //move focus to the next link down 2569 this.btn.parents('li').getNext('li').getFirst('a').focus(); 2570 } else if (this.options.direction.y === 'down') { 2571 //move focus to the top link in this submenu 2572 this.btn.parents('li').parent().getFirst('li').getFirst('a').focus(); 2573 } else if (this.options.direction.y === 'up') { 2574 //move focus to the parent link 2575 this.parentSubMenu.btn.focus(); 2576 } 2577 } else if (e.key === this.options.direction.xInverse) { 2578 this.parentSubMenu.btn.focus(); 2579 } else if (e.key === this.options.direction.x) { 2580 if (this.options.direction.y === 'down') { 2581 this.childMenu.getFirst().getFirst('li').getFirst('a').focus(); 2582 } else if (this.options.direction.y === 'up') { 2583 // this.childMenu.getFirst().getLast('li').getFirst('a').focus(); 2584 } 2585 } 2586 } 2587 }).bind(this)); 2588 //this.options.onSubMenuInit_complete(this); 2589 } 2590})(jQuery); 2591 2592function s5_create_separator_class() { 2593 if (document.getElementById("subMenusContainer")) { 2594 var s5_create_separator_class = document.getElementById("subMenusContainer").getElementsByTagName("A"); 2595 for (var s5_create_separator_class_z = 0; s5_create_separator_class_z < s5_create_separator_class.length; s5_create_separator_class_z++) { 2596 if (s5_create_separator_class[s5_create_separator_class_z].href == "javascript:;") { 2597 if (s5_create_separator_class[s5_create_separator_class_z].parentNode.className == "S5_submenu_item") { 2598 s5_create_separator_class[s5_create_separator_class_z].parentNode.parentNode.className = s5_create_separator_class[s5_create_separator_class_z].parentNode.parentNode.className + " subSepBtn"; 2599 } 2600 } 2601 } 2602 } 2603} 2604window.onload = s5_create_separator_class;
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.