priority-nav 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/priority-nav.js +1 -9
- package/dist/priority-nav.min.js +2 -2
- package/package.json +1 -1
- package/yarn.lock +0 -1889
package/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# PriorityNavigation.js
|
2
2
|
PriorityNav is a pure javascript plugin that will move your menu items if they don't fit its parent.
|
3
|
+
#### Vue.js version **[here](https://github.com/gijsroge/vue-responsive-menu)**.
|
4
|
+
----------
|
3
5
|

|
4
6
|
|
5
7
|
#### Take a look at the **[Demo](http://gijsroge.github.io/priority-nav.js/)** site.
|
@@ -101,3 +103,4 @@ To support Internet Explorer 8, [es5-shim](https://github.com/kriskowal/es5-shim
|
|
101
103
|
* https://github.com/352Media/flexMenu (jQuery)
|
102
104
|
* https://github.com/VPenkov/okayNav (jQuery)
|
103
105
|
* https://github.com/VPenkov/okayNav-vanillaJS (no dependencies)
|
106
|
+
* https://github.com/skywalkapps/nav-priority (no dependencies)
|
package/dist/priority-nav.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* priority-nav - v1.0.13 | (c)
|
2
|
+
* priority-nav - v1.0.13 | (c) 2025 @gijsroge | MIT license
|
3
3
|
* Repository: https://github.com/gijsroge/priority-navigation.git
|
4
4
|
* Description: Priority+ pattern navigation that hides menu items if they don't fit on screen.
|
5
5
|
* Demo: http://gijsroge.github.io/priority-nav.js/
|
@@ -552,14 +552,6 @@
|
|
552
552
|
};
|
553
553
|
};
|
554
554
|
|
555
|
-
|
556
|
-
/**
|
557
|
-
* Remove function
|
558
|
-
*/
|
559
|
-
Element.prototype.remove = function() {
|
560
|
-
this.parentElement.removeChild(this);
|
561
|
-
};
|
562
|
-
|
563
555
|
/*global HTMLCollection */
|
564
556
|
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
565
557
|
for(var i = 0, len = this.length; i < len; i++) {
|
package/dist/priority-nav.min.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
* priority-nav - v1.0.13 | (c)
|
2
|
+
* priority-nav - v1.0.13 | (c) 2025 @gijsroge | MIT license
|
3
3
|
* Repository: https://github.com/gijsroge/priority-navigation.git
|
4
4
|
* Description: Priority+ pattern navigation that hides menu items if they don't fit on screen.
|
5
5
|
* Demo: http://gijsroge.github.io/priority-nav.js/
|
6
6
|
*/
|
7
7
|
|
8
|
-
!function(e,t){"function"==typeof define&&define.amd?define("priorityNav",t(e)):"object"==typeof exports?module.exports=t(e):e.priorityNav=t(e)}(window||this,function(e){"use strict";var i,d,c,s,u,a,l,p={},v=[],h=!!document.querySelector&&!!e.addEventListener,
|
8
|
+
!function(e,t){"function"==typeof define&&define.amd?define("priorityNav",t(e)):"object"==typeof exports?module.exports=t(e):e.priorityNav=t(e)}(window||this,function(e){"use strict";var i,d,c,s,u,a,l,p={},v=[],h=!!document.querySelector&&!!e.addEventListener,f={},m=0,y=0,w={initClass:"js-priorityNav",mainNavWrapper:"nav",mainNav:"ul",navDropdownClassName:"nav__dropdown",navDropdownToggleClassName:"nav__dropdown-toggle",navDropdownLabel:"more",navDropdownBreakpointLabel:"menu",breakPoint:500,throttleDelay:50,offsetPixels:0,count:!0,moved:function(){},movedBack:function(){}},S=function(e,t,n){if("[object Object]"===Object.prototype.toString.call(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(n,e[o],o,e);else for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)};var o=function(e,t){if(e.classList)e.classList.toggle(t);else{var n=e.className.split(" "),o=n.indexOf(t);0<=o?n.splice(o,1):n.push(t),e.className=n.join(" ")}},n=function(e){var t,n,o,r,i,a,s,l;t=e,n=window.getComputedStyle(t),o=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),d=t.clientWidth-o,e.querySelector(u).parentNode===e?e.querySelector(u).offsetWidth:0,c=q(e)+f.offsetPixels,y=(r=document,i=window,a=r.compatMode&&"CSS1Compat"===r.compatMode?r.documentElement:r.body,s=a.clientWidth,l=a.clientHeight,i.innerWidth&&s>i.innerWidth&&(s=i.innerWidth,l=i.innerHeight),{width:s,height:l}).width};p.doesItFit=function(t){var o,r,i,a,e=0===t.getAttribute("instance")?e:f.throttleDelay;0,o=function(){var e=t.getAttribute("instance");for(n(t);d<=c&&0<t.querySelector(s).children.length||y<f.breakPoint&&0<t.querySelector(s).children.length;)p.toDropdown(t,e),n(t),y<f.breakPoint&&b(t,e,f.navDropdownBreakpointLabel);for(;d>=v[e][v[e].length-1]&&y>f.breakPoint;)p.toMenu(t,e),y>f.breakPoint&&b(t,e,f.navDropdownLabel);v[e].length<1&&(t.querySelector(u).classList.remove("show"),b(t,e,f.navDropdownLabel)),t.querySelector(s).children.length<1?(t.classList.add("is-empty"),b(t,e,f.navDropdownBreakpointLabel)):t.classList.remove("is-empty"),g(t,e)},r=e,function(){var e=this,t=arguments,n=i&&!a;clearTimeout(a),a=setTimeout(function(){a=null,i||o.apply(e,t)},r),n&&o.apply(e,t)}()};var g=function(e,t){v[t].length<1?(e.querySelector(a).classList.add("priority-nav-is-hidden"),e.querySelector(a).classList.remove("priority-nav-is-visible"),e.classList.remove("priority-nav-has-dropdown"),e.querySelector(".priority-nav__wrapper").setAttribute("aria-haspopup","false")):(e.querySelector(a).classList.add("priority-nav-is-visible"),e.querySelector(a).classList.remove("priority-nav-is-hidden"),e.classList.add("priority-nav-has-dropdown"),e.querySelector(".priority-nav__wrapper").setAttribute("aria-haspopup","true"))},r=function(e,t){e.querySelector(a).setAttribute("priorityNav-count",v[t].length)},b=function(e,t,n){e.querySelector(a).innerHTML=n};p.toDropdown=function(e,t){e.querySelector(u).firstChild&&0<e.querySelector(s).children.length?e.querySelector(u).insertBefore(e.querySelector(s).lastElementChild,e.querySelector(u).firstChild):0<e.querySelector(s).children.length&&e.querySelector(u).appendChild(e.querySelector(s).lastElementChild),v[t].push(c),g(e,t),0<e.querySelector(s).children.length&&f.count&&r(e,t),f.moved()},p.toMenu=function(e,t){0<e.querySelector(u).children.length&&e.querySelector(s).appendChild(e.querySelector(u).firstElementChild),v[t].pop(),g(e,t),0<e.querySelector(s).children.length&&f.count&&r(e,t),f.movedBack()};var q=function(e){for(var t=e.childNodes,n=0,o=0;o<t.length;o++)3!==t[o].nodeType&&(isNaN(t[o].offsetWidth)||(n+=t[o].offsetWidth));return n},L=function(t,n){window.attachEvent?window.attachEvent("onresize",function(){p.doesItFit&&p.doesItFit(t)}):window.addEventListener&&window.addEventListener("resize",function(){p.doesItFit&&p.doesItFit(t)},!0),t.querySelector(a).addEventListener("click",function(){o(t.querySelector(u),"show"),o(this,"is-open"),o(t,"is-open"),-1!==t.className.indexOf("is-open")?t.querySelector(u).setAttribute("aria-hidden","false"):(t.querySelector(u).setAttribute("aria-hidden","true"),t.querySelector(u).blur())}),document.addEventListener("click",function(e){(function(e,t){for(var n=t.charAt(0);e&&e!==document;e=e.parentNode)if("."===n){if(e.classList.contains(t.substr(1)))return e}else if("#"===n){if(e.id===t.substr(1))return e}else if("["===n&&e.hasAttribute(t.substr(1,t.length-2)))return e;return!1})(e.target,"."+n.navDropdownClassName)||e.target===t.querySelector(a)||(t.querySelector(u).classList.remove("show"),t.querySelector(a).classList.remove("is-open"),t.classList.remove("is-open"))}),document.onkeydown=function(e){27===(e=e||window.event).keyCode&&(document.querySelector(u).classList.remove("show"),document.querySelector(a).classList.remove("is-open"),i.classList.remove("is-open"))}};NodeList.prototype.remove=HTMLCollection.prototype.remove=function(){for(var e=0,t=this.length;e<t;e++)this[e]&&this[e].parentElement&&this[e].parentElement.removeChild(this[e])},p.destroy=function(){f&&(document.documentElement.classList.remove(f.initClass),l.remove(),f=null,delete p.init,delete p.doesItFit)},h&&"undefined"!=typeof Node&&(Node.prototype.insertAfter=function(e,t){this.insertBefore(e,t.nextSibling)});var N=function(e){var t=e.charAt(0);return"."!==t&&"#"!==t};return p.init=function(e){var n,o,r;if(o=e||{},r={},S(n=w,function(e,t){r[t]=n[t]}),S(o,function(e,t){r[t]=o[t]}),f=r,h||"undefined"!=typeof Node)if(N(f.navDropdownClassName)&&N(f.navDropdownToggleClassName)){var t=document.querySelectorAll(f.mainNavWrapper);S(t,function(e){var t,n;(v[m]=[],e.setAttribute("instance",m++),i=e)?(s=f.mainNav,e.querySelector(s)?(t=e,n=f,l=document.createElement("span"),u=document.createElement("ul"),(a=document.createElement("button")).innerHTML=n.navDropdownLabel,a.setAttribute("aria-controls","menu"),a.setAttribute("type","button"),u.setAttribute("aria-hidden","true"),t.querySelector(s).parentNode===t?(t.insertAfter(l,t.querySelector(s)),l.appendChild(a),l.appendChild(u),u.classList.add(n.navDropdownClassName),u.classList.add("priority-nav__dropdown"),a.classList.add(n.navDropdownToggleClassName),a.classList.add("priority-nav__dropdown-toggle"),a.setAttribute("type","button"),l.classList.add(n.navDropdownClassName+"-wrapper"),l.classList.add("priority-nav__wrapper"),t.classList.add("priority-nav")):console.warn("mainNav is not a direct child of mainNavWrapper, double check please"),u="."+f.navDropdownClassName,e.querySelector(u)?(a="."+f.navDropdownToggleClassName,e.querySelector(a)?(L(e,f),p.doesItFit(e)):console.warn("couldn't find the specified navDropdownToggle element")):console.warn("couldn't find the specified navDropdown element")):console.warn("couldn't find the specified mainNav element")):console.warn("couldn't find the specified mainNavWrapper element")}),0,document.documentElement.classList.add(f.initClass)}else console.warn("No symbols allowed in navDropdownClassName & navDropdownToggleClassName. These are not selectors.");else console.warn("This browser doesn't support priorityNav")},p});
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "priority-nav",
|
3
3
|
"title": "priority-nav",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.14",
|
5
5
|
"main": "dist/priority-nav.js",
|
6
6
|
"description": "Priority+ pattern navigation that hides menu items if they don't fit on screen.",
|
7
7
|
"homepage": "http://gijsroge.github.io/priority-nav.js/",
|