$(document).ready(function() { //------------------------ MENU MAGIC BUTTON ------------------------- var EM; $(window).on('resize', function() { // cover content EM = parseFloat($('body').css('font-size')); var sm = $(window).width() <= 38*EM; if (sm != window.smallScreen) { if (window.smallScreen = sm) { $('#wrapper').addClass('small-screen'); $('#left-panel').removeClass('visible'); } else { $('#wrapper').removeClass('small-screen'); $('#left-panel').addClass('visible'); } } } ); $(window).trigger('resize'); $(window).on('scroll', function() { // fixed menu position var mf = $(window).scrollTop() >= 8.16*EM; if (mf != window.menuFixed) { if (window.menuFixed = mf) { $('#left-panel').addClass('menu-fix'); } else { $('#left-panel').removeClass('menu-fix'); } } } ); $(window).trigger('scroll'); $('#content > p, p.just').each(function() { var dl = parseFloat($(this).css('line-height')) * 2; if ($(this).height() >= dl) $(this).css('text-indent', '1.5em'); } ); var closeMenu = function() { window.menuMouseEnter = false; if (!window.smallScreen) return; $('#left-panel').removeClass('visible'); }; $('#left-panel').on('mouseleave', closeMenu); $('#left-panel').on('touchstart', function(event) { event.stopPropagation(); } ); $(document).on('touchstart', closeMenu); $('#menu-btn').on('mouseenter', function() { if (window.menuMouseEnter || !window.smallScreen) return; $('#left-panel').addClass('visible'); window.lastEvent = (new Date().getTime()) + 100; window.menuMouseEnter = true; } ); $('#menu-btn').on('click', function() { if ((new Date().getTime()) < window.lastEvent) return; if (!window.smallScreen) $('#wrapper').toggleClass('small-screen'); $('#left-panel').toggleClass('visible'); } ); $('span.anchor').html(function() { var href = this.getAttribute('data-href') || ''; var data = this.innerHTML; if (href.length == 0) { href = data; data = data.replace(/^(.+:\/\/)|(\/)$/g, ''); } this.innerHTML = '' + data + ''; }); $('span.mailto').html(function() { var href = this.getAttribute('data-href') || ''; var data = this.innerHTML; if (href.length == 0) { href = data; data = null; } href = href.match(/^(.+) małpa (.+) kropka (.+)$/); href = href[1] + '@' + href[2] + '.' + href[3]; this.innerHTML = '' + (data || href) + ''; }); //-------------------------------------------------------------------- ( function(elmID) { var btns = $('.tgl-btn', elmID); var pnls = $('.tgl-pnl', elmID); btns.click(function() { var thisIndex = btns.index(this); var thisPnl = $(pnls.get(thisIndex)); if (elmID == '#menu-content') { thisPnl.toggle("normal", function() { setTimeout(function() { $.cookie('visible_menu_index', getMenuPath($('#menu-tree')).join('-'), { path: '/' }); }, 100); } ); thisPnl.parent().siblings("li").children("ul").not(thisPnl).hide("normal"); } else { thisPnl.toggle("normal"); pnls.not(thisPnl).hide("normal"); } } ) .hover( function() { $(this).css('textDecoration', 'underline'); }, function() { $(this).css('textDecoration', 'none'); } ) .css('cursor', 'pointer'); return arguments.callee; } )('#menu-content'); } ); function oWin(o) { open(o.href, '', ''); return false; } function getMenuPath(jqObj) { var index = -1, thisObj = null; jqObj.children('li').children('ul').each(function(i) { if ($(this).is(':visible')) { index = i; thisObj = $(this); return false; } return true; } ); if (index < 0) return []; else return [index].concat(arguments.callee(thisObj)); } function setMenuPath(jqObj, ar) { if (ar.length > 0 && ar[0].length > 0) { var index = parseInt(ar[0]); for (var i = 0; i < ar.length; i++) ar[i] = ar[i + 1]; ar.length--; arguments.callee(jqObj.children('li').children('ul').eq(index).show(), ar); } } (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-97855372-1', 'auto'); ga('send', 'pageview');