PageSourceSearch

https://s3.elespanol.com/assets_js/web/v2/SurveyTop100-4IXUWBUD.js

js elespanol.com collected 2026-09-24 09:10:15 UTC 6,942 bytes, 1 lines download raw bytes

1import{d as U}from"./chunk-72YAZQ5C.js";import"./chunk-D4EZOWEK.js";import{i as R,k as s,v as V}from"./chunk-CIZQHUPH.js";import"./chunk-VTC22NR5.js";import"./chunk-QD2YVZSD.js";import"./chunk-6IEOUFJJ.js";import"./chunk-FY2FBY5S.js";import"./chunk-PDTAGS5S.js";import{w as m}from"./chunk-PHTBXULL.js";import{c as E}from"./chunk-ZIYJVGPD.js";import{b as h,d as r}from"./chunk-VIVYENB4.js";import{c as f}from"./chunk-3HVXYCZN.js";import"./chunk-T6LYIDMV.js";import"./chunk-74EIPC4E.js";import"./chunk-YI2EV5SO.js";import{d as I,e as g,s as v,t as L,u}from"./chunk-7WI4Z4JO.js";u();u();g();L();var o="SURVEYS_ABSTRACT";h(o);var _=class{constructor(e){this.eventShowPiano=e.eventShowPiano||I.PIANO_SCREEN_LOGIN,this.editionId=e.editionId,this.categoryId=e.categoryId,this.urlServiceLoadInitialData=e.urlServiceLoadInitialData,this.urlServiceLoadUserInitialData=e.urlServiceLoadUserInitialData,this.urlServiceVote=e.urlServiceVote,this.maxVotes=null,this.userRoleVote=e.userRoleVote,this.originLoad=v.user.userRoutes.stage,this.requestHeaders={"Content-Type":"application/json"},this.container=null,this.user=V.getInstance(),this.promisesData=[],this.promiseLogin=()=>{}}setContainer(e){document.getElementById(e)&&(this.container=document.getElementById(e))}init(){this.loadInitialData(),this.user.isRegisteredEE()&&this.loadInitialUserData(!0),E(this.container,f.ON_DOM_CLICK,this._onClick,this),E(this.user,R.ON_USER_SYNC_LAYOUT_FINISH,this._onLoadDataUserPostLogin,this),Promise.all(this.promisesData).then(e=>{e.forEach(a=>{jeef.JeefEvents.emit(a.event,a.data)})})}_onLoadDataUserPostLogin(){this.promiseLogin(),this.loadInitialUserData(!1).then(e=>{jeef.JeefEvents.emit(e.event,e.data)})}resolveLoginSendData(e){this.loadSendData(e).then(a=>{jeef.JeefEvents.emit(a.event,a.data)})}_onClick(e){let a=e.target,t=a.getAttribute("data-candidate-id");if(t)if(this.user.isRegisteredEE())this.resolveLoginSendData(t);else return U.showModal(this.eventShowPiano,I.PIANO_DISPLAY_MODAL,this.originLoad),new Promise(i=>{this.promiseLogin=i}).then(i=>{this.resolveLoginSendData(t)}),!1;r(["SurveysAbstract._onClick>element",a],o)}callServiceSurvey(e,a,t={"Content-Type":"application/json"},i,n,d){return new Promise(l=>{let A={method:a,headers:t};i&&(A.body=JSON.stringify(i)),r(["SurveysAbstract.callServiceSurvey> ",e,A,d,n],o),fetch(e,A).then(c=>c.json()).then(c=>{l({success:!0,data:c,event:n})}).catch(c=>{l({success:!1,data:c,event:d})})})}loadInitialUserData(e=!0){jeef.JeefEvents.once(s.ON_LOAD_USER_INITIAL_DATA_SURVEY,t=>{r(["SurveysAbstract.loadInitialUserDataSuccess",s.ON_LOAD_USER_INITIAL_DATA_SURVEY,t],o),this.renderInitialUserDataSurvey(t)}),jeef.JeefEvents.once(s.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR,t=>{r(["SurveysAbstract.loadInitialUserDataError",s.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR,t],o)});let a=this.callServiceSurvey(this.urlServiceLoadUserInitialData,"GET",this.requestHeaders,!1,s.ON_LOAD_USER_INITIAL_DATA_SURVEY,s.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR);if(e)this.promisesData.push(a);else return a}loadInitialData(){jeef.JeefEvents.once(s.ON_LOAD_INITIAL_DATA_SURVEY,e=>{r(["SurveysAbstract.loadInitialDataSuccess",s.ON_LOAD_INITIAL_DATA_SURVEY,e],o),this.renderInitialDataSurvey(e)}),jeef.JeefEvents.once(s.ON_LOAD_INITIAL_DATA_SURVEY_ERROR,e=>{r(["SurveysAbstract.loadInitialDataError",s.ON_LOAD_INITIAL_DATA_SURVEY_ERROR,e],o)}),this.promisesData.push(this.callServiceSurvey(this.urlServiceLoadInitialData,"GET",this.requestHeaders,!1,s.ON_LOAD_INITIAL_DATA_SURVEY,s.ON_LOAD_INITIAL_DATA_SURVEY_ERROR))}loadSendData(e){jeef.JeefEvents.once(s.ON_LOAD_USER_SEND_DATA_SURVEY,t=>{r(["SurveysAbstract.sendDataVoteEventSuccess",s.ON_LOAD_USER_SEND_DATA_SURVEY,t],o),this.renderSendVote(t,e)}),jeef.JeefEvents.once(s.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR,t=>{r(["SurveysAbstract.sendDataVoteEventError",s.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR,t],o)});let a={candidate_id:e,category_id:this.categoryId,edition_id:this.editionId};return this.callServiceSurvey(this.urlServiceVote,"POST",this.requestHeaders,a,s.ON_LOAD_USER_SEND_DATA_SURVEY,s.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR)}renderInitialDataSurvey(e){}renderInitialUserDataSurvey(e){}renderSendVote(e,a){}};var S="SURVEY_TOP100";h(S);var D=class extends _{constructor(e){super(e),this.numUserVotes=0}renderInitialDataSurvey(e){this.maxVotes=e.data.max,this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes);let a=this.container.querySelectorAll(".data-news");a.length>0?a.forEach(t=>{this.renderElementInitialData(e,t)}):this.renderElementInitialData(e,this.container),r(["Surveys.renderInitialDataSurvey>data",e],S)}renderElementInitialData(e,a){let t=!1,i=a.getAttribute("id").match(/candidate_(\d+)/),n=i[1];if(t=document.getElementById("candidate_".concat(n)),t){this.changeStateCandidateButtonVote(t,"vote",!e.data.active);
1let d=t.querySelector(".data-vote [data-value]"),l="0";Object.keys(e.data.candidates).includes(n)&&(l=(parseInt(d.getAttribute("data-value"))+parseInt(e.data.candidates[n])).toString()),m(d,l)}}renderInitialUserDataSurvey(e){this.setUserTotalVotes(e.data.totals);let a=!1;this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes);for(let t in e.data.candidates)a=document.getElementById("candidate_".concat(t)),a&&this.changeStateCandidateButtonVote(a,"voted",!e.data.active);if(this.getUserTotalVotes()===this.maxVotes){let t=this.container.querySelectorAll(".data-news");if(t.length>0)t.forEach(i=>{let n=i.getAttribute("id").match(/candidate_(\d+)/),d=n[1];Object.keys(e.data.candidates).includes(d)||this.changeStateCandidateButtonVote(i,"vote",!0)});else{let i=this.container.getAttribute("id").match(/candidate_(\d+)/),n=i[1];Object.keys(e.data.candidates).includes(n)||this.changeStateCandidateButtonVote(this.container,"vote",!0)}}r(["Surveys.renderInitialUserDataSurvey>data",e],S)}renderSendVote(e,a){let t=document.getElementById("candidate_".concat(a)),i=t.querySelector(".data-vote [data-value]"),n=parseInt(i.getAttribute("data-value"))+1;this.changeStateCandidateButtonVote(t,"voting"),e.code==="max-participates"?n=parseInt(i.getAttribute("data-value")):(this.setMoreVotes(1),this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes),this.getUserTotalVotes()>=this.maxVotes&&this.disableAllButtons()),m(i,n.toString()),r(["Surveys.renderSendVote>data",e],S)}disableAllButtons(){this.container.querySelectorAll(".data-news").forEach(e=>{e.querySelectorAll('.button-item[data-state="vote"]').length&&this.changeStateCandidateButtonVote(e,"voted")})}setUserTotalVotes(e){this.numUserVotes=e}getUserTotalVotes(){return this.numUserVotes}setMoreVotes(e){this.numUserVotes+=e}changeStateCandidateButtonVote(e,a,t=!1){let i=e.querySelector(".button-item");t?i.removeAttribute("data-state"):i.setAttribute("data-state",a)}setNumUserVotesLeft(e,a){document.getElementById("fbody").style.setProperty("--app-lasTop100-userNumVotes",'"'.concat(this.getUserTotalVotes(),"/").concat(a,'"'))}};export{D 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.