bahai-indexes
Advanced tools
Comparing version 0.8.4 to 0.9.0
# CHANGES to `bahai-indexes` | ||
## 0.9.0 | ||
- feat: add collapse state buttons and parameter to activate | ||
## 0.8.4 | ||
@@ -4,0 +8,0 @@ |
@@ -76,2 +76,8 @@ import {$, httpquery} from './utils.js'; | ||
const adjustCollapseState = (id) => { | ||
const newURL = new URL(location.href); | ||
newURL.searchParams.set('collapse', id); | ||
return newURL.toString(); | ||
}; | ||
const changeSubmitter = ({target}) => { | ||
@@ -82,2 +88,5 @@ const {type, id} = target; | ||
switch (type) { | ||
case 'submit': // Button | ||
newURL = adjustCollapseState(id); | ||
break; | ||
case 'text': | ||
@@ -101,2 +110,10 @@ newURL = storeInput(id); | ||
const collapseSearchEntries = $('#collapseSearchEntries'); | ||
const collapseSearchEntriesPages = $('#collapseSearchEntriesPages'); | ||
const expandAll = $('#expandAll'); | ||
expandAll.addEventListener('click', changeSubmitter); | ||
collapseSearchEntries.addEventListener('click', changeSubmitter); | ||
collapseSearchEntriesPages.addEventListener('click', changeSubmitter); | ||
const indexTermInput = $('#indexTerm'); | ||
@@ -107,2 +124,31 @@ const indexPageInput = $('#indexPage'); | ||
const setCollapseState = () => { | ||
const param = url.searchParams.get('collapse'); | ||
switch (param) { | ||
case 'collapseSearchEntriesPages': | ||
searchEntriesForm.hidden = false; | ||
searchEntriesPagesForm.hidden = true; | ||
collapseSearchEntries.style.display = 'block'; | ||
collapseSearchEntriesPages.style.display = 'none'; | ||
expandAll.hidden = false; | ||
break; | ||
case 'collapseSearchEntries': | ||
searchEntriesForm.hidden = true; | ||
searchEntriesPagesForm.hidden = false; | ||
collapseSearchEntries.style.display = 'none'; | ||
collapseSearchEntriesPages.style.display = 'block'; | ||
expandAll.hidden = false; | ||
break; | ||
// case 'expandAll': | ||
default: | ||
searchEntriesForm.hidden = false; | ||
searchEntriesPagesForm.hidden = false; | ||
collapseSearchEntries.style.display = 'block'; | ||
collapseSearchEntriesPages.style.display = 'block'; | ||
expandAll.hidden = true; | ||
break; | ||
} | ||
}; | ||
const setSelect = (id) => { | ||
@@ -139,2 +185,3 @@ const param = url.searchParams.get(id); | ||
setCollapseState(); | ||
selectMenus.forEach((id) => setSelect(id)); | ||
@@ -141,0 +188,0 @@ selectMenusPages.forEach((id) => setSelect(id)); |
{ | ||
"name": "bahai-indexes", | ||
"type": "module", | ||
"version": "0.8.4", | ||
"version": "0.9.0", | ||
"description": "Indexes to the Bahá'í Writings in JSON form", | ||
@@ -6,0 +6,0 @@ "main": "src/buildFlattenedJSONAndJS.js", |
Sorry, the diff of this file is not supported yet
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
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
2638397
101218