@pageboard/html 0.10.23 → 0.10.24
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/elements/consent.js +18 -4
- package/elements/embed.js +4 -0
- package/lib/nouislider.js +112 -11
- package/package.json +1 -1
- package/ui/consent.js +25 -26
- package/ui/embed.js +3 -2
package/elements/consent.js
CHANGED
|
@@ -26,20 +26,28 @@ exports.consent_form = {
|
|
|
26
26
|
stylesheets: ['../ui/consent.css']
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
const consents = [];
|
|
30
|
+
|
|
29
31
|
exports.input_radio_yes = {
|
|
30
32
|
title: 'Yes',
|
|
31
33
|
icon: '<i class="thumbs up icon"></i>',
|
|
32
34
|
menu: "form",
|
|
33
35
|
group: "block",
|
|
34
36
|
context: 'consent_form//',
|
|
37
|
+
properties: {
|
|
38
|
+
consent: {
|
|
39
|
+
title: 'Consent',
|
|
40
|
+
anyOf: consents
|
|
41
|
+
}
|
|
42
|
+
},
|
|
35
43
|
contents: {
|
|
36
44
|
id: 'label',
|
|
37
45
|
nodes: 'inline*'
|
|
38
46
|
},
|
|
39
47
|
html: `<div class="field">
|
|
40
48
|
<div class="ui radio checkbox">
|
|
41
|
-
<input type="radio" name="consent" value="yes" id="for-consent-yes" />
|
|
42
|
-
<label block-content="label" for="for-consent-yes">Yes</label>
|
|
49
|
+
<input type="radio" name="consent.[consent]" value="yes" id="for-consent-yes-[consent]" />
|
|
50
|
+
<label block-content="label" for="for-consent-yes-[consent]">Yes</label>
|
|
43
51
|
</div>
|
|
44
52
|
</div>`
|
|
45
53
|
};
|
|
@@ -50,14 +58,20 @@ exports.input_radio_no = {
|
|
|
50
58
|
menu: "form",
|
|
51
59
|
group: "block",
|
|
52
60
|
context: 'consent_form//',
|
|
61
|
+
properties: {
|
|
62
|
+
consent: {
|
|
63
|
+
title: 'Consent',
|
|
64
|
+
anyOf: consents
|
|
65
|
+
}
|
|
66
|
+
},
|
|
53
67
|
contents: {
|
|
54
68
|
id: 'label',
|
|
55
69
|
nodes: 'inline*'
|
|
56
70
|
},
|
|
57
71
|
html: `<div class="field">
|
|
58
72
|
<div class="ui radio checkbox">
|
|
59
|
-
<input type="radio" name="consent" value="no" id="for-consent-no" />
|
|
60
|
-
<label block-content="label" for="for-consent-no">No</label>
|
|
73
|
+
<input type="radio" name="consent.[consent]" value="no" id="for-consent-no-[consent]" />
|
|
74
|
+
<label block-content="label" for="for-consent-no-[consent]">No</label>
|
|
61
75
|
</div>
|
|
62
76
|
</div>`
|
|
63
77
|
};
|
package/elements/embed.js
CHANGED
package/lib/nouislider.js
CHANGED
|
@@ -713,7 +713,9 @@
|
|
|
713
713
|
var snap = entry.indexOf("snap") >= 0;
|
|
714
714
|
var hover = entry.indexOf("hover") >= 0;
|
|
715
715
|
var unconstrained = entry.indexOf("unconstrained") >= 0;
|
|
716
|
+
var invertConnects = entry.indexOf("invert-connects") >= 0;
|
|
716
717
|
var dragAll = entry.indexOf("drag-all") >= 0;
|
|
718
|
+
var smoothSteps = entry.indexOf("smooth-steps") >= 0;
|
|
717
719
|
if (fixed) {
|
|
718
720
|
if (parsed.handles !== 2) {
|
|
719
721
|
throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");
|
|
@@ -721,6 +723,9 @@
|
|
|
721
723
|
// Use margin to enforce fixed state
|
|
722
724
|
testMargin(parsed, parsed.start[1] - parsed.start[0]);
|
|
723
725
|
}
|
|
726
|
+
if (invertConnects && parsed.handles !== 2) {
|
|
727
|
+
throw new Error("noUiSlider: 'invert-connects' behaviour must be used with 2 handles");
|
|
728
|
+
}
|
|
724
729
|
if (unconstrained && (parsed.margin || parsed.limit)) {
|
|
725
730
|
throw new Error("noUiSlider: 'unconstrained' behaviour cannot be used with margin or limit");
|
|
726
731
|
}
|
|
@@ -728,10 +733,12 @@
|
|
|
728
733
|
tap: tap || snap,
|
|
729
734
|
drag: drag,
|
|
730
735
|
dragAll: dragAll,
|
|
736
|
+
smoothSteps: smoothSteps,
|
|
731
737
|
fixed: fixed,
|
|
732
738
|
snap: snap,
|
|
733
739
|
hover: hover,
|
|
734
740
|
unconstrained: unconstrained,
|
|
741
|
+
invertConnects: invertConnects,
|
|
735
742
|
};
|
|
736
743
|
}
|
|
737
744
|
function testTooltips(parsed, entry) {
|
|
@@ -902,6 +909,7 @@
|
|
|
902
909
|
// Slider DOM Nodes
|
|
903
910
|
var scope_Target = target;
|
|
904
911
|
var scope_Base;
|
|
912
|
+
var scope_ConnectBase;
|
|
905
913
|
var scope_Handles;
|
|
906
914
|
var scope_Connects;
|
|
907
915
|
var scope_Pips;
|
|
@@ -913,6 +921,7 @@
|
|
|
913
921
|
var scope_HandleNumbers = [];
|
|
914
922
|
var scope_ActiveHandlesCount = 0;
|
|
915
923
|
var scope_Events = {};
|
|
924
|
+
var scope_ConnectsInverted = false;
|
|
916
925
|
// Document Nodes
|
|
917
926
|
var scope_Document = target.ownerDocument;
|
|
918
927
|
var scope_DocumentElement = options.documentElement || scope_Document.documentElement;
|
|
@@ -957,6 +966,7 @@
|
|
|
957
966
|
else if (handleNumber === options.handles - 1) {
|
|
958
967
|
addClass(handle, options.cssClasses.handleUpper);
|
|
959
968
|
}
|
|
969
|
+
origin.handle = handle;
|
|
960
970
|
return origin;
|
|
961
971
|
}
|
|
962
972
|
// Insert nodes for connect elements
|
|
@@ -968,17 +978,17 @@
|
|
|
968
978
|
}
|
|
969
979
|
// Add handles to the slider base.
|
|
970
980
|
function addElements(connectOptions, base) {
|
|
971
|
-
|
|
981
|
+
scope_ConnectBase = addNodeTo(base, options.cssClasses.connects);
|
|
972
982
|
scope_Handles = [];
|
|
973
983
|
scope_Connects = [];
|
|
974
|
-
scope_Connects.push(addConnect(
|
|
984
|
+
scope_Connects.push(addConnect(scope_ConnectBase, connectOptions[0]));
|
|
975
985
|
// [::::O====O====O====]
|
|
976
986
|
// connectOptions = [0, 1, 1, 1]
|
|
977
987
|
for (var i = 0; i < options.handles; i++) {
|
|
978
988
|
// Keep a list of all added handles.
|
|
979
989
|
scope_Handles.push(addOrigin(base, i));
|
|
980
990
|
scope_HandleNumbers[i] = i;
|
|
981
|
-
scope_Connects.push(addConnect(
|
|
991
|
+
scope_Connects.push(addConnect(scope_ConnectBase, connectOptions[i + 1]));
|
|
982
992
|
}
|
|
983
993
|
}
|
|
984
994
|
// Initialize a single slider.
|
|
@@ -1020,6 +1030,31 @@
|
|
|
1020
1030
|
var handleOrigin = scope_Handles[handleNumber];
|
|
1021
1031
|
return handleOrigin.hasAttribute("disabled");
|
|
1022
1032
|
}
|
|
1033
|
+
function disable(handleNumber) {
|
|
1034
|
+
if (handleNumber !== null && handleNumber !== undefined) {
|
|
1035
|
+
scope_Handles[handleNumber].setAttribute("disabled", "");
|
|
1036
|
+
scope_Handles[handleNumber].handle.removeAttribute("tabindex");
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
scope_Target.setAttribute("disabled", "");
|
|
1040
|
+
scope_Handles.forEach(function (handle) {
|
|
1041
|
+
handle.handle.removeAttribute("tabindex");
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function enable(handleNumber) {
|
|
1046
|
+
if (handleNumber !== null && handleNumber !== undefined) {
|
|
1047
|
+
scope_Handles[handleNumber].removeAttribute("disabled");
|
|
1048
|
+
scope_Handles[handleNumber].handle.setAttribute("tabindex", "0");
|
|
1049
|
+
}
|
|
1050
|
+
else {
|
|
1051
|
+
scope_Target.removeAttribute("disabled");
|
|
1052
|
+
scope_Handles.forEach(function (handle) {
|
|
1053
|
+
handle.removeAttribute("disabled");
|
|
1054
|
+
handle.handle.setAttribute("tabindex", "0");
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1023
1058
|
function removeTooltips() {
|
|
1024
1059
|
if (scope_Tooltips) {
|
|
1025
1060
|
removeEvent("update" + INTERNAL_EVENT_NS.tooltips);
|
|
@@ -1472,6 +1507,14 @@
|
|
|
1472
1507
|
scope_Body.removeEventListener("selectstart", preventDefault);
|
|
1473
1508
|
}
|
|
1474
1509
|
}
|
|
1510
|
+
if (options.events.smoothSteps) {
|
|
1511
|
+
data.handleNumbers.forEach(function (handleNumber) {
|
|
1512
|
+
setHandle(handleNumber, scope_Locations[handleNumber], true, true, false, false);
|
|
1513
|
+
});
|
|
1514
|
+
data.handleNumbers.forEach(function (handleNumber) {
|
|
1515
|
+
fireEvent("update", handleNumber);
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1475
1518
|
data.handleNumbers.forEach(function (handleNumber) {
|
|
1476
1519
|
fireEvent("change", handleNumber);
|
|
1477
1520
|
fireEvent("set", handleNumber);
|
|
@@ -1771,7 +1814,7 @@
|
|
|
1771
1814
|
});
|
|
1772
1815
|
}
|
|
1773
1816
|
// Split out the handle positioning logic so the Move event can use it, too
|
|
1774
|
-
function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {
|
|
1817
|
+
function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue, smoothSteps) {
|
|
1775
1818
|
var distance;
|
|
1776
1819
|
// For sliders with multiple handles, limit movement to the other handle.
|
|
1777
1820
|
// Apply the margin option by adding it to the handle positions.
|
|
@@ -1810,7 +1853,9 @@
|
|
|
1810
1853
|
to = Math.min(to, distance);
|
|
1811
1854
|
}
|
|
1812
1855
|
}
|
|
1813
|
-
|
|
1856
|
+
if (!smoothSteps) {
|
|
1857
|
+
to = scope_Spectrum.getStep(to);
|
|
1858
|
+
}
|
|
1814
1859
|
// Limit percentage to the 0 - 100 range
|
|
1815
1860
|
to = limit(to);
|
|
1816
1861
|
// Return false if handle can't move
|
|
@@ -1830,6 +1875,7 @@
|
|
|
1830
1875
|
var proposals = locations.slice();
|
|
1831
1876
|
// Store first handle now, so we still have it in case handleNumbers is reversed
|
|
1832
1877
|
var firstHandle = handleNumbers[0];
|
|
1878
|
+
var smoothSteps = options.events.smoothSteps;
|
|
1833
1879
|
var b = [!upward, upward];
|
|
1834
1880
|
var f = [upward, !upward];
|
|
1835
1881
|
// Copy handleNumbers so we don't change the dataset
|
|
@@ -1842,7 +1888,7 @@
|
|
|
1842
1888
|
// Step 1: get the maximum percentage that any of the handles can move
|
|
1843
1889
|
if (handleNumbers.length > 1) {
|
|
1844
1890
|
handleNumbers.forEach(function (handleNumber, o) {
|
|
1845
|
-
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false);
|
|
1891
|
+
var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false, smoothSteps);
|
|
1846
1892
|
// Stop if one of the handles can't move.
|
|
1847
1893
|
if (to === false) {
|
|
1848
1894
|
proposal = 0;
|
|
@@ -1860,7 +1906,8 @@
|
|
|
1860
1906
|
var state = false;
|
|
1861
1907
|
// Step 2: Try to set the handles with the found percentage
|
|
1862
1908
|
handleNumbers.forEach(function (handleNumber, o) {
|
|
1863
|
-
state =
|
|
1909
|
+
state =
|
|
1910
|
+
setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o], false, smoothSteps) || state;
|
|
1864
1911
|
});
|
|
1865
1912
|
// Step 3: If a handle moved, fire events
|
|
1866
1913
|
if (state) {
|
|
@@ -1890,8 +1937,26 @@
|
|
|
1890
1937
|
var translation = transformDirection(to, 0) - scope_DirOffset;
|
|
1891
1938
|
var translateRule = "translate(" + inRuleOrder(translation + "%", "0") + ")";
|
|
1892
1939
|
scope_Handles[handleNumber].style[options.transformRule] = translateRule;
|
|
1940
|
+
// sanity check for at least 2 handles (e.g. during setup)
|
|
1941
|
+
if (options.events.invertConnects && scope_Locations.length > 1) {
|
|
1942
|
+
// check if handles passed each other, but don't match the ConnectsInverted state
|
|
1943
|
+
var handlesAreInOrder = scope_Locations.every(function (position, index, locations) {
|
|
1944
|
+
return index === 0 || position >= locations[index - 1];
|
|
1945
|
+
});
|
|
1946
|
+
if (scope_ConnectsInverted !== !handlesAreInOrder) {
|
|
1947
|
+
// invert connects when handles pass each other
|
|
1948
|
+
invertConnects();
|
|
1949
|
+
// invertConnects already updates all connect elements
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1893
1953
|
updateConnect(handleNumber);
|
|
1894
1954
|
updateConnect(handleNumber + 1);
|
|
1955
|
+
if (scope_ConnectsInverted) {
|
|
1956
|
+
// When connects are inverted, we also have to update adjacent connects
|
|
1957
|
+
updateConnect(handleNumber - 1);
|
|
1958
|
+
updateConnect(handleNumber + 2);
|
|
1959
|
+
}
|
|
1895
1960
|
}
|
|
1896
1961
|
// Handles before the slider middle are stacked later = higher,
|
|
1897
1962
|
// Handles after the middle later is lower
|
|
@@ -1905,9 +1970,9 @@
|
|
|
1905
1970
|
}
|
|
1906
1971
|
// Test suggested values and apply margin, step.
|
|
1907
1972
|
// if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
|
|
1908
|
-
function setHandle(handleNumber, to, lookBackward, lookForward, exactInput) {
|
|
1973
|
+
function setHandle(handleNumber, to, lookBackward, lookForward, exactInput, smoothSteps) {
|
|
1909
1974
|
if (!exactInput) {
|
|
1910
|
-
to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);
|
|
1975
|
+
to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false, smoothSteps);
|
|
1911
1976
|
}
|
|
1912
1977
|
if (to === false) {
|
|
1913
1978
|
return false;
|
|
@@ -1921,13 +1986,20 @@
|
|
|
1921
1986
|
if (!scope_Connects[index]) {
|
|
1922
1987
|
return;
|
|
1923
1988
|
}
|
|
1989
|
+
// Create a copy of locations, so we can sort them for the local scope logic
|
|
1990
|
+
var locations = scope_Locations.slice();
|
|
1991
|
+
if (scope_ConnectsInverted) {
|
|
1992
|
+
locations.sort(function (a, b) {
|
|
1993
|
+
return a - b;
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1924
1996
|
var l = 0;
|
|
1925
1997
|
var h = 100;
|
|
1926
1998
|
if (index !== 0) {
|
|
1927
|
-
l =
|
|
1999
|
+
l = locations[index - 1];
|
|
1928
2000
|
}
|
|
1929
2001
|
if (index !== scope_Connects.length - 1) {
|
|
1930
|
-
h =
|
|
2002
|
+
h = locations[index];
|
|
1931
2003
|
}
|
|
1932
2004
|
// We use two rules:
|
|
1933
2005
|
// 'translate' to change the left/top offset;
|
|
@@ -2119,6 +2191,7 @@
|
|
|
2119
2191
|
"format",
|
|
2120
2192
|
"pips",
|
|
2121
2193
|
"tooltips",
|
|
2194
|
+
"connect",
|
|
2122
2195
|
];
|
|
2123
2196
|
// Only change options that we're actually passed to update.
|
|
2124
2197
|
updateAble.forEach(function (name) {
|
|
@@ -2156,6 +2229,32 @@
|
|
|
2156
2229
|
// Invalidate the current positioning so valueSet forces an update.
|
|
2157
2230
|
scope_Locations = [];
|
|
2158
2231
|
valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);
|
|
2232
|
+
// Update connects only if it was set
|
|
2233
|
+
if (optionsToUpdate.connect) {
|
|
2234
|
+
updateConnectOption();
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
function updateConnectOption() {
|
|
2238
|
+
// IE supported way of removing children including event handlers
|
|
2239
|
+
while (scope_ConnectBase.firstChild) {
|
|
2240
|
+
scope_ConnectBase.removeChild(scope_ConnectBase.firstChild);
|
|
2241
|
+
}
|
|
2242
|
+
// Adding new connects according to the new connect options
|
|
2243
|
+
for (var i = 0; i <= options.handles; i++) {
|
|
2244
|
+
scope_Connects[i] = addConnect(scope_ConnectBase, options.connect[i]);
|
|
2245
|
+
updateConnect(i);
|
|
2246
|
+
}
|
|
2247
|
+
// re-adding drag events for the new connect elements
|
|
2248
|
+
// to ignore the other events we have to negate the 'if (!behaviour.fixed)' check
|
|
2249
|
+
bindSliderEvents({ drag: options.events.drag, fixed: true });
|
|
2250
|
+
}
|
|
2251
|
+
// Invert options for connect handles
|
|
2252
|
+
function invertConnects() {
|
|
2253
|
+
scope_ConnectsInverted = !scope_ConnectsInverted;
|
|
2254
|
+
testConnect(options,
|
|
2255
|
+
// inverse the connect boolean array
|
|
2256
|
+
options.connect.map(function (b) { return !b; }));
|
|
2257
|
+
updateConnectOption();
|
|
2159
2258
|
}
|
|
2160
2259
|
// Initialization steps
|
|
2161
2260
|
function setupSlider() {
|
|
@@ -2185,6 +2284,8 @@
|
|
|
2185
2284
|
set: valueSet,
|
|
2186
2285
|
setHandle: valueSetHandle,
|
|
2187
2286
|
reset: valueReset,
|
|
2287
|
+
disable: disable,
|
|
2288
|
+
enable: enable,
|
|
2188
2289
|
// Exposed for unit testing, don't use this in your application.
|
|
2189
2290
|
__moveHandles: function (upward, proposal, handleNumbers) {
|
|
2190
2291
|
moveHandles(upward, proposal, scope_Locations, handleNumbers);
|
package/package.json
CHANGED
package/ui/consent.js
CHANGED
|
@@ -27,21 +27,17 @@ class HTMLCustomConsentElement extends HTMLFormElement {
|
|
|
27
27
|
state.consent(this);
|
|
28
28
|
}
|
|
29
29
|
chainConsent(state) {
|
|
30
|
-
window.HTMLCustomFormElement.prototype.fill.call(this,
|
|
31
|
-
consent: state.scope.$consent
|
|
32
|
-
});
|
|
30
|
+
window.HTMLCustomFormElement.prototype.fill.call(this, state.scope.$consent);
|
|
33
31
|
if (this.options.transient) this.classList.remove('visible');
|
|
34
32
|
}
|
|
35
33
|
handleSubmit(e, state) {
|
|
36
34
|
if (e.type == "submit") e.preventDefault();
|
|
37
35
|
if (this.isContentEditable) return;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
return;
|
|
36
|
+
const consents = window.HTMLCustomFormElement.prototype.read.call(this);
|
|
37
|
+
for (const [key, val] of Object.entries(consents)) {
|
|
38
|
+
Page.storage.set('consent.' + key, val);
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
state.scope.$consent = consent;
|
|
40
|
+
state.scope.$consent = consents;
|
|
45
41
|
state.runChain('consent');
|
|
46
42
|
}
|
|
47
43
|
handleChange(e, state) {
|
|
@@ -67,29 +63,32 @@ Page.ready(() => {
|
|
|
67
63
|
VirtualHTMLElement.define(`element-consent`, HTMLCustomConsentElement, 'form');
|
|
68
64
|
});
|
|
69
65
|
|
|
70
|
-
Page.State.prototype.consent = function (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.scope.$consent =
|
|
75
|
-
this.chain('consent',
|
|
76
|
-
if (
|
|
66
|
+
Page.State.prototype.consent = function (listener) {
|
|
67
|
+
this.scope.$consent ??= {};
|
|
68
|
+
const { consent } = listener.constructor;
|
|
69
|
+
const val = Page.storage.get('consent.' + consent);
|
|
70
|
+
this.scope.$consent[consent] = val;
|
|
71
|
+
this.chain('consent', listener);
|
|
72
|
+
if (val === undefined) {
|
|
77
73
|
HTMLCustomConsentElement.waiting = true;
|
|
78
|
-
} else if (
|
|
74
|
+
} else if (val === null) {
|
|
79
75
|
// setup finished but no consent is done yet, ask consent
|
|
80
|
-
this.reconsent();
|
|
76
|
+
this.reconsent(listener);
|
|
81
77
|
}
|
|
82
78
|
};
|
|
83
79
|
|
|
84
|
-
Page.State.prototype.reconsent = function (
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
80
|
+
Page.State.prototype.reconsent = function (listener) {
|
|
81
|
+
if (listener) this.consent(listener);
|
|
82
|
+
const consents = this.scope.$consent;
|
|
87
83
|
let asking = false;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
for (const [key, val] of Object.entries(consents)) {
|
|
85
|
+
if (listener && key != listener.constructor.consent) continue;
|
|
86
|
+
if (val != "yes") {
|
|
87
|
+
asking = HTMLCustomConsentElement.ask();
|
|
88
|
+
}
|
|
89
|
+
if (!asking) {
|
|
90
|
+
if (val == null) consents[key] = "yes";
|
|
91
|
+
}
|
|
93
92
|
}
|
|
94
93
|
return asking;
|
|
95
94
|
};
|
package/ui/embed.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
class HTMLElementEmbed extends VirtualHTMLElement {
|
|
2
|
+
static consent = "embed";
|
|
2
3
|
static defaults = {
|
|
3
4
|
src: null,
|
|
4
5
|
hash: null
|
|
@@ -18,7 +19,7 @@ class HTMLElementEmbed extends VirtualHTMLElement {
|
|
|
18
19
|
return this.promise;
|
|
19
20
|
}
|
|
20
21
|
consent(state) {
|
|
21
|
-
const consent = state.scope.$consent;
|
|
22
|
+
const consent = state.scope.$consent[this.constructor.consent];
|
|
22
23
|
this.classList.toggle('denied', consent == "no");
|
|
23
24
|
this.classList.toggle('waiting', consent == null);
|
|
24
25
|
|
|
@@ -56,7 +57,7 @@ class HTMLElementEmbed extends VirtualHTMLElement {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
captureClick(e, state) {
|
|
59
|
-
if (this.matches('.denied')) state.reconsent();
|
|
60
|
+
if (this.matches('.denied')) state.reconsent(this);
|
|
60
61
|
}
|
|
61
62
|
captureLoad() {
|
|
62
63
|
this.promise.done();
|