PageSourceSearch

https://haibh.ru/_nuxt/BwvITq7S.js

js haibh.ru collected 2026-09-25 09:26:58 UTC 2,345 bytes, 1 lines download raw bytes

1import{d as u}from"./BwQzvdFb.js";import{i as c,_ as m,a as i,o as n,e as o,t as _,G as r,D as l,A as y,F as d,v as p,n as h,U as f}from"./CyVqXwo4.js";const v=u({props:{item:{type:Object,required:!0}},setup(){const{$api:t}=c();return{sendVote:a=>t("/results/poll",{method:"POST",body:a})}},data(){return{sent:!1,busy:!1,selectedOption:null}},computed:{total(){return this.item.options.reduce((t,s)=>t+s.votes,0)},lsKey(){return`poll-${this.item.id}`}},mounted(){localStorage.getItem(this.lsKey)&&(this.sent=!0)},methods:{optionPercents(t){return Math.round(t.votes/this.total*100)},progressStyle(t){let s=this.optionPercents(t);s>83&&(s=83);const a=s?"1.25rem":"0";return{"padding-left":a,"padding-right":a,width:s+"%"}},async send(){if(!this.selectedOption){alert("Выберите один из вариантов ответа");return}if(!this.busy){this.busy=!0;try{await this.sendVote({poll_id:this.item.id,option_id:this.selectedOption.id}),this.sent=!0,++this.selectedOption.votes,localStorage.setItem(this.lsKey,"1")}catch(t){console.error(t)}this.busy=!1}}}},"$pkRMlSqasB"),g="_poll_fwz2z_2",$="_title_fwz2z_6",z="_item_fwz2z_10",k="_result_fwz2z_14",O="_progress_fwz2z_18",b="_stat_fwz2z_22",w={poll:g,title:$,item:z,result:k,progress:O,stat:b},S={key:"results"},C={key:"form"},M=["onClick"],P={class:"text"};function V(t,s,a,N,K,j){return n(),i("div",{class:l(t.$style.poll)},[o("div",{class:l(t.$style.title)},r(t.item.title),3),_(f,{name:"fade",mode:"out-in"},{default:y(()=>[t.sent?(n(),i("div",S,[(n(!0),i(d,null,p(t.item.options,e=>(n(),i("div",{key:e.id||e.title,class:l(t.$style.result)},[o("div",{style:h(t.progressStyle(e)),class:l(t.$style.progress)},r(e.title),7),o("div",null,r(e.title),1),o("div",{class:l(t.$style.stat)},[o("div",null,r(t.optionPercents(e))+"%",1),o("div",null,"("+r(e.votes)+")",1)],2)],2))),128))])):(n(),i("div",C,[(n(!0),i(d,null,p(t.item.options,e=>(n(),i("div",{key:e.id||e.title,class:l(t.$style.item),onClick:q=>t.selectedOption=e},[o("div",{class:l(["checkbox",{__active:t.selectedOption&&e.title===t.selectedOption.title}])},null,2),o("div",P,r(e.title),1)],10,M))),128)),o("div",{class:"btn",onClick:s[0]||(s[0]=(...e)=>t.send&&t.send(...e))},"Ответить")]))]),_:1})],2)}const B={$style:w},F=Object.assign(m(v,[["render",V],["__cssModules",B]]),{__name:"MatterPoll"});export{F as _};

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.