var master = { mobileMenuTimeout: null, }; master.mobileMenuToggle = function() { var prefix = 'layout-ceiling-mobile-'; var selector = $('.'+prefix+'menu'); var state = selector.attr('data-state'); clearTimeout(master.mobileMenuTimeout); if (state=='Y') { selector .attr('data-state','N') .removeClass('layout-ceiling-mobile-menu-active') .find('.layout-ceiling-mobile-hline').removeClass('layout-ceiling-mobile-hline-active'); selector.find('.'+prefix+'hline[data-n="1"]').removeClass(prefix+'anim-in-hline1').addClass(prefix+'anim-out-hline1'); selector.find('.'+prefix+'hline[data-n="2"]').removeClass(prefix+'anim-in-hline2').addClass(prefix+'anim-out-hline2'); selector.find('.'+prefix+'hline[data-n="3"]').removeClass(prefix+'anim-in-hline3').addClass(prefix+'anim-out-hline3'); $('.layout-ceiling').removeClass('layout-ceiling-fixed'); $('.layout-ceiling-mobile-options').addClass('layout-ceiling-mobile-options-out'); master.mobileMenuTimeout = setTimeout(function() { $('.layout-ceiling-mobile-options').remove(); }, 500); } else { selector .attr('data-state','Y') .addClass('layout-ceiling-mobile-menu-active') .find('.layout-ceiling-mobile-hline').addClass('layout-ceiling-mobile-hline-active'); selector.find('.'+prefix+'hline[data-n="1"]').removeClass(prefix+'anim-out-hline1').addClass(prefix+'anim-in-hline1'); selector.find('.'+prefix+'hline[data-n="2"]').removeClass(prefix+'anim-out-hline2').addClass(prefix+'anim-in-hline2'); selector.find('.'+prefix+'hline[data-n="3"]').removeClass(prefix+'anim-out-hline3').addClass(prefix+'anim-in-hline3'); $('.layout-ceiling').addClass('layout-ceiling-fixed'); if ($('.layout-ceiling-mobile-options').length==0) { $('body').append('
'); } else { $('.layout-ceiling-mobile-options').empty().removeClass('layout-ceiling-mobile-options-out'); } if (typeof _MASTERDATA['menuOptions'] === 'object') { var output = ''; for (var i=0; i<_MASTERDATA['menuOptions'].length; i++) { if (_MASTERDATA['menuOptions'][i]['icon']=='phone') { continue; } if (_MASTERDATA['menuOptions'][i]['icon']=='mail') { continue; } output += '' + _MASTERDATA['menuOptions'][i]['name'] + ''; } $('.layout-ceiling-mobile-options').empty().append(output); } } $(window).scrollTop(0); } master.isHiDpi = function() { if (!window.matchMedia) { return false; } var MQM = window.matchMedia("( only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 192dpi) )"); if (!((MQM && MQM.matches) || window.devicePixelRatio >= 2)) { return false; } return true; } master.buttonInit = function(selector) { $(selector) .on('click tap', function() { $(this).attr('data-state', 'Y') .find('.layout-buttons-text').addClass('layout-buttons-text-active'); }) .on('mouseenter', function() { master.buttonOver(this); }) .on('mouseleave', function() { master.buttonOut(this); }); } master.buttonOver = function(obj) { if ($(obj).attr('data-state')=='Y') { return; } $(obj).find('.layout-buttons-over') .removeClass('layout-buttons-over-out') .addClass('layout-buttons-over-in'); } master.buttonOut = function(obj) { if ($(obj).attr('data-state')=='Y') { return; } $(obj).find('.layout-buttons-over') .removeClass('layout-buttons-over-in') .addClass('layout-buttons-over-out'); setTimeout(function() { $(obj).find('.layout-buttons-over').removeClass('layout-buttons-over-out'); }, 300); } master.pad = function(num, size) { var s = num+''; while (s.length