Comparing version 0.2.3 to 0.2.4
@@ -0,1 +1,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Dropmic = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -282,2 +283,7 @@ | ||
return Dropmic; | ||
}(); | ||
}(); | ||
module.exports = Dropmic; | ||
},{}]},{},[1])(1) | ||
}); |
@@ -8,3 +8,4 @@ "use strict"; | ||
import uglify from 'gulp-uglify'; | ||
import babel from 'gulp-babel'; | ||
import browserify from 'browserify'; | ||
import source from 'vinyl-source-stream'; | ||
@@ -32,7 +33,14 @@ | ||
gulp.task('js', () => { | ||
return gulp.src('src/*.js') | ||
.pipe(babel({ | ||
presets: ['es2015'] | ||
})) | ||
.pipe(gulp.dest('dist')); | ||
return browserify({ | ||
entries: ['./src/dropmic.js'], | ||
standalone: 'Dropmic' | ||
}) | ||
.transform('babelify', { | ||
presets: ['es2015'], | ||
global: true, | ||
ignore: /node_modules/ | ||
}) | ||
.bundle() | ||
.pipe(source('dropmic.js')) | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
@@ -39,0 +47,0 @@ |
{ | ||
"name": "dropmic", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A lightweight dropdown plugin", | ||
@@ -9,3 +9,5 @@ "main": "dist/dropmic.js", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babelify": "^7.3.0", | ||
"browser-sync": "^2.16.0", | ||
"browserify": "^14.1.0", | ||
"gulp": "^3.9.1", | ||
@@ -15,3 +17,4 @@ "gulp-autoprefixer": "^3.1.1", | ||
"gulp-clean-css": "^2.0.12", | ||
"gulp-uglify": "^2.0.0" | ||
"gulp-uglify": "^2.0.0", | ||
"vinyl-source-stream": "^1.1.0" | ||
}, | ||
@@ -18,0 +21,0 @@ "scripts": { |
@@ -50,3 +50,3 @@ const dropmicClassShow = "dropmic--show"; | ||
this.target.addEventListener("keydown", function(event) { | ||
if(event.keyCode === 27) { | ||
if (event.keyCode === 27) { | ||
self.close(); | ||
@@ -63,3 +63,3 @@ self.btn.focus(); | ||
let elementLast = elementList.length - 1; | ||
if(event.keyCode === 9 && document.activeElement === elementList[elementLast]) { | ||
if (event.keyCode === 9 && document.activeElement === elementList[elementLast]) { | ||
event.preventDefault(); | ||
@@ -70,9 +70,9 @@ elementList[0].focus(); | ||
// Arrow Up/Down navigation | ||
if(event.keyCode === 38 || event.keyCode === 40) { | ||
if (event.keyCode === 38 || event.keyCode === 40) { | ||
event.preventDefault(); | ||
let currentItemIndex = self._getCurrentItemIndex(elementList, document.activeElement); | ||
if(currentItemIndex === undefined) { | ||
if (currentItemIndex === undefined) { | ||
elementList[0].focus(); | ||
} else { | ||
if(event.keyCode === 38) { | ||
if (event.keyCode === 38) { | ||
elementList[self._getPreviousItemIndex(elementList, currentItemIndex)].focus(); | ||
@@ -92,3 +92,3 @@ } else { | ||
for (var i = 0; i < list.length; i++) { | ||
if(element === list[i]) { | ||
if (element === list[i]) { | ||
return i; | ||
@@ -101,3 +101,3 @@ } | ||
_getPreviousItemIndex(list, currentItemIndex) { | ||
if(currentItemIndex > 0) { | ||
if (currentItemIndex > 0) { | ||
return currentItemIndex - 1; | ||
@@ -110,3 +110,3 @@ } else { | ||
_getNextItemIndex(list, currentItemIndex) { | ||
if(currentItemIndex === list.length - 1) { | ||
if (currentItemIndex === list.length - 1) { | ||
return 0; | ||
@@ -238,1 +238,3 @@ } else { | ||
} | ||
module.exports = Dropmic; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39572
731
10
12
2