cec-nuxt-lib 0.6.5 → 0.6.7
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
|
@@ -377,9 +377,9 @@ const makeAddressItem = (prop, text) => {
|
|
|
377
377
|
return `<p class="mb-0" itemprop="${prop}">${text}</p>`;
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
-
|
|
381
|
-
return str.replace('?', '').replace(/\W/g, '-');
|
|
382
|
-
}
|
|
380
|
+
const formatId = (str) => {
|
|
381
|
+
return str.replace('?', '').replace(/\W/g, '-');
|
|
382
|
+
};
|
|
383
383
|
|
|
384
384
|
const makeQuestions = (data, id) => {
|
|
385
385
|
data.question.forEach((qu, j) => {
|
|
@@ -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>
|
|
@@ -117,10 +117,170 @@ onMounted(() => {
|
|
|
117
117
|
console.log('No reachdeck.');
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
+
|
|
121
|
+
// Make accordions spring open if there is a hash (looks for an H3)
|
|
122
|
+
let hash = window.location.hash;
|
|
123
|
+
if (hash) {
|
|
124
|
+
hash = hash.toLowerCase().replace(/^#/, '').replace(/_/g, ' ');
|
|
125
|
+
Array.from(document.getElementsByTagName('H3'))
|
|
126
|
+
.filter((e) => e.innerHTML.toLowerCase().includes(hash))
|
|
127
|
+
.forEach((h3, i) => {
|
|
128
|
+
let parent = h3.parentNode;
|
|
129
|
+
if (parent.tagName === 'ARTICLE') {
|
|
130
|
+
let el = parent.previousElementSibling;
|
|
131
|
+
let input =
|
|
132
|
+
el.tagName === 'LABEL'
|
|
133
|
+
? el.control
|
|
134
|
+
: el.tagName === 'INPUT'
|
|
135
|
+
? el
|
|
136
|
+
: undefined;
|
|
137
|
+
if (input) {
|
|
138
|
+
input.checked = true;
|
|
139
|
+
if (!i) {
|
|
140
|
+
el.scrollIntoView();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Canvas stuff
|
|
148
|
+
const getQuInfo = (b) => {
|
|
149
|
+
let temp = b.id.split('_');
|
|
150
|
+
let id = temp[3];
|
|
151
|
+
let q = questions.value.find((e) => e.id === id);
|
|
152
|
+
if (q) {
|
|
153
|
+
let myQ = q.question[parseInt(temp[4])];
|
|
154
|
+
if (temp.length === 6) {
|
|
155
|
+
let resp = myQ.responseForQuestionComponent[parseInt(temp[5])];
|
|
156
|
+
let content = resp.display;
|
|
157
|
+
let target = resp.id;
|
|
158
|
+
return { content, target, id };
|
|
159
|
+
} else {
|
|
160
|
+
return { q: myQ, id: b.id, divId: id };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const setSelectBehaviour = (e) => {
|
|
166
|
+
let { q, id, divId } = getQuInfo(e);
|
|
167
|
+
let value = document.getElementById(id).value;
|
|
168
|
+
let resp = q.responseForQuestionComponent.find(
|
|
169
|
+
(r) => r.buttonText === value
|
|
170
|
+
);
|
|
171
|
+
let content = resp.display;
|
|
172
|
+
let target = resp.id;
|
|
173
|
+
if (content) {
|
|
174
|
+
display(divId, content);
|
|
175
|
+
} else if (target) {
|
|
176
|
+
goto(divId, target);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const setOnClick = (b) => {
|
|
181
|
+
let { content, target, id } = getQuInfo(b);
|
|
182
|
+
if (content) {
|
|
183
|
+
b.onclick = () => display(id, content);
|
|
184
|
+
} else if (id) {
|
|
185
|
+
b.onclick = () => goto(id, target);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Expand all buttons
|
|
190
|
+
const expandAll = (btn) => {
|
|
191
|
+
btn.addEventListener('click', (e) => {
|
|
192
|
+
const op = btn.innerText;
|
|
193
|
+
btn.innerText = op === 'Expand all' ? 'Close all' : 'Expand all';
|
|
194
|
+
Array.from(document.getElementsByClassName(btn.id)).forEach(
|
|
195
|
+
(e) => (e.checked = op === 'Expand all')
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
Array.from(document.getElementsByClassName('expand-all')).forEach((b) => {
|
|
200
|
+
expandAll(b);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// Forms title & path
|
|
204
|
+
let forms = Array.from(document.querySelectorAll('a')).filter(
|
|
205
|
+
(a) =>
|
|
206
|
+
regex.test(a.href) &&
|
|
207
|
+
a.href !== 'https://digital-core.cheshireeast.gov.uk/w/webpage/register'
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
forms.forEach((link) => {
|
|
211
|
+
link.href = `${link.href}&pageTitle=${encodeURIComponent(
|
|
212
|
+
title.value
|
|
213
|
+
)}&pagePath=${baseUrl.value}${encodeURIComponent(path.value)}`;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const setUpListeners = () => {
|
|
217
|
+
let qSelects = Array.from(
|
|
218
|
+
document.getElementsByClassName('question-select')
|
|
219
|
+
);
|
|
220
|
+
qSelects.forEach((s) => {
|
|
221
|
+
s.onchange = function (e) {
|
|
222
|
+
setSelectBehaviour(e.target);
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
let qBtns = Array.from(document.getElementsByClassName('question-btns'));
|
|
226
|
+
qBtns.forEach((b) => {
|
|
227
|
+
setOnClick(b);
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const goto = (id, index, addToStack = true) => {
|
|
232
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
233
|
+
if (addToStack) {
|
|
234
|
+
qTop.stack.push(index);
|
|
235
|
+
}
|
|
236
|
+
let q = qTop.question[index];
|
|
237
|
+
document.getElementById(id + '_display').innerHTML = q.question;
|
|
238
|
+
document.getElementById(id + '_buttons').innerHTML = q.buttons || q.select;
|
|
239
|
+
setUpListeners();
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const display = (id, display) => {
|
|
243
|
+
console.log();
|
|
244
|
+
document.getElementById(id + '_display').innerHTML = display;
|
|
245
|
+
document.getElementById(id + '_buttons').innerHTML = '';
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const prev = (id) => {
|
|
249
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
250
|
+
let ind = qTop.stack.pop();
|
|
251
|
+
goto(id, ind, !qTop.stack.length);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const reset = (id) => {
|
|
255
|
+
let qTop = questions.value.find((e) => e.id === id);
|
|
256
|
+
if (qTop.stack.length) {
|
|
257
|
+
qTop.stack = [];
|
|
258
|
+
goto(id, 0);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
let resetBtns = Array.from(document.getElementsByClassName('reset'));
|
|
263
|
+
resetBtns.forEach((rb) => {
|
|
264
|
+
let id = rb.id.split('_')[0];
|
|
265
|
+
if (!rb.onclick) {
|
|
266
|
+
rb.onclick = () => reset(id);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
let prevBtns = Array.from(document.getElementsByClassName('previous'));
|
|
271
|
+
prevBtns.forEach((pb) => {
|
|
272
|
+
let id = pb.id.split('_')[0];
|
|
273
|
+
if (!pb.onclick) {
|
|
274
|
+
pb.onclick = () => prev(id);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
setUpListeners();
|
|
278
|
+
});
|
|
120
279
|
</script>
|
|
121
280
|
|
|
122
281
|
<template>
|
|
123
282
|
<div>
|
|
283
|
+
<CecMeta />
|
|
124
284
|
<div class="visually-hidden-focusable overflow-hidden">
|
|
125
285
|
<div class="d-print-none">
|
|
126
286
|
<a
|
|
@@ -256,5 +416,5 @@ onMounted(() => {
|
|
|
256
416
|
</template>
|
|
257
417
|
|
|
258
418
|
<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}
|
|
419
|
+
#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
420
|
</style>
|
package/package.json
CHANGED