PageSourceSearch

https://row.hellosunrise.com/cdn/shop/t/39/assets/script_reviews.min.js?v=59623563008118586481676044813

js hellosunrise.com collected 2026-10-01 11:29:57 UTC 7,920 bytes, 1 lines download raw bytes

1const storesUrls=["sunrise-sleep.myshopify.com","sunrise-sleep-uk.myshopify.com"],getReviewsResults=[],getReviewsSummaryResults=[];let allReviewsPrepared,reviewsSummaryPrepared;function getAllReviews(){storesUrls.forEach(e=>{const t=`https://stamped.io/api/widget/reviews?minRating=1&take=100&storeUrl=${e}&apiKey=pubkey-2Zfm6fCASImPuPX2If8y28T1l7xZCD`,s=new XMLHttpRequest;s.open("GET",t,!0),s.onreadystatechange=onAllReviewsReceived,s.send()})}function onAllReviewsReceived(e){if(4==this.readyState&&200===this.status){const e=JSON.parse(this.responseText),t=new URL(this.responseURL).searchParams.get("storeUrl");getReviewsResults.push({source:t,data:e.data}),getReviewsResults.length==storesUrls.length&&(prepareAllReviewsFromResult(),displayReviewsMeanScore(),displayReviews())}}function getReviewsSummary(){storesUrls.forEach(e=>{const t=`https://stamped.io/api/widget/reviews?minRating=1&take=1&storeUrl=${e}&apiKey=pubkey-2Zfm6fCASImPuPX2If8y28T1l7xZCD`,s=new XMLHttpRequest;s.open("GET",t,!0),s.onreadystatechange=onReviewsSummaryReceived,s.send()})}function onReviewsSummaryReceived(e){if(4==this.readyState&&200===this.status){const e=JSON.parse(this.responseText),t=new URL(this.responseURL).searchParams.get("storeUrl");getReviewsSummaryResults.push({source:t,rating:e.rating,reviewsCount:e.totalAll}),getReviewsSummaryResults.length==storesUrls.length&&(prepareReviewsSummaryFromResult(),displayReviewsSummary())}}function prepareAllReviewsFromResult(){let e=[];getReviewsResults.forEach(t=>e=e.concat(t.data));const t=[0,0,0,0,0];(e=e.sort((e,t)=>{const s=new Date(e.dateCreated).getTime();return new Date(t.dateCreated).getTime()-s})).forEach(e=>t[e.reviewRating-1]++);let s=0;for(let e=1;e<=t.length;e++)s+=e*t[e-1];allReviewsPrepared={meanScore:s/e.length,scores:t,dataCount:e.length,data:e}}function prepareReviewsSummaryFromResult(){const e={totalRating:0,totalReviewsCount:0};getReviewsSummaryResults.forEach(t=>{e.totalRating+=t.rating,e.totalReviewsCount+=t.reviewsCount}),reviewsSummaryPrepared={rating:e.totalRating/getReviewsSummaryResults.length,reviewsCount:e.totalReviewsCount}}function displayReviewsMeanScore(){const e=allReviewsPrepared.meanScore,t=allReviewsPrepared.scores,s=allReviewsPrepared.dataCount,a=document.querySelector("#reviews_mean_score"),n=getGlobalScoreMeanScore(e,t,s
1),r=getGlobalScoreDetails(t,s);a.appendChild(n),a.appendChild(r)}function displayReviews(){const e=allReviewsPrepared.data,t=document.querySelector("#reviews_loader"),s=document.querySelector("#reviews");t.style.display="none",e.forEach(e=>{const t=getReviewLiElement(e);s.appendChild(t)})}function displayReviewsSummary(){const e=document.querySelectorAll(".v2-reviews-summary"),t=getReviewsSummaryText(reviewsSummaryPrepared.reviewsCount),s=getReviewsSummaryStars(reviewsSummaryPrepared.rating);e.forEach(e=>{e.appendChild(t.cloneNode(!0)),e.appendChild(s.cloneNode(!0))})}function getGlobalScoreMeanScore(e,t,s){const a=document.createElement("div");a.classList.add("global-score__mean-score");const n=document.createElement("div");n.classList.add("mean-score__score");const r=document.createElement("h3");r.classList.add("v2-font--title-h3"),r.innerText=`${Math.round(10*e)/10}`;const i=document.createElement("div");i.classList.add("v2-reviews-stars"),i.classList.add("score__stars"),i.setAttribute("data-rating",`${Math.round(Math.round(10*e)/10)}`);for(let e=0;e<5;e++){const e=document.createElement("span");e.classList.add("stars__star"),i.appendChild(e)}n.appendChild(r),n.appendChild(i);const d=document.createElement("p");return d.classList.add("v2-font--text-body--large-desktop"),d.innerText=`Based on ${s} reviews`,a.appendChild(n),a.appendChild(d),a}function getGlobalScoreDetails(e,t){const s=document.createElement("div");s.classList.add("global-score__details");const a=document.createElement("ul");a.classList.add("details__scores-by-stars");for(let s=e.length-1;s>=0;s--){const n=document.createElement("li");n.classList.add("scores-by-stars__item");const r=document.createElement("div");r.classList.add("v2-reviews-stars"),r.classList.add("item__stars"),r.setAttribute("data-rating",`${s+1}`);for(let e=0;e<5;e++){const e=document.createElement("span");e.classList.add("stars__star"),r.appendChild(e)}const i=document.createElement("div");i.classList.add("item__gauge");const d=document.createElement("div");d.classList.add("gauge__filling"),d.style.width=`${e[s]/t*100}%`,i.appendChild(d);const o=document.createElement("div");o.innerText=`(${e[s]})`,n.appendChild(r),n.appendChild(i),n.appendChild(o),a.appendChild(n)}return s.appendChild(a),s}function getReviewLiElement(e){const t=document.createElement("li");return t.classList.add("v2-reviews__item"),t.appendChild(getItemReviewHeader(e)),e.isRecommend&&t.appendChild(getItemReviewRecommendation(e)),t.appendChild(getItemReviewBody(e)),t}function getItemReviewHeader(e){const t=document.createElement("div");t.classList.add("item__review-header");const s=`${e.author.substring(0,1)}${e.author.substring(e.author.length-2,e.author.length-1)}`.toUpperCase(),a=document.createElement("div");a.classList.add("review-header__author-avatar"),a.innerText=s;const n=document.createElement("div");n.classList.add("review-header__author-location");const r=document.createElement("div");r.classList.add("author-location__author");const i=document.createElement("span");if(i.innerText=e.author,r.appendChild(i),e.reviewVerifiedType&&e.reviewVerifiedType>0){const e=document.createElement("span");e.classList.add("author__verified-buyer"),e.innerText="Verified buyer",r.appendChild(e)}if(n.appendChild(r),e.location){const t=document.createElement("div");t.classList.add("author-location__location");const s=document.createElement("img");s.src=getFlagUrl(e.location);const a=document.createElement("span");a.innerText=e.location,t.appendChild(s),t.appendChild(a),n.appendChild(t)}const d=document.createElement("span");return d.classList.add("review-header__date"),d.innerText=e.reviewDate,t.appendChild(a),t.appendChild(n),t.appendChild(d),t}function getItemReviewRecommendation(e){const t=document.createElement("div");t.classList.add("item__review-recommendation");const s=document.createElement("img");s.classList.add("review-recommendation__icon"),s.src=`${window.shopifyAssetUrl}/img_like.svg`;const a=document.createElement("span");return a.innerText="I recommend this product",t.appendChild(s),t.appendChild(a),t}function getItemReviewBody(e){const t=document.createElement("div");t.classList.add("item__review-body");const s=document.createElement("div");s.classList.add("review-body__header");const a=document.createElement("span");a.classList.add("v2-reviews-stars"),a.classList.add("header__stars"),a.setAttribute("data-rating",`${e.reviewRating}`);for(let e=0;e<5;e++){const e=document.createElement("span");e.classList.add("stars__star"),a.appendChild(e)}const n=document.createElement("h3");n.classList.add("v2-font--title-h4"),n.classList.add("header__title"),n.innerText=e.reviewTitle,s.appendChild(a),s.appendChild(n);const r=document.createElement("p");return r.classList.add("review-body__text"),r.innerText=e.reviewMessage,t.appendChild(s),t.appendChild(r),t}function getFlagUrl(e){let t;return t="Belgium"==e?"https://cdn.stamped.io/cdn/flags/be.svg":"France"==e?"https://cdn.stamped.io/cdn/flags/fr.svg":"Luxembourg"==e?"https://cdn.stamped.io/cdn/flags/lu.svg":"United Kingdom"==e?"https://cdn.stamped.io/cdn/flags/gb.svg":""}function getReviewsSummaryText(e){const t=document.createElement("p");return t.classList.add("v2-reviews-summary__text"),t.innerText=`${e} reviews`,t}function getReviewsSummaryStars(e){const t=document.createElement("div");t.classList.add("v2-reviews-stars"),t.classList.add("v2-reviews-summary__stars"),t.setAttribute("data-rating",`${Math.round(Math.round(10*e)/10)}`);for(let e=0;e<5;e++){const e=document.createElement("span");e.classList.add("stars__star"),t.appendChild(e)}return t}

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.