Comparing version 0.0.2 to 0.0.3
@@ -113,2 +113,4 @@ var keymaster = require('./lib/keymaster.js') | ||
if (!opts) opts = {} | ||
if (opts instanceof HTMLElement) opts = {el: opts} | ||
this.opts = opts | ||
this.el = opts.el || 'nav' | ||
@@ -132,3 +134,3 @@ if (typeof this.el !== 'object') this.el = document.querySelector(this.el) | ||
var self = this | ||
window.addEventListener('keydown', this.onKeyDown.bind(this)) | ||
if (!this.opts.noKeydown) window.addEventListener('keydown', this.onKeyDown.bind(this)) | ||
var list = this.el.querySelectorAll('li') | ||
@@ -142,2 +144,3 @@ list = Array.prototype.slice.call(list); | ||
HUD.prototype.onItemClick = function(ev) { | ||
ev.preventDefault() | ||
var idx = this.toolbarIndexOf(ev.currentTarget) | ||
@@ -144,0 +147,0 @@ if (idx > -1) this.switchToolbar(idx) |
@@ -6,3 +6,3 @@ { | ||
"repository": {"type": "git", "url": "git@github.com:maxogden/toolbar.git"}, | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"dependencies": { | ||
@@ -9,0 +9,0 @@ "inherits": "1.0.0" |
@@ -38,6 +38,6 @@ # toolbar | ||
` | ||
```javascript | ||
var toolbar = require('toolbar') | ||
toolbar('.bar-tab') | ||
` | ||
var bartab = toolbar('.bar-tab') | ||
``` | ||
@@ -49,3 +49,3 @@ use [browserify](http://browserify.org/) to package toolbar for use in your client side app! | ||
```javascript | ||
toolbar.on('select', function(item) { | ||
bartab.on('select', function(item) { | ||
// item is the .tab-label innerText | ||
@@ -52,0 +52,0 @@ }) |
55381
1483