cec-nuxt-lib 0.7.0 → 0.7.1

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.7.0"
4
+ "version": "0.7.1"
5
5
  }
@@ -32,9 +32,6 @@ const sizeString = (n) => {
32
32
  }
33
33
  };
34
34
 
35
- const regex =
36
- /^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
37
-
38
35
  const abbr = (data) => {
39
36
  return `<abbr title="${text(data.entryDescription)}">${text(data.entryTitle)}</abbr>`;
40
37
  };
@@ -127,41 +127,37 @@ onMounted(() => {
127
127
  let found = false;
128
128
  if (hash) {
129
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
- }
141
- }
142
- }
143
- });
130
+ let l = Array.from(document.getElementsByTagName('LABEL')).filter((e) =>
131
+ e.innerText.toLowerCase().includes(hash)
132
+ );
133
+ if (l.length && l[0].parentNode.tagName === 'SECTION') {
134
+ let el = l[0].previousElementSibling;
135
+ if (el.tagName === 'INPUT') {
136
+ el.checked = true;
137
+ el.scrollIntoView();
138
+ found = true;
139
+ }
140
+ }
144
141
  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
- }
142
+ let h3s = Array.from(document.getElementsByTagName('H3')).filter((e) =>
143
+ e.innerHTML.toLowerCase().includes(hash)
144
+ );
145
+ if (h3s) {
146
+ let parent = h3s[0].parentNode;
147
+ if (parent.tagName === 'ARTICLE') {
148
+ let el = parent.previousElementSibling;
149
+ let input =
150
+ el.tagName === 'LABEL'
151
+ ? el.control
152
+ : el.tagName === 'INPUT'
153
+ ? el
154
+ : undefined;
155
+ if (input) {
156
+ input.checked = true;
157
+ el.scrollIntoView();
163
158
  }
164
- });
159
+ }
160
+ }
165
161
  }
166
162
  }
167
163
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.0",
2
+ "version": "0.7.1",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",