3 wiersze
1.1 KiB
JavaScript
3 wiersze
1.1 KiB
JavaScript
import renderPoll from"./renderPoll.min.js";import getPollOptions from"./getPollOptions.min.js";const pollElement=document.getElementById("poll"),pollTypeElement=document.getElementById("poll-data-type"),pollOptionsElement=document.getElementById("poll-data-options"),updatePreview=(e,l,t)=>{var o,p=document.getElementById("poll-title"),n=document.getElementById("poll-description");switch(t.id){case"poll-data-title":t.value&&t.value.length?p.innerHTML=t.value.trim():p.innerHTML="My poll";break;case"poll-data-description":t.value&&t.value.length?(o=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,n.innerHTML=t.value.split("\n").map(e=>`<p>${e.trim()}</p>`).join("").replace(o,'<a href="$1" target="_blank">$1</a>')):n.innerHTML="Vote in my poll!";break;case"poll-data-options":case"poll-data-type":renderPoll({poll:pollElement,type:pollTypeElement.value,options:getPollOptions(pollOptionsElement)})}};renderPoll({poll:pollElement,type:pollTypeElement.value,options:getPollOptions(pollOptionsElement)});export default updatePreview;
|
|
//# sourceMappingURL=updatePreview.min.js.map
|