Add checkbox for the comments section
This commit is contained in:
parent
d2e709891e
commit
180872e308
37
post.hbs
37
post.hbs
|
@ -83,6 +83,7 @@ into the {body} of the default.hbs template --}}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -134,6 +135,42 @@ into the {body} of the default.hbs template --}}
|
||||||
src="https://www.internet-czas-dzialac.pl/isso/js/embed.min.js" async></script>
|
src="https://www.internet-czas-dzialac.pl/isso/js/embed.min.js" async></script>
|
||||||
|
|
||||||
<section id="isso-thread"></section>
|
<section id="isso-thread"></section>
|
||||||
|
<script>
|
||||||
|
(async function(){
|
||||||
|
function addCheckbox(){const original_submit = document.querySelector(".post-action input[type='submit']");
|
||||||
|
original_submit.style.setProperty("display", "none")
|
||||||
|
const faux_submit = document.createElement("input")
|
||||||
|
faux_submit.value = "Wyślij"
|
||||||
|
const comment_checkbox_id = "comment-checkbox"
|
||||||
|
const checkbox = document.createElement("input")
|
||||||
|
checkbox.type = "checkbox"
|
||||||
|
checkbox.id = comment_checkbox_id
|
||||||
|
checkbox.required = true
|
||||||
|
const label = document.createElement("label")
|
||||||
|
label.for = comment_checkbox_id;
|
||||||
|
label.appendChild(checkbox)
|
||||||
|
const label_text = document.createElement("span")
|
||||||
|
label_text.innerHTML = `akceptuję postanowienia <a href="#">regulaminu komentarzy</a>`
|
||||||
|
label.appendChild(label_text)
|
||||||
|
document.querySelector("#isso-thread .auth-section").appendChild(label)
|
||||||
|
faux_submit.addEventListener("click", ()=>{
|
||||||
|
if(!checkbox.checked){
|
||||||
|
checkbox.reportValidity()
|
||||||
|
}else {
|
||||||
|
original_submit.click()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
original_submit.parentElement.appendChild(faux_submit)
|
||||||
|
}
|
||||||
|
for(let i=0; i<=20; i++){
|
||||||
|
if(document.querySelector(".post-action input[type='submit']")){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await new Promise((resolve)=>setTimeout(resolve, 200));
|
||||||
|
}
|
||||||
|
addCheckbox();
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user