glossary-panel
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -11,2 +11,17 @@ ## Welcome! | ||
# Getting started | ||
## Setup | ||
1. Fork and clone the repository. for help, go [here](https://guides.github.com/activities/forking/) | ||
2. Install via npm: | ||
``` | ||
cd glossary | ||
npm install | ||
``` | ||
## Contributing | ||
1. Familiarize yourself with the example in 'glossary/example/' | ||
2. NOTE: In the 'glossary/example' folder [main.js](example/main.js) is compiled via [init.js](example/init.js) in the same folder by Browsersify. | ||
3. See 'Issues' tab in github for suggestions to contribute to | ||
## Public domain | ||
@@ -13,0 +28,0 @@ |
@@ -0,1 +1,3 @@ | ||
//THIS FILE IS GENERATED FROM EXAMPLE/INIT.JS | ||
'use strict'; | ||
@@ -2,0 +4,0 @@ |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "18F Site Glossary Panel", | ||
@@ -11,0 +11,0 @@ "repository": { |
@@ -6,6 +6,13 @@ # Glossary panel | ||
# Getting started | ||
# About | ||
Add a simple glossary panel to your site to help your users understand jargon-y terms. As seen on [betaFEC](https://beta.fec.gov) and [EITI](https://useiti.doi.gov/). | ||
For example: | ||
* https://beta.fec.gov/data/ - click on the book icon in the header | ||
* https://useiti.doi.gov/how-it-works/production/ - click on "fossil fuel" | ||
# Getting started | ||
Note: if you are a contributor, please see [CONTRIBUTING for additional help](CONTRIBUTING.md). | ||
## Download | ||
@@ -18,3 +25,3 @@ ### Via npm | ||
## Set up your HTML | ||
The following is the bare minum HTML needed in your document: | ||
The following is the bare minimum HTML needed in your document: | ||
@@ -28,3 +35,3 @@ ``` | ||
<input id="glossary-search" class="js-glossary-search" type="search" placeholder="e.g. Committee"> | ||
<ul class="js-glossary-search"></ul> | ||
<ul class="js-glossary-list"></ul> | ||
</div> | ||
@@ -31,0 +38,0 @@ ``` |
@@ -82,2 +82,3 @@ 'use strict'; | ||
this.list = this.body.querySelector(this.selectors.listClass); | ||
this.selectedTerm = this.toggleBtn; | ||
@@ -148,5 +149,9 @@ // Initialize state | ||
if (selectorMatches(e.target, '[data-term]')) { | ||
this.show(); | ||
this.show(e); | ||
this.selectedTerm = e.target; | ||
this.findTerm(e.target.getAttribute('data-term')); | ||
} | ||
else { | ||
this.selectedTerm = this.toggleBtn; | ||
} | ||
} | ||
@@ -192,3 +197,3 @@ }; | ||
this.toggleBtn.setAttribute('aria-expanded', 'false'); | ||
this.toggleBtn.focus(); | ||
this.selectedTerm.focus(); | ||
this.isOpen = false; | ||
@@ -195,0 +200,0 @@ removeTabindex(this.body); |
Sorry, the diff of this file is too big to display
132417
3339
112