PageSourceSearch

https://www.myvouchercodes.co.uk/vite/assets/Slice/Rating/Rating.ts-CEUTvFqJ.js

js myvouchercodes.co.uk collected 2026-10-02 02:50:38 UTC 2,060 bytes, 1 lines download raw bytes

1const t=t=>{try{return window.localStorage.getItem(t)}catch{return null}},e=(t,e,r)=>{const n=t.querySelector(".rating__total");null!==n&&(e.summary?n.textContent=e.summary:n.textContent=0===r?e.noRatingsText:e.totalRatingsText.replace("{total}",String(r)))},r=(t,e)=>{const r=t.querySelector(".rating__interjection");null!==r&&(r.textContent=e)},n=(e,r,n,a,i)=>{t(a)||n.errorState||((t,e)=>{t.querySelectorAll('[data-rating-star-active="true"]').forEach(((t,r)=>{t.setAttribute("class",e[r]??"rating__item")}))})(e,(t=>{const e=[];return Array.from({length:5}).forEach(((r,n)=>{t>=n+1?e.push("rating__item--full"):t%1>=.5&&t>n?e.push("rating__item--half"):e.push("rating__item")})),e})(null===i?r.score:i+1))},a=async(n,a,i,o,l)=>{if(!t(o)&&!i.errorState)try{const t=await fetch(a.endpoint,{body:JSON.stringify({articleId:a.articleId,rating:l+1,site:a.site}),headers:{"Content-Type":"text/plain"},method:"POST"});if(!t.ok)throw new Error(t.statusText);r(n,a.interjection.successMessage),((t,e)=>{try{window.localStorage.setItem(t,"true")}catch{}})(o),i.total+=1,e(n,a,i.total)}catch(t){r(n,a.interjection.errorMessage),i.errorState=!0,console.log(t,`POST failed for Rating slice - ${a.endpoint}`)}},i=i=>{if("true"===i.dataset.ratingInitialized)return;const o=(t=>{const e=t.dataset.ratingConfig;if(!e)return null;try{return JSON.parse(e)}catch{return null}})(i);if(null===o)return;i.dataset.ratingInitialized="true";const l=`Rating:${o.articleId}:Voted`,c={errorState:!1,total:o.total};e(i,o,c.total),t(l)&&r(i,o.interjection.alreadyVotedMessage),i.querySelectorAll(".rating__item--container").forEach(((t,e)=>{t.addEventListener("mouseenter",(()=>n(i,o,c,l,e))),t.addEventListener("mouseleave",(()=>n(i,o,c,l,null))),t.addEventListener("focusin",(()=>n(i,o,c,l,e))),t.addEventListener("click",(()=>{a(i,o,c,l,e)})),t.addEventListener("keydown",(t=>{"Enter"===t.key&&a(i,o,c,l,e)}))}))},o=()=>{document.querySelectorAll(".rating__wrapper[data-rating-config]").forEach(i)};window.reliableDOMContentLoaded?window.reliableDOMContentLoaded.then(o).catch(o):o();

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.