'use strict'; window.theme = window.theme || {}; theme.Global = function() { function Global() { this.settings = { set_offset_with_fixed_body: [ '.header__content--sticky', '.footbar', '.footer--fixed', '#admin_bar_iframe', '#preview-bar-iframe' ] }; this.dom = {}; this.load(); }; Global.prototype = $.extend({}, Global.prototype, { load: function() { var ua = window.navigator.userAgent.toLowerCase(), current_bp, $scroll_example = $('.scroll-offset-example'); window.ie = (/trident/gi).test(ua) || (/msie/gi).test(ua); window.edge = document.documentMode || /edge/.test(ua); window.ios = navigator.userAgent.match(/like Mac OS X/i); window.moz = typeof InstallTrigger !== 'undefined'; window.$window = $(window); window.$document = $(document); window.$html = $('html'); window.$body = $html.find('body'); if(ios) { $html.addClass('is-ios'); } else if(edge) { $html.addClass('is-edge'); } else if(ie) { $html.addClass('is-ie'); } else if(moz) { $html.addClass('is-moz'); } this.dom.$icons = $('#theme-icons'); theme.rtl = $html.attr('dir') === 'rtl' ? true : false; theme.breakpoints = { values: { xs: 0, sm: 541, md: 778, lg: 1025, xl: 1260 } }; theme.breakpoints.main = theme.breakpoints.values.lg; theme.current = {}; function checkWindow() { theme.current.width = window.innerWidth; theme.current.height = window.innerHeight; }; function checkBreakpoint() { theme.current.is_mobile = theme.current.width < theme.breakpoints.main; theme.current.is_desktop = !theme.current.is_mobile; $.each(theme.breakpoints.values, function(k, v) { if(v > theme.current.width) { return false; } theme.current.bp = k; }); if(current_bp && current_bp != theme.current.bp) { $(window).trigger('theme.changed.breakpoint'); } current_bp = theme.current.bp; }; function scrollPaddingStyle() { var $style = $('style.scroll-offset-style'); theme.current.scroll_w = $scroll_example[0].offsetWidth - $scroll_example[0].clientWidth; if(theme.current.scroll_w > 0) { if(!$style.length) { var offset_scroll_style_html = 'body.overflow-hidden.offset-scroll{padding-right:' + theme.current.scroll_w + 'px;}.fixed-elem.offset-scroll{padding-right:' + theme.current.scroll_w + 'px;}'; $('head').append($('