Skip to content

Commit 975570a

Browse files
committed
code styles
1 parent 09439f5 commit 975570a

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "priority-nav",
33
"title": "priority-nav",
4-
"version": "1.0.8",
4+
"version": "1.0.9",
55
"main": [
66
"dist/priority-nav.js",
77
"dist/priority-nav-core.css"

dist/priority-nav.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* priority-nav - v1.0.8 | (c) 2015 @gijsroge | MIT license
2+
* priority-nav - v1.0.9 | (c) 2015 @gijsroge | MIT license
33
* Repository: https://github.com/gijsroge/priority-navigation.git
44
* Description: Priority+ pattern navigation that hides menu items if they don't fit on screen.
55
* Demo: http://gijsroge.github.io/priority-nav.js/
@@ -169,7 +169,8 @@
169169
* Check if dropdown menu is already on page before creating it
170170
* @param mainNavWrapper
171171
*/
172-
var prepareHtml = function (_this) {
172+
var prepareHtml = function (_this, settings) {
173+
173174
/**
174175
* Create dropdow menu
175176
* @type {HTMLElement}
@@ -189,6 +190,7 @@
189190
* Move elements to the right spot
190191
*/
191192
_this.insertAfter(toggleWrapper, _this.querySelector(mainNav));
193+
192194
toggleWrapper.appendChild(navDropdown);
193195
toggleWrapper.appendChild(navDropdownToggle);
194196

@@ -266,7 +268,7 @@
266268
* Move item to array
267269
* @param item
268270
*/
269-
priorityNav.doesItFit = function (_this) {
271+
priorityNav.doesItFit = function (_this, settings) {
270272

271273
/**
272274
* Check if it is the first run
@@ -465,17 +467,17 @@
465467
/**
466468
* Bind eventlisteners
467469
*/
468-
var listeners = function (_this) {
470+
var listeners = function (_this, settings) {
469471

470472
// Check if an item needs to move
471473
if(window.attachEvent) {
472474
window.attachEvent("onresize", function() {
473-
if(priorityNav.doesItFit)priorityNav.doesItFit(_this);
475+
if(priorityNav.doesItFit)priorityNav.doesItFit(_this, settings);
474476
});
475477
}
476478
else if(window.addEventListener) {
477479
window.addEventListener("resize", function() {
478-
if(priorityNav.doesItFit)priorityNav.doesItFit(_this);
480+
if(priorityNav.doesItFit)priorityNav.doesItFit(_this, settings);
479481
}, true);
480482
}
481483

@@ -551,7 +553,9 @@
551553
* @param n
552554
* @param r
553555
*/
554-
Node.prototype.insertAfter = function(n,r) {this.insertBefore(n,r.nextSibling);};
556+
if (supports && typeof Node !== "undefined"){
557+
Node.prototype.insertAfter = function(n,r) {this.insertBefore(n,r.nextSibling);};
558+
}
555559

556560

557561
/**
@@ -561,8 +565,9 @@
561565
*/
562566
priorityNav.init = function (options) {
563567

568+
564569
// Feature test.
565-
if (!supports){
570+
if (!supports && typeof Node === "undefined"){
566571
console.warn("This browser doesn't support priorityNav");
567572
return;
568573
}
@@ -616,7 +621,7 @@
616621
/**
617622
* Check if we need to create the dropdown elements
618623
*/
619-
prepareHtml(_this);
624+
prepareHtml(_this, settings);
620625

621626
/**
622627
* Store the dropdown element
@@ -639,12 +644,12 @@
639644
/**
640645
* Event listeners
641646
*/
642-
listeners(_this);
647+
listeners(_this, settings);
643648

644649
/**
645650
* Start first check
646651
*/
647-
priorityNav.doesItFit(_this);
652+
priorityNav.doesItFit(_this, settings);
648653

649654
});
650655

dist/priority-nav.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "priority-nav",
33
"title": "priority-nav",
4-
"version": "1.0.8",
4+
"version": "1.0.9",
55
"main": "dist/priority-nav.js",
66
"description": "Priority+ pattern navigation that hides menu items if they don't fit on screen.",
77
"homepage": "http://gijsroge.github.io/priority-nav.js/",

src/priority-nav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
var priorityNav = {}; // Object for public APIs
1717
var breaks = []; // Object to store instances with breakpoints where the instances menu item"s didin"t fit.
18-
var supports = !!document.querySelector && !!root.addEventListener // Feature test
18+
var supports = !!document.querySelector && !!root.addEventListener; // Feature test
1919
var settings = {};
2020
var instance = 0;
2121
var count = 0;
@@ -547,7 +547,7 @@
547547
* @param n
548548
* @param r
549549
*/
550-
if (supports && typeof Node !== 'undefined'){
550+
if (supports && typeof Node !== "undefined"){
551551
Node.prototype.insertAfter = function(n,r) {this.insertBefore(n,r.nextSibling);};
552552
}
553553

@@ -561,7 +561,7 @@
561561

562562

563563
// Feature test.
564-
if (!supports && typeof Node === 'undefined'){
564+
if (!supports && typeof Node === "undefined"){
565565
console.warn("This browser doesn't support priorityNav");
566566
return;
567567
}

0 commit comments

Comments
 (0)