cec-nuxt-lib 0.6.6 → 0.6.8
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
|
@@ -761,144 +761,8 @@ canvasHtml = canvasHtml.replace(
|
|
|
761
761
|
return `${p1}${p2.replace(/([.@])/g, '<wbr />$1')}${p3}`;
|
|
762
762
|
}
|
|
763
763
|
);
|
|
764
|
-
|
|
765
|
-
onMounted(() => {
|
|
766
|
-
const getQuInfo = (b) => {
|
|
767
|
-
let temp = b.id.split('_');
|
|
768
|
-
let id = temp[3];
|
|
769
|
-
let q = questions.value.find((e) => e.id === id);
|
|
770
|
-
if (q) {
|
|
771
|
-
let myQ = q.question[parseInt(temp[4])];
|
|
772
|
-
if (temp.length === 6) {
|
|
773
|
-
let resp = myQ.responseForQuestionComponent[parseInt(temp[5])];
|
|
774
|
-
let content = resp.display;
|
|
775
|
-
let target = resp.id;
|
|
776
|
-
return { content, target, id };
|
|
777
|
-
} else {
|
|
778
|
-
return { q: myQ, id: b.id, divId: id };
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
const setSelectBehaviour = (e) => {
|
|
784
|
-
let { q, id, divId } = getQuInfo(e);
|
|
785
|
-
let value = document.getElementById(id).value;
|
|
786
|
-
let resp = q.responseForQuestionComponent.find(
|
|
787
|
-
(r) => r.buttonText === value
|
|
788
|
-
);
|
|
789
|
-
let content = resp.display;
|
|
790
|
-
let target = resp.id;
|
|
791
|
-
if (content) {
|
|
792
|
-
display(divId, content);
|
|
793
|
-
} else if (target) {
|
|
794
|
-
goto(divId, target);
|
|
795
|
-
}
|
|
796
|
-
};
|
|
797
|
-
|
|
798
|
-
const setOnClick = (b) => {
|
|
799
|
-
let { content, target, id } = getQuInfo(b);
|
|
800
|
-
if (content) {
|
|
801
|
-
b.onclick = () => display(id, content);
|
|
802
|
-
} else if (id) {
|
|
803
|
-
b.onclick = () => goto(id, target);
|
|
804
|
-
}
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
// Expand all buttons
|
|
808
|
-
const expandAll = (btn) => {
|
|
809
|
-
btn.addEventListener('click', (e) => {
|
|
810
|
-
const op = btn.innerText;
|
|
811
|
-
btn.innerText = op === 'Expand all' ? 'Close all' : 'Expand all';
|
|
812
|
-
Array.from(document.getElementsByClassName(btn.id)).forEach(
|
|
813
|
-
(e) => (e.checked = op === 'Expand all')
|
|
814
|
-
);
|
|
815
|
-
});
|
|
816
|
-
};
|
|
817
|
-
Array.from(document.getElementsByClassName('expand-all')).forEach((b) => {
|
|
818
|
-
expandAll(b);
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
// Forms title & path
|
|
822
|
-
let forms = Array.from(document.querySelectorAll('a')).filter(
|
|
823
|
-
(a) =>
|
|
824
|
-
regex.test(a.href) &&
|
|
825
|
-
a.href !== 'https://digital-core.cheshireeast.gov.uk/w/webpage/register'
|
|
826
|
-
);
|
|
827
|
-
|
|
828
|
-
forms.forEach((link) => {
|
|
829
|
-
link.href = `${link.href}&pageTitle=${encodeURIComponent(
|
|
830
|
-
title.value
|
|
831
|
-
)}&pagePath=${baseUrl.value}${encodeURIComponent(path.value)}`;
|
|
832
|
-
});
|
|
833
|
-
|
|
834
|
-
const setUpListeners = () => {
|
|
835
|
-
let qSelects = Array.from(
|
|
836
|
-
document.getElementsByClassName('question-select')
|
|
837
|
-
);
|
|
838
|
-
qSelects.forEach((s) => {
|
|
839
|
-
s.onchange = function (e) {
|
|
840
|
-
setSelectBehaviour(e.target);
|
|
841
|
-
};
|
|
842
|
-
});
|
|
843
|
-
let qBtns = Array.from(document.getElementsByClassName('question-btns'));
|
|
844
|
-
qBtns.forEach((b) => {
|
|
845
|
-
setOnClick(b);
|
|
846
|
-
});
|
|
847
|
-
};
|
|
848
|
-
|
|
849
|
-
const goto = (id, index, addToStack = true) => {
|
|
850
|
-
let qTop = questions.value.find((e) => e.id === id);
|
|
851
|
-
if (addToStack) {
|
|
852
|
-
qTop.stack.push(index);
|
|
853
|
-
}
|
|
854
|
-
let q = qTop.question[index];
|
|
855
|
-
document.getElementById(id + '_display').innerHTML = q.question;
|
|
856
|
-
document.getElementById(id + '_buttons').innerHTML = q.buttons || q.select;
|
|
857
|
-
setUpListeners();
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
const display = (id, display) => {
|
|
861
|
-
console.log();
|
|
862
|
-
document.getElementById(id + '_display').innerHTML = display;
|
|
863
|
-
document.getElementById(id + '_buttons').innerHTML = '';
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
const prev = (id) => {
|
|
867
|
-
let qTop = questions.value.find((e) => e.id === id);
|
|
868
|
-
let ind = qTop.stack.pop();
|
|
869
|
-
goto(id, ind, !qTop.stack.length);
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
const reset = (id) => {
|
|
873
|
-
let qTop = questions.value.find((e) => e.id === id);
|
|
874
|
-
if (qTop.stack.length) {
|
|
875
|
-
qTop.stack = [];
|
|
876
|
-
goto(id, 0);
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
|
|
880
|
-
let resetBtns = Array.from(document.getElementsByClassName('reset'));
|
|
881
|
-
resetBtns.forEach((rb) => {
|
|
882
|
-
let id = rb.id.split('_')[0];
|
|
883
|
-
if (!rb.onclick) {
|
|
884
|
-
rb.onclick = () => reset(id);
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
let prevBtns = Array.from(document.getElementsByClassName('previous'));
|
|
889
|
-
prevBtns.forEach((pb) => {
|
|
890
|
-
let id = pb.id.split('_')[0];
|
|
891
|
-
if (!pb.onclick) {
|
|
892
|
-
pb.onclick = () => prev(id);
|
|
893
|
-
}
|
|
894
|
-
});
|
|
895
|
-
setUpListeners();
|
|
896
|
-
});
|
|
897
764
|
</script>
|
|
898
765
|
|
|
899
766
|
<template>
|
|
900
767
|
<div v-html="canvasHtml"></div>
|
|
901
768
|
</template>
|
|
902
|
-
<style type="text/css" scoped>
|
|
903
|
-
:deep(select){font-size:1.2rem;max-width:20rem}:deep(fieldset){border:1px solid #000}:deep(legend){float:none;font-size:1.5rem;margin-left:20px;width:auto}:deep(button.carousel-control-prev:focus,button.carousel-control-next:focus){border:4px solid #000!important}:deep(.icon-wrapper){background-color:#000;border-radius:10px;padding-top:.5rem;width:50px}:deep(.carousel-indicators){margin-bottom:.5rem}:deep(.carousel-indicators [data-bs-target].active){color:blue;font-weight:600}:deep(.carousel-indicators [data-bs-target]){background-clip:unset;background-color:#fff;border-radius:10px;cursor:pointer;height:unset;margin-bottom:0;margin-left:3px;margin-right:3px;opacity:.7;text-indent:unset;transition:opacity .6s ease;width:40px}@media (min-width:769px){:deep(#overlay){border-radius:10px!important}}@media (max-width:768px){:deep(#overlay){border-radius:none}}
|
|
904
|
-
</style>
|
|
@@ -116,11 +116,170 @@ onMounted(() => {
|
|
|
116
116
|
} catch (ignore) {
|
|
117
117
|
console.log('No reachdeck.');
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
// 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();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Canvas stuff
|
|
147
|
+
const getQuInfo = (b) => {
|
|
148
|
+
let temp = b.id.split('_');
|
|
149
|
+
let id = temp[3];
|
|
150
|
+
let q = questions.value.find((e) => e.id === id);
|
|
151
|
+
if (q) {
|
|
152
|
+
let myQ = q.question[parseInt(temp[4])];
|
|
153
|
+
if (temp.length === 6) {
|
|
154
|
+
let resp = myQ.responseForQuestionComponent[parseInt(temp[5])];
|
|
155
|
+
let content = resp.display;
|
|
156
|
+
let target = resp.id;
|
|
157
|
+
return { content, target, id };
|
|
158
|
+
} else {
|
|
159
|
+
return { q: myQ, id: b.id, divId: id };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const setSelectBehaviour = (e) => {
|
|
165
|
+
let { q, id, divId } = getQuInfo(e);
|
|
166
|
+
let value = document.getElementById(id).value;
|
|
167
|
+
let resp = q.responseForQuestionComponent.find(
|
|
168
|
+
(r) => r.buttonText === value
|
|
169
|
+
);
|
|
170
|
+
let content = resp.display;
|
|
171
|
+
let target = resp.id;
|
|
172
|
+
if (content) {
|
|
173
|
+
display(divId, content);
|
|
174
|
+
} else if (target) {
|
|
175
|
+
goto(divId, target);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const setOnClick = (b) => {
|
|
180
|
+
let { content, target, id } = getQuInfo(b);
|
|
181
|
+
if (content) {
|
|
182
|
+
b.onclick = () => display(id, content);
|
|
183
|
+
} else if (id) {
|
|
184
|
+
b.onclick = () => goto(id, target);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Expand all buttons
|
|
189
|
+
const expandAll = (btn) => {
|
|
190
|
+
btn.addEventListener('click', (e) => {
|
|
191
|
+
const op = btn.innerText;
|
|
192
|
+
btn.innerText = op === 'Expand all' ? 'Close all' : 'Expand all';
|
|
193
|
+
Array.from(document.getElementsByClassName(btn.id)).forEach(
|
|
194
|
+
(e) => (e.checked = op === 'Expand all')
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
Array.from(document.getElementsByClassName('expand-all')).forEach((b) => {
|
|
199
|
+
expandAll(b);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// Forms title & path
|
|
203
|
+
let forms = Array.from(document.querySelectorAll('a')).filter(
|
|
204
|
+
(a) =>
|
|
205
|
+
regex.test(a.href) &&
|
|
206
|
+
a.href !== 'https://digital-core.cheshireeast.gov.uk/w/webpage/register'
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
forms.forEach((link) => {
|
|
210
|
+
link.href = `${link.href}&pageTitle=${encodeURIComponent(
|
|
211
|
+
title.value
|
|
212
|
+
)}&pagePath=${baseUrl.value}${encodeURIComponent(path.value)}`;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
const setUpListeners = () => {
|
|
216
|
+
let qSelects = Array.from(
|
|
217
|
+
document.getElementsByClassName('question-select')
|
|
218
|
+
);
|
|
219
|
+
qSelects.forEach((s) => {
|
|
220
|
+
s.onchange = function (e) {
|
|
221
|
+
setSelectBehaviour(e.target);
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
let qBtns = Array.from(document.getElementsByClassName('question-btns'));
|
|
225
|
+
qBtns.forEach((b) => {
|
|
226
|
+
setOnClick(b);
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const goto = (id, index, addToStack = true) => {
|
|
231
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
232
|
+
if (addToStack) {
|
|
233
|
+
qTop.stack.push(index);
|
|
234
|
+
}
|
|
235
|
+
let q = qTop.question[index];
|
|
236
|
+
document.getElementById(id + '_display').innerHTML = q.question;
|
|
237
|
+
document.getElementById(id + '_buttons').innerHTML = q.buttons || q.select;
|
|
238
|
+
setUpListeners();
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const display = (id, display) => {
|
|
242
|
+
console.log();
|
|
243
|
+
document.getElementById(id + '_display').innerHTML = display;
|
|
244
|
+
document.getElementById(id + '_buttons').innerHTML = '';
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const prev = (id) => {
|
|
248
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
249
|
+
let ind = qTop.stack.pop();
|
|
250
|
+
goto(id, ind, !qTop.stack.length);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const reset = (id) => {
|
|
254
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
255
|
+
if (qTop.stack.length) {
|
|
256
|
+
qTop.stack = [];
|
|
257
|
+
goto(id, 0);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
let resetBtns = Array.from(document.getElementsByClassName('reset'));
|
|
262
|
+
resetBtns.forEach((rb) => {
|
|
263
|
+
let id = rb.id.split('_')[0];
|
|
264
|
+
if (!rb.onclick) {
|
|
265
|
+
rb.onclick = () => reset(id);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
let prevBtns = Array.from(document.getElementsByClassName('previous'));
|
|
270
|
+
prevBtns.forEach((pb) => {
|
|
271
|
+
let id = pb.id.split('_')[0];
|
|
272
|
+
if (!pb.onclick) {
|
|
273
|
+
pb.onclick = () => prev(id);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
setUpListeners();
|
|
119
277
|
});
|
|
120
278
|
</script>
|
|
121
279
|
|
|
122
280
|
<template>
|
|
123
281
|
<div>
|
|
282
|
+
<CecMeta />
|
|
124
283
|
<div class="visually-hidden-focusable overflow-hidden">
|
|
125
284
|
<div class="d-print-none">
|
|
126
285
|
<a
|
|
@@ -256,5 +415,5 @@ onMounted(() => {
|
|
|
256
415
|
</template>
|
|
257
416
|
|
|
258
417
|
<style scoped>
|
|
259
|
-
#SearchQueryControl_SearchButton,#SearchQueryControl_SearchButton:active,#SearchQueryControl_SearchButton:visited{background-color:#206c49;border-color:#206c49;border-radius:.25rem;color:#fff;cursor:pointer;font-size:1rem;font-weight:700;margin-left:.5rem!important;padding:.375rem .75rem;text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;vertical-align:middle;width:100px}#SearchQueryControl_SearchButton:hover{background-color:#1c5e41;border-color:#1c5e41}
|
|
418
|
+
#SearchQueryControl_SearchButton,#SearchQueryControl_SearchButton:active,#SearchQueryControl_SearchButton:visited{background-color:#206c49;border-color:#206c49;border-radius:.25rem;color:#fff;cursor:pointer;font-size:1rem;font-weight:700;margin-left:.5rem!important;padding:.375rem .75rem;text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;vertical-align:middle;width:100px}#SearchQueryControl_SearchButton:hover{background-color:#1c5e41;border-color:#1c5e41}:deep(select){font-size:1.2rem;max-width:20rem}:deep(fieldset){border:1px solid #000}:deep(legend){float:none;font-size:1.5rem;margin-left:20px;width:auto}:deep(button.carousel-control-prev:focus,button.carousel-control-next:focus){border:4px solid #000!important}:deep(.icon-wrapper){background-color:#000;border-radius:10px;padding-top:.5rem;width:50px}:deep(.carousel-indicators){margin-bottom:.5rem}:deep(.carousel-indicators [data-bs-target].active){color:blue;font-weight:600}:deep(.carousel-indicators [data-bs-target]){background-clip:unset;background-color:#fff;border-radius:10px;cursor:pointer;height:unset;margin-bottom:0;margin-left:3px;margin-right:3px;opacity:.7;text-indent:unset;transition:opacity .6s ease;width:40px}@media (min-width:769px){:deep(#overlay){border-radius:10px!important}}@media (max-width:768px){:deep(#overlay){border-radius:none}}
|
|
260
419
|
</style>
|
package/package.json
CHANGED