PageSourceSearch

https://www.euroherz.de/wp-content/themes/cmms-theme-fhb/assets/dist/1.76/Poll.js

js euroherz.de collected 2026-10-02 18:33:07 UTC 7,323 bytes, 1 lines download raw bytes

1import{_ as b,c as y,m as V,s as c,u as k,v as C}from"./app.js";import"./swiper.js";const A={name:"Poll",components:{SoylentLink:V,CmmsResponsiveImage:y},data:function(){return{selectedAnswer:null,public:!1,closed:!1,submitted:!1,requiresAuth:!1,error:!1,success:!1,voted:!1,results:null,nonce:null,hasCaptcha:null,popupVisible:!1}},props:["element"],computed:{...C("sso",["auth"]),radioButtonName:function(){return"cmms_poll_answer_".concat(this.element.data.poll.id)},localStorageKey:function(){return"poll_"+this.element.data.poll.id},profilePageUrl(){return"profile_page"in window.soylent_settings?window.soylent_settings.profile_page:"/"}},methods:{...k("sso",["setRedirectPath"]),selectAnswer:function(e){this.requestNonce(),this.selectedAnswer=e},requestNonce:function(){this.nonce===null&&!this.voted&&(this.nonce=!1,c.get("/cmms-api-v2/cmms-poll/nonce/".concat(this.element.data.poll.id,"/")).then(e=>{e.data&&e.data.nonce&&(this.nonce=e.data.nonce)}).catch(e=>{e.response||console.debug(e)}))},setPopup(e,t="validation"){this.popupText=e,this.popupType=t,this.popupVisible=this.popupText!==""},submitVote:function(e=!0){if(this.selectedAnswer!==null){if(this.hasCaptcha&&!this.hasCaptchaPayload()){this.setPopup("Das Captcha wurde noch nicht ausgeführt.");return}if(this.nonce===!1&&e===!0){setTimeout(()=>{this.submitVote(!1)},1e3);return}this.submitted=!0,this.voted?this.getResults():c.post("/cmms-api-v2/cmms-poll/vote/".concat(this.element.data.poll.id,"/"),{answer_id:this.selectedAnswer,nonce:this.nonce,...this.getCaptchaPayload()}).then(t=>{t.status===200||t.status===204?(this.success=!0,this.voted=!0,t.data.results&&(this.results=t.data.results),window.localStorage.setItem(this.localStorageKey,"1")):this.error=!0}).catch(t=>{t.data==="captcha-error"&&(this.submit=!1,this.voted=!1,this.submitted=!0,this.error=!0),t.response||console.debug(t)})}},getResults(){this.public&&c.get("/cmms-api-v2/cmms-poll/results/".concat(this.element.data.poll.id,"/")).then(e=>{e.data.results&&(this.results=e.data.results)}).catch(e=>{e.response||console.debug(e)})},getVoted(){c.get("/cmms-api/v3/cmms-poll/retrieve-voted/".concat(this.element.data.poll.id,"/")).then(e=>{this.voted=!1,e.data.voted&&(this.voted=e.data.voted,this.voted&&this.public&&this.getResults())}).catch(e=>{this.voted=!1,e.response||console.debug(e)})},getCaptchaPayload(){if(!this.hasCaptcha||!this.$refs.captcha)return{};const e={};return this.$refs.captcha.querySelectorAll("[name]").forEach(t=>{const o=t.getAttribute("name"),_=t.value||t.getAttribute("value");o&&_&&(e[o]=_)}),e},hasCaptchaPayload(){return Object.keys(this.getCaptchaPayload()).length>0}},mounted(){this.public=this.element.data.poll.public,this.closed=this.element.data.poll.closed,this.element.data.poll.access==="sso"?(this.requiresAuth=!0,this.voted=null,this.getVoted()):this.voted=parseInt(window.localStorage.getItem(this.localStorageKey),10)===1,this.element.data.poll.results?this.results=this.element.data.poll.results:this.public&&this.voted&&this.getResults(),this.setRedirectPath(window.location.pathname),this.hasCaptcha=this.element.data.poll.hasCaptcha==="1"&&!!this.element.data.poll.captchaHtml}},g=window.Vue.resolveComponent,p=window.Vue.createVNode,l=window.Vue.openBlock,i=window.Vue.createElementBlock,n=window.Vue.createCommentVNode,u=window.Vue.toDisplayString,s=window.Vue.createElementVNode,f=window.Vue.renderList,h=window.Vue.Fragment,S=window.Vue.normalizeStyle,P=window.Vue.vShow,z=window.Vue.withDirectives,w=window.Vue.createTextVNode,m=window.Vue.normalizeClass,N=window.Vue.withCtx,T=window.Vue.createBlock,q={key:0,class:"poll__opener --image"},B={class:"poll__container__inner"},R={class:"poll__question --text-size-l --text-weight-medium"},L={key:0,class:"poll__list --results"},H={key:0,class:"poll__list__item__media --image"},I={class:"poll__list__item__content"},D={class:"poll__list__item__label"},E={class:"poll__list__item__indicator"},M={key:1,class:"poll__list --answers"},K=["onClick"],U={key:0,class:"poll__list__item__media --image"},F={class:"poll__list__item__content"},j=["name","value"],G={class:"poll__list__item__label"},O=["innerHTML"],J=["innerHTML"],Q=["disabled"],W={key:3,class:"poll__voted --text-size-l"},X={key:4,class:"poll__popup --text-size-l"},Y={key:5,class:"poll__popup-fail --text-size-l"},Z={key:0,class:"sso-auth__card --with-icon --poll"};function $(e,t,o,_,x,d){const r=g("CmmsResponsiveImage"),v=g("soylent-link");return l(),i("div",{class:m(["element",o.element.type,o.element.subtype])},[s("div",{class:m(["poll__wrapper__outer",e.requiresAuth&&!e.auth?"--login-blocker":""])},[o.element.data.poll.image?(l(),i("div",q,[p(r,{image:o.element.data.poll.image},null,8,["image"])])):n("",!0),s("div",B,[s("p",R,u(o.element.data.poll.question),1),s("div",{class:m(["poll__content",e.requiresAuth&&!e.auth?"--login-fade":""])},[this.results?(l(),i("ul",L,[(l(!0),i(h,null,f(this.results,a=>(l(),i("li",{class:"poll__list__item",key:a.id},[a.image?(l(),i("span",H,[p(r,{zoom:!0,image:a.image},null,8,["image"])])):n("",!0),s("span",I,[s("span",D,u(a.text),1),s("span",E,u(Math.round(a.percentage))+" %",1),s("span",{class:"poll__list__item__progress",style:S("width: ".concat(a.percentage,"%"))},null,4)])]))),128))])):o.element.data.poll.answers?(l(),i("ul",M,[(l(!0),i(h,null,f(o.element.data.poll.answers,a=>(l(),i("li",{onClick:ee=>d.selectAnswer(a.id),class:"poll__list__item",key:a.id},[a.image?(l(),i("span",U,[p(r,{zoom:!0,image:a.image},null,8,["image"])])):n("",!0),s("label",F,[s("input",{class:"poll__list__item__input",type:"radio",name:d.radioButtonName,value:a.id},null,8,j),s("span",G,u(a.text),1),t[1]||(t[1]=s("span",{class:"poll__list__item__indicator"},null,-1))])],8,K))),128))])):n("",!0),!e.submitted&&!e.closed&&!this.results&&!(e.requiresAuth&&!e.auth)?(l(),i(h,{key:2},[e.hasCaptcha?(l(),i("div",{key:0,ref:"captcha",class:"poll__captcha",innerHTML:o.element.data.poll.captchaHtml},null,8,O)):n("",!0),e.popupVisible?z((l(),i("div",{key:1,class:"poll__popup-fail",innerHTML:e.popupText},null,8,J)),[[P,e.popupType==="validation"]]):n("",!0),s("button",{disabled:e.selectedAnswer===null||e.nonce===!1,class:"poll__vote element button --text-link",onClick:t[0]||(t[0]=a=>d.submitVote())},[...t[2]||(t[2]=[s("span",{class:"button__label --text-size-s"},[s("span",{class:"button__text"},"Abstimmen")],-1)])],8,Q)],64)):n("",!0),e.submitted&&e.voted&&!e.success?(l(),i("p",W,u(o.element.data.poll.messages.voted),1)):n("",!0),e.submitted&&e.success?(l(),i("p",X,u(o.element.data.poll.messages.popup),1)):n("",!0),e.submitted&&e.error?(l(),i("p",Y,[...t[3]||(t[3]=[w(" Hoppla, etwas ist schief gegangen!",-1),s("br",null,null,-1),s("br",null,null,-1),w(" Laden Sie die Seite neu und stimmen Sie erneut ab. ",-1)])])):n("",!0)],2),e.requiresAuth&&!e.auth?(l(),i("div",Z,[t[5]||(t[5]=s("span",{class:"iconSet sso-auth__card__icon"},null,-1)),t[6]||(t[6]=s("h3",{class:"sso-auth__card__headline"},"Bitte einloggen, um an der Umfrage teilzunehmen",-1)),e.auth?n("",!0):(l(),T(v,{key:0,url:d.profilePageUrl,class:"sso-auth__card__button"},{default:N(()=>[...t[4]||(t[4]=[s("span",{class:"sso-auth__card__button__label"},[s("span",{class:"sso-auth__card__button__text"},"Anmelden")],-1)])]),_:1},8,["url"]))])):n("",!0)])],2)],2)}const le=b(A,[["render",$]]);export{le as default};

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.