PageSourceSearch

https://www.iberestudios.com/noticias/wp-content/themes/jnews/assets/js/jquery.okayNav.js?ver=20.0.7

js iberestudios.com collected 2026-10-02 12:04:06 UTC 9,687 bytes, 6 lines download raw bytes

1/*!
2 * jquery.okayNav.js 2.0.4 (https://github.com/VPenkov/okayNav)
3 * Author: Vergil Penkov (http://vergilpenkov.com/)
4 * MIT license: https://opensource.org/licenses/MIT
5 */
6!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(i,n){return void 0===n&&(n="undefined"!=typeof window?require("jquery"):require("jquery")(i)),e(n),n}:e(jQuery)}(function(e){var i=!!("object"==typeof jnews&&"object"==typeof jnews.library)&&jnews.library,n="okayNav",t={parent:"",toggle_icon_class:"okayNav__menu-toggle",toggle_icon_content:"<span /><span /><span />",align_right:!0,swipe_enabled:!0,threshold:50,resize_delay:10,max_visible_items:6,beforeOpen:function(){},afterOpen:function(){},beforeClose:function(){},afterClose:function(){},itemHidden:function(){},itemDisplayed:function(){}};function o(n,o){var a=this;a.options=e.extend({},t,o),a.navigation=e(n),a.document=e(document),a.window=e(window),""==a.options.parent&&(this.options.parent=this.navigation.parent()),a.nav_open=!1,a.parent_full_width=0,a.radCoef=180/Math.PI,a.sTouch={x:0,y:0},a.cTouch={x:0,y:0},a.sTime=0,a.nav_position=0,a.percent_open=0,a.nav_moving=!1,i&&(a.jnewsLibrary=i,a.init())}o.prototype={init:function(){var i=this;e("body").addClass("okayNav-loaded"),i.navigation.addClass("okayNav loaded").children("ul").addClass("okayNav__nav--visible"),i.options.align_right?i.navigation.append('<ul class="okayNav__nav--invisible transition-enabled nav-right" />').append('<a href="#" aria-label="Show all Category" class="'+i.options.toggle_icon_class+' okay-invisible">'+i.options.toggle_icon_content+"</a>"):i.navigation.prepend('<ul class="okayNav__nav--invisible transition-enabled nav-left" />').prepend('<a href="#" class="'+i.options.toggle_icon_class+' okay-invisible">'+i.options.toggle_icon_content+"</a>"),i.nav_visible=i.navigation.children(".okayNav__nav--visible"),i.nav_invisible=i.navigation.children(".okayNav__nav--invisible"),i.toggle_icon=i.navigation.children("."+i.options.toggle_icon_class),i.resize_observer=null,i.initEvents(),i.nav_visible.contents().filter(function(){return this.nodeType=Node.TEXT_NODE&&!1===/\S/.test(this.nodeValue)}).remove(),1==i.options.swipe_enabled&&i.initSwipeEvents()},initEvents:function(){var i=this;i.options.parent.on("click.okayNav",function(n){var t=e(n.target);!0===i.nav_open&&0==t.closest(".okayNav").length&&i.closeInvisibleNav(),t.hasClass(i.options.toggle_icon_class)&&(n.preventDefault(),i.toggleInvisibleNav())}),e(document).on("mouseup.okayNav",function(n){e(n.target);!e(n.target).parents(".okayNav").length>0&&i.closeInvisibleNav()});var n=i._debounce(function(){i.recalcNav()},i.options.resize_delay);i.window.on("load.okayNav ready.okayNav resize.okayNav",n),e(document).on("ready.okayNav",n),i.initResizeObserver(n),n()},initResizeObserver:function(e){var i=this;"undefined"!=typeof ResizeObserver&&(i.resize_observer=new ResizeObserver(e),i.resize_observer.observe(i.options.parent[0]),i.resize_observer.observe(i.navigation[0]),i.resize_observer.observe(i.nav_visible[0]))},initSwipeEvents:function(){var i=this;i.document.on("touchstart.okayNav",function(n){if(i.nav_invisible.removeClass("transition-enabled"),1==n.originalEvent.touches.length){var t=n.originalEvent.touches[0];(t.pageX<25&&0==i.options.align_right||t.pageX>e(i.options.parent).outerWidth(!0)-25&&1==i.options.align_right||!0===i.nav_open)&&(i.sTouch.x=i.cTouch.x=t.pageX,i.sTouch.y=i.cTouch.y=t.pageY,i.sTime=Date.now())}}).on("touchmove.okayNav",function(e){var n=e.originalEvent.touches[0];i._triggerMove(n.pageX,n.pageY),i.nav_moving=!0}).on("touchend.okayNav",function(e){i.sTouch={x:0,y:0},i.cTouch={x:0,y:0},i.sTime=0,i.percent_open>100-i.options.threshold?(i.nav_position=0,i.closeInvisibleNav()):1==i.nav_moving&&(i.nav_position=i.nav_invisible.width(),i.openInvisibleNav()),i.nav_moving=!1,i.nav_invisible.addClass("transition-enabled")})},_getDirection:function(e){return this.options.align_right?e>0?-1:1:e<0?-1:1},_triggerMove:function(e,i){var n=this;n.cTouch.x=e,n.cTouch.y=i;var t=Date.now(),o=n.cTouch.x-n.sTouch.x,a=n.cTouch.y-n.sTouch.y,s=a*a,l=Math.sqrt(o*o+s),r=Math.sqrt(s),v=Math.asin(Math.sin(r/l))*n.radCoef;n.sTime;if(n.sTouch.x=e,n.sTouch.y=i,v<20){var c=n._getDirection(o),d=n.nav_position+c*l,u=n.nav_invisible.width(),g=0;d<0?g=-d:d>u&&(g=u-d);var h=(u-(n.nav_position+c*l+g))/u*100;n.nav_position+=c*l+g,n.percent_open=h}},getParent:function(){return this.options.parent},getVisibleNav:function(){return this.nav_visible},getInvisibleNav:function(){return this.nav_invisible},getNavToggleIcon:function(){return this.toggle_icon},_debounce:function(e,i,n){var t,o=this;return function(){var i=this,a=arguments,s=n&&!t;t&&o.jnewsLibrary.cancelAnimationFrame.call(o.jnewsLibrary.win,t),t=o.jnewsLibrary.requestAnimationFrame.call(o.jnewsLibrary.win,function(){t&&o.jnewsLibrary.cancelAnimationFrame.call(o.jnewsLibrary.win,t),n||e.apply(i,a)}),s&&e.apply(i,a)}},openInvisibleNav:function(){var e=this;e.options.enable_swipe||e.options.beforeOpen.call(),e.toggle_icon.addClass("icon--active"),e.nav_inv
6isible.addClass("nav-open"),e.nav_open=!0,e.options.afterOpen.call()},closeInvisibleNav:function(){var e=this;e.options.enable_swipe||e.options.beforeClose.call(),e.toggle_icon.removeClass("icon--active"),e.nav_invisible.removeClass("nav-open"),e.nav_open=!1,e.options.afterClose.call()},toggleInvisibleNav:function(){var e=this;e.nav_open?e.closeInvisibleNav():e.openInvisibleNav()},getChildrenWidth:function(i){for(var n=0,t=e(i).children(),o=0;o<t.length;o++)n+=this.getElementOuterWidth(t[o]);return n},getElementWidth:function(e){return e?e.getBoundingClientRect().width:0},getElementOuterWidth:function(e){var i;return e?(i=window.getComputedStyle(e),this.getElementWidth(e)+parseFloat(i.marginLeft||0)+parseFloat(i.marginRight||0)):0},getElementContentWidth:function(e){var i;return e?(i=window.getComputedStyle(e),Math.max(0,this.getElementWidth(e)-parseFloat(i.paddingLeft||0)-parseFloat(i.paddingRight||0)-parseFloat(i.borderLeftWidth||0)-parseFloat(i.borderRightWidth||0))):0},getToggleIconWidth:function(){var e=this,i=e.getElementOuterWidth(e.toggle_icon[0]);if(0===i&&e.toggle_icon.hasClass("okay-invisible")){var n=e.toggle_icon.attr("style");e.toggle_icon.css({display:"block",position:"absolute",visibility:"hidden"}),i=e.getElementOuterWidth(e.toggle_icon[0]),void 0===n?e.toggle_icon.removeAttr("style"):e.toggle_icon.attr("style",n)}return i},getItemsWidth:function(e){var i=this,n=0;return e.each(function(){n+=i.getElementOuterWidth(this)}),n},getVisibleItemsWidth:function(){return this.getItemsWidth(e("li",this.nav_visible))},getRequiredVisibleWidth:function(e){return this.getVisibleItemsWidth()+(this.getHiddenItemCount()>0?e:0)},getLayoutSlack:function(e){return Math.max(16,Math.round(.5*e))},getAvailableWidth:function(){var i=this,n=i.options.parent[0],t=i.navigation[0],o=i.getElementContentWidth(n),a=0;return o?(e(n).children().each(function(){this!==t&&(a+=i.getElementOuterWidth(this))}),Math.max(0,o-a-(i.getElementOuterWidth(t)-i.getElementContentWidth(t)))):0},updateVisibleNavMaxWidth:function(e,i){var n=this,t=Math.max(0,e-n.getLayoutSlack(i));n.getHiddenItemCount()>0&&(t=Math.max(0,t-i)),n.nav_visible.css("max-width",t+"px")},getVisibleItemCount:function(){return e("li",this.nav_visible).length},getHiddenItemCount:function(){return e("li",this.nav_invisible).length},getMaxVisibleItems:function(){var e=parseInt(this.options.max_visible_items,10);return isNaN(e)||e<1?6:e},recalcNav:function(){var e=this,i=e.getAvailableWidth(),n=e.getToggleIconWidth(),t=e.getMaxVisibleItems(),o=Math.max(0,i-e.getLayoutSlack(n)),a=0;if(i){for(e.getHiddenItemCount()>0?e.updateVisibleNavMaxWidth(i,n):e.nav_visible.css("max-width",o+"px");e.getVisibleItemCount()>0&&(e.getVisibleItemCount()>t||e.getRequiredVisibleWidth(n)>o)&&a<100;)e._collapseNavItem(),a++,e.updateVisibleNavMaxWidth(i,n);for(a=0;e.getHiddenItemCount()>0&&a<100;){if(e._expandNavItem(),e.getVisibleItemCount()>t||e.getRequiredVisibleWidth(n)>o){e._collapseNavItem();break}a++}0==e.getHiddenItemCount()?e.toggle_icon.addClass("okay-invisible"):e.toggle_icon.removeClass("okay-invisible"),e.updateVisibleNavMaxWidth(i,n)}},_collapseNavItem:function(){var i=this,n=e("li:last-child",i.nav_visible);i.document.trigger("okayNav:collapseItem",n),n.detach().prependTo(i.nav_invisible),i.options.itemHidden.call()},_expandNavItem:function(){var i=this,n=e("li:first-child",i.nav_invisible);i.document.trigger("okayNav:expandItem",n),n.detach().appendTo(i.nav_visible),i.options.itemDisplayed.call()},_expandAllItems:function(){var i=this;e("li",i.nav_invisible).detach().appendTo(i.nav_visible),i.options.itemDisplayed.call()},_collapseAllItems:function(){var i=this;e("li",i.nav_visible).detach().appendTo(i.nav_invisible),i.options.itemHidden.call()},destroy:function(){var i=this;e("li",i.nav_invisible).appendTo(i.nav_visible),i.nav_invisible.remove(),i.nav_visible.removeClass("okayNav__nav--visible"),i.toggle_icon.remove(),i.resize_observer&&i.resize_observer.disconnect(),i.document.unbind(".okayNav"),i.window.unbind(".okayNav")}},e.fn[n]=function(t){var a,s=arguments;return void 0===t||"object"==typeof t?this.each(function(){var a=this;i&&i.requestAnimationFrame.call(i.win,function(){e.data(a,"plugin_"+n)||e.data(a,"plugin_"+n,new o(a,t))})}):"string"==typeof t&&"_"!==t[0]&&"init"!==t?(this.each(function(){var l=this;i&&i.requestAnimationFrame.call(i.win,function(){var i=e.data(l,"plugin_"+n);i instanceof o&&"function"==typeof i[t]&&(a=i[t].apply(i,Array.prototype.slice.call(s,1))),"destroy"===t&&e.data(l,"plugin_"+n,null)})}),void 0!==a?a:this):void 0}});

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.