/*! * mod_vertical_menu - Vertical Menu * * @author Balint Polgarfi * @copyright 2014-2019 Offlajn.com All Rights Reserved * @license https://gnu.org/licenses/gpl-2.0.html * @link https://offlajn.com */ ;(function($, undefined) { var Hlpr = { width: $.fn.width, hackWidth: function(reduce) { return function(arg) { var value = Hlpr.width.apply(this, arguments); if (this[0] == window && !$.isNumeric(arg) && value > 767) value -= reduce; return value; } }, preventDefault: function(e) { e.preventDefault(); }, stopPropagation: function(e) { e.stopPropagation(); }, cancelTransitionEnd: function(e) { if(e.target.tagName != "NAV") e.stopPropagation(); }, loadImage: function(src) { new Image().src = src; }, calcOrigin: function(origin, w, dir) { var o = origin.split(/\s+/); if (o[2] && o[2].indexOf("%") > 0) // convert originZ to px o[2] = parseFloat(o[2]) / 100 * w + "px"; if (dir < 0) { // invert if (o[0].indexOf("%") < 0) o[0] = (parseInt(o[0]) / w * 100).toPrecision(3); o[0] = (parseInt(o[0]) - 50) * dir + 50 + "%"; } return o.join(" "); } }; var Target = { hide: function() { this.target.style.display = "none"; }, remove: function() { this.target.parentNode.removeChild(this.target); }, scrollUp: function() { $(this.target.children[0]).scrollTop(0); this.target.style.display = "none"; }, autoMaxWidth: function() { this.target.attributes["class"].value = "sm-title"; this.target.style.maxWidth = ""; }, autoHeight: function() { this.target.style.height = ""; } }; // calc scrollWidth $(function() { var outer = document.createElement("div"); outer.style.visibility = "hidden"; outer.style.width = "100px"; document.body.appendChild(outer); var widthNoScroll = outer.offsetWidth; outer.style.overflow = "scroll"; var inner = document.createElement("div"); inner.style.width = "100%"; outer.appendChild(inner); var widthWithScroll = inner.offsetWidth; outer.parentNode.removeChild(outer); Hlpr.scrollWidth = widthNoScroll - widthWithScroll; }); smTransform = (function() { var tr, trs = {transform: 0, WebkitTransform: 0, MozTransform: 0, msTransform: 0, OTransform: 0}; for (tr in trs) if (tr in document.documentElement.style) return tr; })(); smTransition = (function() { var tr, trs = {transition: 0, WebkitTransition: 0, MozTransition: 0, OTransition: 0}; for (tr in trs) if (tr in document.documentElement.style) return tr; })(); smTransitionEnd = smTransition && smTransition + (smTransition[0] == 't' ? 'end' : 'End'); var $body, $win = $(window), $html = $(document.documentElement), oldIE = navigator.userAgent.match(/MSIE ([6-9])/), backScale = 0.75; if (smMobile) $html.addClass('sm-mobile'); $.fn._center = function(bi) { var x, w, prev; if (bi) prev = this[0].parentNode.children[1] == this[0] ? 0 : $(this[0].parentNode.children[0]).outerWidth(); else prev = this.prev().outerWidth() * backScale || 0; w = this.css("maxWidth", "none").width() + 30; this[0].style.maxWidth = ""; x = Math.floor((this.parent().outerWidth() - w) / 2); return prev > x ? prev : x; }; function deleteMediaRules(match) { var css = ''; for (var j = 0; j < document.styleSheets.length; j++) { var style = document.styleSheets[j]; if (!style.href || style.href.indexOf('mod_vertical_menu') < 0) try { for (var i = 0; i < style.cssRules.length; i++) { var rule = style.cssRules[i]; if (rule.media && rule.media.mediaText.match(match)) { if (style.href) css += rule.cssText.replace(/(url\(['"]?)([^)]+)/i, function(m, url, href) { return href.match(/^\/|^https?:|^data:/i) ? m : url + style.href.replace(/[^/]+$/, '') + href; }) + '\n'; else css += rule.cssText + '\n'; style.deleteRule(i--); } } } catch(ex) {} } return css; } function hackMediaWidths(width) { width = width || 0; if (!hackMediaWidths.hasOwnProperty('css')) { hackMediaWidths.css = [deleteMediaRules('width')]; hackMediaWidths.$css = $('