PageSourceSearch

https://www.hogarmania.com/hogarmania/7726.h-294a4f10399296a23072.js

js hogarmania.com collected 2026-10-02 03:37:37 UTC 6,475 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[7726],{7726:(t,e,o)=>{o.r(e),o.d(e,{default:()=>f});var s=o(77382),i=o(73966),l=o(68577),a=o(96262);const n={name:"nx-poll-option",props:{option:{type:Object,required:!0},showImage:{type:Boolean,default:!0},state:{type:Object,required:!0}},components:{NxPicture:a.Z},methods:{checkOption(t){this.state.loading||this.state.votedOptionId||!this.state.active||this.$emit("selectOption",t)}}};var p=o(40810);const d=(0,p.Z)(n,function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",{staticClass:"bbnx-poll-option",class:{selected:t.option.selected,results:(t.state.showResults||!t.state.active)&&!t.state.hidden,voted:!!t.state.votedOptionId||!t.state.active,loading:t.state.loading},on:{click:function(e){return t.checkOption(t.option.id)}}},[t.showImage&&t.option.image?e("div",{staticClass:"poll-option--image"},[e("nx-picture",{attrs:{image:t.option.image,imageSourcesByAspectRatio:"mini"}})],1):t._e(),t._v(" "),e("div",{staticClass:"poll-option--content"},[e("div",{staticClass:"poll-option--content--left"},[e("div",{staticClass:"poll-option-title"},[t._v(t._s(t.option.title))])]),t._v(" "),!t.state.showResults&&t.state.active||t.state.hidden?t._e():e("div",{staticClass:"poll-option--content--right"},[e("span",{staticClass:"percent"},[t._v(t._s(t.option.percent)+"%")])]),t._v(" "),!t.state.active||t.state.showResults&&!t.state.hidden?e("div",{staticClass:"percent-votes",style:{width:t.option.percent?`calc(${t.option.percent}% + 2px)`:"0px"}}):t._e()])])},[],!1,null,null,null).exports;var c=o(75257);const h=t=>c.Z.get(`/api/front/poll/${t}`),r=(t,e)=>c.Z.post(`/api/front/poll/${t}/vote/${e}`),u=(t,e)=>t.map(t=>({id:t.id,title:t.title,votes:t.votes,image:t.image,selected:!!t.selected,percent:0===e?0:Math.round(100*t.votes/e)}));var v=o(27693),m=o.n(v);const g={name:"nx-poll",props:{pollId:{type:Number,required:!0},cachedOptions:{type:Array,required:!0},cachedVotes:{type:Number,default:0},cachedActive:{type:Boolean,default:!0},cachedOpen:{type:Boolean,default:!0},startDate:{type:Object,default:null},closeDate:{type:Object,default:null}},components:{NxModalWindow:i.Z,NxButton:l.Z,NxPollOption:d},data:()=>({showModal:!1,state:{showResults:!1,loading:!0,pollId:null,options:[],totalVotes:null,active:!0,open:!0,votedOptionId:null,hidden:!1,percent:0}}),computed:{...(0,s.Se)(["site"]),...(0,s.Se)(["brickConfig"]),...(0,s.Se)(["loginUrl"]),...(0,s.Se)("user",["currentUser"]),pollStartDate(){return m().utc(this.startDate.date).local().format("DD/MM/YYYY - HH:mm")},notStarted(){if(!this.startDate)return null;const t=m()(this.startDate.date);return m()().diff(t)<0},isFinished(){if(!this.closeDate)return null;const t=m()(this.closeDate.date);return m()().diff(t)>0},pollClasses(){return this.brickConfig.pages.poll.classes},checkedOption(){return this.state.options.find(t=>t.selected)},isCheckedOption(){return this.state.options.some(t=>t.selected)},showOptionImages(){return this.state.options.every(t=>!!t.image)}},created(){this.state.pollId=this.pollId,this.state.options=this.cachedOptions,this.state.totalVotes=this.cachedVotes,this.state.active=this.cachedActive,this.state.open=this.cachedOpen,this.getPollData()},mounted(){this.state.active||(this.state.showResults=!0)},methods:{voteOption(){this.currentUser||this.state.open?this.votePoll(this.checkedOption.id):this.showModal=!0},goToLogin(){window.location=this.loginUrl},closeModal(){this.showModal=!1},getPollData(){h(this.state.pollId).then(t=>{t&&(this.state.options=u(t.options,t.totalVotes),this.state.totalVotes=t.totalVotes,this.state.active=t.active,this.state.open=t.open,this.state.hidden=t.hidden,this.state.loading=!1,this.checkLocalStoragePoll())}).catch(t=>{console.warn(t)})},selectOptionId(t){const e=this.state.options.find(e=>e.id===t).selected;this.state.options=this.state.options.map(t=>({...t,selected:!1})),this.state.options.find(e=>e.id===t).selected=!e},voteOptionId(t){this.state.options.find(e=>e.id===t).votes+=1},votePoll(t){return this.state.loading=!0,r(this.state.pollId,t).then(()=>{this.voteOptionId(t),this.state.totalVotes+=1,this.state.options=u(this.state.options,this.state.totalVotes),this.state.votedOptionId=t;const e=JSON.parse(localStorage.getItem("bbnx-voted-polls"))||[];e.push({pollId:this.state.pollId,votedOptionId:t}),localStorage.setItem("bbnx-voted-polls",JSON.stringify(e)),this.state.showResults=!0,this.state.loading=!1}
1).catch(t=>{console.warn(t)})},checkLocalStoragePoll(){const t=JSON.parse(localStorage.getItem("bbnx-voted-polls"));if(t){const e=t.find(t=>t.pollId===this.pollId);e&&(void 0!==this.state.options.find(t=>t.id===e.votedOptionId)&&(this.voteOptionId(e.votedOptionId),this.selectOptionId(e.votedOptionId)),this.state.votedOptionId=e.votedOptionId,this.state.showResults=!0)}}}},f=(0,p.Z)(g,function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",{staticClass:"bbnx-poll",class:t.pollClasses},[e("div",{staticClass:"poll-options"},[t._l(t.state.options,function(o){return[e("nx-poll-option",{key:o.id,attrs:{option:o,"show-image":t.showOptionImages,state:t.state},on:{selectOption:t.selectOptionId}})]})],2),t._v(" "),e("div",{staticClass:"poll-footer"},[t.state.votedOptionId||!t.state.active?e("div",{staticClass:"poll-footer--results"},[t.state.active?e("span",[t._v(t._s(t.$t("poll.poll-result-title")))]):t.state.active||!t.notStarted||t.isFinished?t.state.active?t._e():e("span",[t._v(t._s(t.$t("poll.inactive")))]):e("span",[t._v(t._s(t.$t("poll.not-started"))+" "+t._s(t.pollStartDate))])]):e("div",{staticClass:"poll-footer--actions"},[e("button",{staticClass:"bbnx-btn medium vote-action",attrs:{disabled:!t.isCheckedOption,loading:t.isCheckedOption&&t.state.loading},on:{click:t.voteOption}},[t._v("\n        "+t._s(t.$t("poll.vote"))+"\n      ")]),t._v(" "),e("nx-modal-window",{attrs:{title:t.$t("poll.modal-title"),text:t.$t("poll.modal-text",{site:this.site.name})},scopedSlots:t._u([{key:"actions",fn:function(){return[e("nx-button",{attrs:{text:t.$t("poll.button-login"),tabindex:t.showModal?"0":"-1",type:"button",medium:""},on:{click:t.goToLogin}}),t._v(" "),e("nx-button",{staticClass:"form-user-profile__button",attrs:{text:t.$t("like-modal.button-cancel"),tabindex:t.showModal?"0":"-1",type:"button",medium:"",outline:""},on:{click:t.closeModal}})]},proxy:!0}]),model:{value:t.showModal,callback:function(e){t.showModal=e},expression:"showModal"}})],1)])])},[],!1,null,null,null).exports}}]);

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.