1
/**
2
* Stellar
3
* Stellar is star rating system helps you rate and like articles on a website and keep track of results.
4
* Exclusively on https://1.envato.market/stellar
5
*
6
* @encoding UTF-8
7
* @version 2.1.11
8
* @copyright (C) 2018 - 2022 Merkulove ( https://merkulov.design/ ). All rights reserved.
9
* @license Envato License https://1.envato.market/KYbje
10
* @contributors Nemirovskiy Vitaliy (nemirovskiyvitaliy@gmail.com), Dmitry Merkulov (dmitry@merkulov.design)
11
* @support help@merkulov.design
12
**/
13
!function(){"use strict";document.addEventListener("DOMContentLoaded",(function(){if(document.querySelectorAll(".mdp-stellar-box").length<1)return;let e=[],t=function(){let e=JSON.parse(window.localStorage.getItem("mdpLocalStellarData"));null===e&&(e={}
14
,e.guid=n(),window.localStorage.setItem("mdpLocalStellarData",JSON.stringify(e)),window.sessionStorage.setItem("mdpSessionStellarData",JSON.stringify(e)));return e}
15
(),l=window.mdpStellar;void 0!==l.reset_timestamp&&t.timestamp<l.reset_timestamp&&(t={}
16
,t.guid=n(),t.timestamp=Math.floor(Date.now()/1e3),window.localStorage.setItem("mdpLocalStellarData",JSON.stringify(t)),window.sessionStorage.setItem("mdpSessionStellarData",JSON.stringify(t)));const r=document.querySelectorAll(".mdp-stellar-box");let a=JSON.parse(window.localStorage.getItem("mdpLocalStellarData")),s=JSON.parse(window.sessionStorage.getItem("mdpSessionStellarData"));function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}
17
))}
18
function o(e){if(null!==e.target.closest("i")){const t=e.target.closest("i"),l=t.closest(".mdp-box-icon"),r=l.getElementsByTagName("i"),a=t.getAttribute("data-id");if(r.length>0)for(let e=0;e<a;e++)r[e].classList.add("mdp-box-list-hover");if(t.classList.remove("mdp-stellar-hover"),null!==l.querySelector(".mdp-rating-res")&&(l.querySelector(".mdp-rating-res").innerText=a),null!==l.querySelector(".mdp-stellar-tooltip")){const e=l.querySelector(".mdp-stellar-tooltip"),r=t.getBoundingClientRect(),a=l.getBoundingClientRect();e.classList.add("mdp-stellar-tooltip-show"),e.style.bottom=r.top-a.top+r.height+16+4+"px",e.style.left=r.left-a.left+(r.width-e.getBoundingClientRect().width)/2+"px"}
19
}
20
}
21
function i(e){const t=e.toElement||e.relatedTarget,l=e.target;if(null!==e.target.closest("i")){const t=e.target.closest("i"),l=t.closest(".mdp-box-icon"),r=l.getElementsByTagName("i"),a=t.getAttribute("data-id");if(t.classList.remove("mdp-stellar-hover"),r.length>0)for(let e=0;e<r.length;e++)r[e].classList.remove("mdp-box-list-hover");null!==l.querySelector(".mdp-rating-res")&&(null!==l.querySelector(".mdp-stellar-tooltip")?l.querySelector(".mdp-rating-res").innerText=a:l.querySelector(".mdp-rating-res").innerText=0)}
22
null!==t&&(null!==t.querySelector(".mdp-box-icon")||l.classList.contains("mdp-stellar-tooltip")||"SPAN"===l.tagName)&&null!==document.querySelector(".mdp-stellar-tooltip-show")&&document.querySelector(".mdp-stellar-tooltip-show").classList.remove("mdp-stellar-tooltip-show")}
23
function c(e){const t=new XMLHttpRequest;t.open("POST",l.url+"?action=stellar_page_rating",!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.send(encodeURI("page_rating=1&stellar_id="+e.stellar_id)),t.onload=function(){if(t.status){if(200!==t.status)console.error("Request error. Returned status of "+t.status);else if(200===t.status){let e=JSON.parse(t.response);if(document.getElementsByClassName("mdp-stellar-results").length>0){const t=document.getElementsByClassName("mdp-stellar-results");for(let l=0;l<t.length;l++)t[l].innerText=e.page_rating}
24
}
25
}
26
else console.warn("Request failed! See below:")}
27
}
28
function d(r){if(null!==r.target.closest("i")){const a=r.target.closest("div.mdp-stellar-box").id.replace("mdp-stellar-",""),s=r.target.closest("i"),n=s.closest(".mdp-box-icon"),o=n.getElementsByTagName("i"),i=s.getAttribute("data-id"),d=n.getAttribute("data-rating"),g={stellar_id:a,rating:i,length:l.length,new_stellar:e["stellar"+a]&&0===e["stellar"+a]?0:1}
29
;if(function(t){const r=new XMLHttpRequest;let a=JSON.parse(window.localStorage.getItem("mdpLocalStellarData"));r.open("POST",l.url+"?action=process_stellar",!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(encodeURI("stellar_id="+t.stellar_id+"&rating="+t.rating+"&length="+t.length+"&guid="+a.guid+"&new_stellar="+t.new_stellar)),r.onload=function(){if(r.status){if(200!==r.status)console.error("Request error. Returned status of "+r.status);else if(200===r.status){e["stellar"+t.stellar_id]=0;let l=JSON.parse(r.response);void 0!==l.message&&console.warn(l.message)}
30
}
31
else console.warn("Request failed! See below:"),console.error(t)}
32
}
33
(g),setTimeout(()=>{c(g)}
34
,200),t["rating_"+a]=i,t.timestamp=Math.floor(Date.now()/1e3),t.best_rating=d,window.localStorage.setItem("mdpLocalStellarData",JSON.stringify(t)),window.sessionStorage.setItem("mdpSessionStellarData",JSON.stringify(t)),o.length>0){for(let e=0;e<o.length;e++)o[e].classList.remove("mdp-stellar-active"),o[e].querySelector("div").style.width="0";for(let e=0;e<i;e++)o[e].classList.add("mdp-stellar-active")}
35
n.parentNode.querySelector(".mdp-stellar-your-rating span").innerHTML=i,function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.classList.add("mdp-stellar-bubbles"),t.innerHTML='<g id="grp7" opacity="0" transform="translate(7 6)">\n <circle class="oval1" cx="2" cy="6" r="6"/><circle class="oval2" cx="5" cy="2" r="6"/>\n</g>\n<g id="grp6" opacity="0" transform="translate(0 28)">\n <circle class="oval1" cx="2" cy="7" r="5"/><circle class="oval2" cx="3" cy="2" r="7"/>\n</g>\n<g id="grp3" opacity="0" transform="translate(52 28)">\n <circle class="oval2" cx="2" cy="7" r="6"/><circle class="oval1" cx="4" cy="2" r="6"/>\n</g>\n<g id="grp2" opacity="0" transform="translate(44 6)">\n <circle class="oval2" cx="5" cy="6" r="5"/><circle class="oval1" cx="2" cy="2" r="7"/>\n</g>\n<g id="grp5" opacity="0" transform="translate(14 50)">\n <circle class="oval1" cx="6" cy="5" r="6"/><circle class="oval2" cx="2" cy="2" r="6"/>\n</g>\n<g id="grp4" opacity="0" transform="translate(35 50)">\n <circle class="oval1" cx="6" cy="5" r="5"/><circle class="oval2" cx="2" cy="2" r="7"/>\n</g>\n<g id="grp1" opacity="0" transform="translate(24 0)">\n <circle class="oval1" cx="2" cy="6" r="5"/><circle class="oval2" cx="5" cy="2" r="7"/>\n</g>',"object"==typeof getComputedStyle(e)&&getComputedStyle(e)["font-size"].length>0&&(t.style.top="-"+(getComputedStyle(e).paddingLeft.replace("px","")-1)+"px",t.style.transform="scale("+e.offsetWidth/60+")"),e.appendChild(t),setTimeout((function(){e.classList.add("mdp-stellar-rated"),t.classList.add("mdp-stellar-click")}
36
),50),setTimeout((function(){e.classList.remove("mdp-stellar-rated"),t.remove()}
37
),1e3)}
38
(s),null!==n.querySelector(".mdp-rating-res")&&(n.querySelector(".mdp-rating-res").innerText=i)}
39
}
40
function g(e){if(null===JSON.parse(window.localStorage.getItem("mdpLocalStellarData")))return;let l=JSON.parse(window.localStorage.getItem("mdpLocalStellarData"));const r=e.getElementsByTagName("i").length,a=e.id.replace("mdp-stellar-","");let s=0;void 0!==t["rating_"+a]&&(s=r===l.best_rating?t["rating_"+a]:Math.round(t["rating_"+a]/l.best_rating*r)),0!==s&&"off"===e.getAttribute("data-secrecy")&&e.setAttribute("data-rating",s),f(e),null!==e.querySelector(".mdp-rating-res")&&(e.querySelector(".mdp-rating-res").innerText=s)}
...
</html>