cec-nuxt-lib 0.6.8 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.6.8"
4
+ "version": "0.7.0"
5
5
  }
@@ -5,6 +5,9 @@ import { useState } from '#app';
5
5
  const searchTerm = useState('searchTerm', () => 'Enter keywords:');
6
6
  const showSiteSearch = useState('showSiteSearch');
7
7
 
8
+ const regex =
9
+ /^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
10
+
8
11
  // Cookie control config.
9
12
  const config = {
10
13
  apiKey: 'c1a902dfad207b122cca32738e623af375e1d2ee',
@@ -118,29 +121,49 @@ onMounted(() => {
118
121
  }
119
122
 
120
123
  // Make accordions spring open if there is a hash (looks for an H3)
121
- let hash = window.location.hash;
122
- if (hash) {
123
- hash = hash.toLowerCase().replace(/^#/, '').replace(/_/g, ' ');
124
- Array.from(document.getElementsByTagName('H3'))
125
- .filter((e) => e.innerHTML.toLowerCase().includes(hash))
126
- .forEach((h3, i) => {
127
- let parent = h3.parentNode;
128
- if (parent.tagName === 'ARTICLE') {
129
- let el = parent.previousElementSibling;
130
- let input =
131
- el.tagName === 'LABEL'
132
- ? el.control
133
- : el.tagName === 'INPUT'
134
- ? el
135
- : undefined;
136
- if (input) {
137
- input.checked = true;
138
- if (!i) {
139
- el.scrollIntoView();
124
+ let accordions = document.getElementsByClassName('access-acc-container');
125
+ if (accordions.length) {
126
+ let hash = window.location.hash;
127
+ let found = false;
128
+ if (hash) {
129
+ hash = hash.toLowerCase().replace(/^#/, '').replace(/_/g, ' ');
130
+ Array.from(document.getElementsByTagName('LABEL'))
131
+ .filter((e) => e.innerHTML.toLowerCase().includes(hash))
132
+ .forEach((l, i) => {
133
+ if (l.parentNode.tagName === 'SECTION') {
134
+ let el = l.previousElementSibling;
135
+ if (el.tagName === 'INPUT') {
136
+ el.checked = true;
137
+ if (!i) {
138
+ el.scrollIntoView();
139
+ found = true;
140
+ }
140
141
  }
141
142
  }
142
- }
143
- });
143
+ });
144
+ if (!found) {
145
+ Array.from(document.getElementsByTagName('H3'))
146
+ .filter((e) => e.innerHTML.toLowerCase().includes(hash))
147
+ .forEach((h3, i) => {
148
+ let parent = h3.parentNode;
149
+ if (parent.tagName === 'ARTICLE') {
150
+ let el = parent.previousElementSibling;
151
+ let input =
152
+ el.tagName === 'LABEL'
153
+ ? el.control
154
+ : el.tagName === 'INPUT'
155
+ ? el
156
+ : undefined;
157
+ if (input) {
158
+ input.checked = true;
159
+ if (!i) {
160
+ el.scrollIntoView();
161
+ }
162
+ }
163
+ }
164
+ });
165
+ }
166
+ }
144
167
  }
145
168
 
146
169
  // Canvas stuff
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.8",
2
+ "version": "0.7.0",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",