PageSourceSearch

https://monday.com/blog/wp-content/cache/min/1/blog/wp-content/the…/lib/polls/js/polls.js?ver=1790066322

js monday.com collected 2026-09-24 08:24:03 UTC 3,967 bytes, 15 lines download raw bytes

1var polls=polls||{};class Polls{constructor(){this.pollButtonFirst;this.pollButtonSecond;this.checkPolls();this.setEventListeners()}
2init(){console.log('Polls script is ready...')};setEventListeners(){document.querySelectorAll('.polls-btn').forEach(voteButton=>{if(!voteButton.classList.contains('polls-btn--voted')){voteButton.addEventListener('click',this.onVote.bind(this))}})};getFirstButton(){return this.pollButtonFirst};getSecondButton(){return this.pollButtonSecond};setFirstButton(newButton){this.pollButtonFirst=newButton};setSecondButton(newButton){this.pollButtonSecond=newButton};setButtons(actionWrapper){const pollWrappers=actionWrapper.childNodes;this.setFirstButton(pollWrappers[0].childNodes[0]);this.setSecondButton(pollWrappers[1].childNodes[0])}
3disableButtons(){this.getFirstButton().setAttribute('disabled','true');this.getSecondButton().setAttribute('disabled','true')};checkPolls(){let self=this;document.querySelectorAll('.polls').forEach(poll=>{let pollName=poll.dataset.name;let pollID=pollName.split('_')[1];let buttons={};if(poll.dataset.voted==1){return}
4if(this.getCookie(pollName)){this.setButtons(poll.childNodes[1]);this.disableButtons();buttons={'first':this.getFirstButton(),'second':this.getSecondButton(),};let xhttp=new XMLHttpRequest();xhttp.open("POST",'/blog/wp-json/rest/v1/polls/',!0);xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhttp.onreadystatechange=function(){if(this.readyState==4&&this.status==200){let data=JSON.parse(this.responseText);self.votingCompleted(buttons,data.percentage);console.log(data)}};xhttp.onerror=function(){console.log("** An error occurred during the transaction **")}
5xhttp.send('poll_id='+pollID+'&vote_answer=0')}})};onVote(e){console.log('Voting started...');const self=this;const clickedButton=e.currentTarget;const pollName=clickedButton.parentElement.parentElement.parentElement.dataset.name;const pollID=pollName.split('_')[1];let buttons={};this.setButtons(clickedButton.parentElement.parentElement)
6this.disableButtons();buttons={'first':this.getFirstButton(),'second':this.getSecondButton(),};const xhttp=new XMLHttpRequest();xhttp.open("POST",'/blog/wp-json/rest/v1/polls/',!0);xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhttp.onreadystatechange=function(){if(this.readyState==4&&this.status==200){let data=JSON.parse(this.responseText);self.createCookie(pollName,'true','356');self.votingCompleted(buttons,data.percentage);console.log(data)}};xhttp.onerror=function(){console.log("** An error occurred during the transaction **")}
7xhttp.send('poll_id='+pollID+'&vote_answer='+clickedButton.dataset.answer)};votingCompleted(buttons,percentage){console.log('Voting Completed!');const firstButton=buttons.first;const secondButton=buttons.second;const firstPercentString=percentage.first+'%';const secondPercentString=percentage.second+'%';firstButton.classList.add('polls-btn--voted');firstButton.style.backgroundSize=firstPercentString;firstButton.childNodes[1].innerHTML=firstPercentString;secondButton.classList.add('polls-btn--voted');secondButton.style.backgroundSize=secondPercentString;secondButton.childNodes[1].innerHTML=secondPercentString};createCookie(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toUTCString()}
8document.cookie=name+"="+value+expires+"; path=/"}
9getCookie(cname){var name=cname+"=";var decodedCookie=decodeURIComponent(document.cookie);var ca=decodedCookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1)}
10if(c.indexOf(name)==0){return c.substring(name.length,c.length)}}
11return""}}
12function onDomReady(fn){if(typeof fn!=='function'){return}
13if(document.readyState==='interactive'||document.readyState==='c
13omplete'){return fn()}
14document.addEventListener('DOMContentLoaded',fn,!1)}
15onDomReady(function(){if(document.querySelector('.polls')){new Polls}})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.