Estonia missing when youy add your phone number
linkedin.com5 pointsby atirip0 comments
<!doctype html>
<body>
<custom-element></custom-element>
<script>
const CHECKBOX_ID = "my-checkbox";
const defaultLabelContent = "Toggle me, you newbies";
const beforeDiscountText = "You have not availabled discount";
const afterDiscountText = "Discount Availed!";
const beforeLabelText = "Click on me to remove fake discount"
const afterLabelText = "Click me to apply fake discount!"
const state = new WeakMap();
// 'library' code
function qs(selector) {
return this.shadowRoot.querySelector(selector);
}
function getElem(nodeOrSelector) {
return nodeOrSelector === String(nodeOrSelector) ? qs.call(this, nodeOrSelector) : nodeOrSelector;
}
function replaceText(nodeOrSelector, text) {
let elem = getElem.call(this, nodeOrSelector);
if (elem) elem.textContent = text;
}
function updateAttribute(nodeOrSelector, name, value = '') {
let elem = getElem.call(this, nodeOrSelector);
if (elem) elem[(value ? 'set' : 'remove') + 'Attribute'](name, value);
}
// end of 'library' code
class CustomElement extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<input type="checkbox" id=${CHECKBOX_ID}>
<label for=${CHECKBOX_ID}></label>
<div></div>
`;
this.shadowRoot.addEventListener('change', (event) => {
state.set(this, event.target.checked);
this.update();
})
this.update();
}
update() {
let isChecked = state.get(this);
updateAttribute.call(this, 'input', 'checked', isChecked);
replaceText.call(this, 'label', isChecked ? beforeLabelText : afterLabelText);
replaceText.call(this, 'div', isChecked ? afterDiscountText : beforeDiscountText);
}
}
customElements.define('custom-element', CustomElement);
</script> <!doctype html>
<body>
<custom-element></custom-element>
<script>
const CHECKBOX_ID = "my-checkbox";
const defaultLabelContent = "Toggle me, you newbies";
const beforeDiscountText = "You have not availabled discount";
const afterDiscountText = "Discount Availed!";
const beforeLabelText = "Click on me to remove fake discount"
const afterLabelText = "Click me to apply fake discount!"
const state = new WeakMap();
class CustomElement extends HTMLElement {
connectedCallback() {
this.render();
this.shadowRoot.addEventListener('change', (event) => {
state.set(this, event.target.checked);
this.render();
})
}
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
render() {
let isChecked = state.get(this);
const discountText = isChecked
? afterDiscountText
: beforeDiscountText;
const labelText = isChecked
? beforeLabelText
: afterLabelText;
this.shadowRoot.innerHTML = `
<input
${isChecked ? 'checked ' : ''}
type="checkbox"
id=${CHECKBOX_ID}
>
<label for=${CHECKBOX_ID}>
${labelText}
</label>
<div>${discountText}</div>
`;
}
}
customElements.define('custom-element', CustomElement);
</script> /* "custom" */
[class*="as-oil"]:not(body, html),
[class*="optanon"]:not(body, html),
/* "generic" */
[class*="consent"]:not(body, html),
[id*="consent"],
[class*="gdpr"]:not(body, html),
[id*="gdpr"],
[class*="announcement"]:not(body, html),
[id*="announcement"],
[class*="policy"]:not(body, html),
[id*="policy"],
[class*="cookie"]:not(body, html),
[id*="cookie"] {
display: none!important;
visibility: hidden!important;
transform: scale(0)!important;
opacity: 0!important;
width: 0!important;
height: 0!important;
z-index: -1!important;
background: transparent!important;
color: transparent!important;
font-size:0!important;
}