PageSourceSearch

https://gfx.wiadomosci.radiozet.pl/extension/radiozet2/design/stan…/Quiz-chunk.js?s=2f6c59708e45c3664efd

js radiozet.pl collected 2026-10-02 02:48:25 UTC 18,270 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkradiozet=self.webpackChunkradiozet||[]).push([[55],{305:(e,t,r)=>{function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof(t)?t:t+""}r.d(t,{Z:()=>n});const n=function(){return function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function Position(){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Position)}),null,[{key:"getPosition",value:function getPosition(e){for(var t=0;e;)e.tagName,t+=e.offsetTop+e.clientTop,e=e.offsetParent;return{y:t}}}])}()},859:(e,t,r)=>{function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof(t)?t:t+""}r.d(t,{Z:()=>n});const n=function(){return function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function Scroll(){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Scroll)}),null,[{key:"scrollTo",value:function(e){function scrollTo(t,r){return e.apply(this,arguments)}return scrollTo.toString=function(){return e.toString()},scrollTo}((function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:600;if(!(r<=0)){var n=(t-e.scrollTop)/r*10;setTimeout((function(){e.scrollTop=e.scrollTop+n,e.scrollTop!==t&&scrollTo(e,t,r-10)}),10)}}))}])}()},190:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var n=r(859),o=r(305),i=r(148);function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof(t)?t:t+""}var s=function(){return function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function Quiz(){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Quiz),this.CheckDOMElement=document.querySelector("#quiz--full"),this.quizID=this.CheckDOMElement.dataset.id,this.answersLabel=this.CheckDOMElement.querySelectorAll(".quiz__question__answer"),this.questions=this.CheckDOMElement.querySelectorAll(".quiz__question"),this.answers=this.setAnswersOnStart(),this.storageLabel="quiz-".concat(this.quizID),this.answersVoted=!1,this.sumVoted=0,this.points={score:0,max:0},this.hash=!1,this.init()}
1),[{key:"init",value:function init(){this.checkHash(),this.quizNav(),this.checkDataInBrowser()?(this.getAnswersFromBrowser(),this.markQuestions(),this.markCheckAnswer(),"0"==this.CheckDOMElement.dataset.type&&this.markCheckQuizNav(),this.calculatePoints(),this.scorePoints(),this.renderPrecent(),this.selectResults(),this.resetQuizButton(),this.diableClickMark(),this.quizAnhorLinkToAnswer(),this.facebookShare(),this.state("result")):(this.selectAnswer(),this.detectEmbedAnswer(),this.state())}},{key:"detectEmbedAnswer",value:function detectEmbedAnswer(){return new Promise((function(e){if(null!==sessionStorage.getItem("embed-quiz-answer")){var t=JSON.parse(sessionStorage.getItem("embed-quiz-answer")),r=Object.keys(t)[0],n=document.querySelector('input[name="'+r+'"][data-key="'+t[r].key+'"]');setTimeout((function(){n.click(),sessionStorage.removeItem("embed-quiz-answer")}),1e3)}return e()}))}},{key:"getAnswersFromBrowser",value:function getAnswersFromBrowser(){this.answersVoted=JSON.parse(sessionStorage.getItem(this.storageLabel))}},{key:"markQuestions",value:function markQuestions(){for(var e=0;e<this.questions.length;e++)this.questions[e].classList.remove("quiz__question--no-vote"),this.questions[e].classList.add("quiz__question--voted")}},{key:"markCheckAnswer",value:function markCheckAnswer(){var e=this;Object.keys(this.answersVoted).map((function(t){var r=document.querySelector('input[name="'.concat(t,'"][value="').concat(e.answersVoted[t].score,'"][data-key="').concat(e.answersVoted[t].key,'"]'));null!==r&&(r.parentNode.classList.add("quiz__question__answer--voted"),r.checked=!0)}))}},{key:"quizNav",value:function quizNav(){var e=document.querySelector(".full--quiz__nav__list");e&&e.addEventListener("click",(function(e){var t,r,i=e.target;if(i.dataset.order||(i=i.closest(".full--quiz__nav__list__item")),null!==(t=i)&&void 0!==t&&null!==(r=t.dataset)&&void 0!==r&&r.order){var s=i.dataset.order,a=document.querySelectorAll(".full--quiz__answers .quiz__question"),c=_toConsumableArray(a).findIndex((function(e){return e.dataset.order.split("-")[0]==s}));if(void 0!==c&&a[c]){var u=document.querySelector("#header__main")||document.querySelector(".radiozet-header");n.Z.scrollTo(document.body,o.Z.getPosition(a[c]).y-u.clientHeight-40)}}}))}},{key:"markCheckQuizNav",value:function markCheckQuizNav(){var e=this;Object.keys(this.answersVoted).map((function(t){var r=document.querySelector('input[name="'.concat(t,'"][value="').concat(e.answersVoted[t].score,'"][data-key="').concat(e.answersVoted[t].key,'"]'));if(null!==r){var n=r.closest(".quiz__question").dataset.order.split("-")[0],o=document.querySelector('.full--quiz__nav__list__item[data-order="'.concat(n,'"]'));if(o){var i="voted";i=1==r.value?"correct":"wrong",o.setAttribute("data-state",i)}}}))}},{key:"calculatePoints",value:function calculatePoints(){for(var e=0,t=0;t<this.questions.length;t++){for(var r=this.questions[t].querySelectorAll('input[type="radio"]'),n=0,o=0;o<r.length;o++)n<r[o].value&&(n=parseInt(r[o].value));e+=parseInt(n)}this.points.max=e}},{key:"scorePoints",value:function scorePoints(){var e=this,scorePoints=0;Object.keys(this.answersVoted).map((function(t){scorePoints+=parseInt(e.answersVoted[t].score)})),this.points.score=scorePoints}},{key:"selectResults",value:function selectResults(){var e=document.querySelectorAll(".quiz__score .quiz__score__desc__item"),t=!1;"2"==this.CheckDOMElement.dataset.type&&(t=this.getMaxAnswers());for(var r=0;r<e.length;r++)if("2"==this.CheckDOMElement.dataset.type){if(parseInt(e[r].dataset.rate)==t)return this.fillResult(e[r]),document.querySelector(".quiz__score .quiz__score__desc").classList.add("quiz__score__desc--checked"),!1}else parseInt(e[r].dataset.rateStart)<=this.points.score&&parseInt(e[r].dataset.rateEnd)>=this.points.score&&(this.fillResult(e[r]),document.querySelector(".quiz__score .quiz__score__desc").classList.add("quiz__score__desc--checked"))}},{key:"getMaxAnswers",value:function getMaxAnswers(){var e=[];for(var t in this.answersVoted)e.push(this.answersVoted[t].score);e.sort();for(var r=null,n=0,o=null,i=0,s=0;s<e.length;s++)e[s]!=o?(i>0&&o!=r&&i>n&&(r=o,n=i),o=e[s],i=1):i++;return o!=r&&i>n&&(r=o,n=i),r}},{key:"fillResult",value:function fillResult(e){null!==e.querySelector(".points__score")&&e.querySelector(".points__score").insertAdjacentHTML("beforeend",this.points.score),null!==e.querySelector(".points__max")&&e.querySelector(".points__max").insertAdjacentHTML("beforeend",this.points.max),e.classList.add("quiz__score__desc__item--active")}}
1,{key:"renderPrecent",value:function renderPrecent(){null!==document.querySelector(".quiz__score__percent__content__value")&&(this.calculatePercent()&&this.animateValue({handle:document.querySelector(".quiz__score__percent__content__value"),start:0,end:this.calculatePercent(),char:"%"}))}},{key:"animateValue",value:function animateValue(e){var t=e.handle,r=e.start,n=void 0===r?0:r,o=e.end,i=e.char,s=e.duration,a=void 0===s?1e3:s,c=null,u=function step(e){c||(c=e);var r=Math.min((e-c)/a,1);t.innerHTML="".concat(Math.floor(r*(o-n)+n)).concat(i||""),r<1&&window.requestAnimationFrame(u)};window.requestAnimationFrame(u)}},{key:"calculatePercent",value:function calculatePercent(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.points.score,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.points.max;return Math.round(100*e/t)}},{key:"selectAnswer",value:function selectAnswer(){for(var e=this,t=this.CheckDOMElement.querySelectorAll('.quiz__question__answer input[type="radio"]'),r=0;r<t.length;r++)t[r].addEventListener("change",(function(t){e.checkAnswer(t)}))}},{key:"checkAnswer",value:function checkAnswer(e){var t=this;this.addAnswer(e.currentTarget,e.target.closest(".quiz__question")),this.markAnswer(e.target.closest(".quiz__question__answer")),this.markNavItem(e.target.closest(".quiz__question")),this.checkAllAnswersChecked()?setTimeout((function(){var e=document.querySelector("#header__main")||document.querySelector(".radiozet-header");n.Z.scrollTo(document.body,o.Z.getPosition(t.getSendButton(t.CheckDOMElement.querySelector(".send-quiz-button"))).y-e.clientHeight-20)}),500):this.moveToNextAnswer(e.target.closest(".quiz__question"))}},{key:"getSendButton",value:function getSendButton(e){var t=e.previousElementSibling||e.parentNode.previousElementSibling;return t.classList.contains("advert")&&t.clientHeight>0||e.parentNode.previousElementSibling.classList.contains("advert")&&t.clientHeight>0?t:e}},{key:"markAnswer",value:function markAnswer(e){console.log("element",e);for(var t="quiz__question__answer--vote",r=e.closest("#quiz--full").querySelectorAll(".quiz__question__answer"),n=0;n<r.length;n++)!r[n].querySelector("input").checked&&r[n].classList.contains(t)&&r[n].classList.remove(t);e.closest(".quiz__question").classList.contains("quiz__question--vote")||e.closest(".quiz__question").classList.add("quiz__question--vote"),e.classList.add(t)}},{key:"markNavItem",value:function markNavItem(e){var t=e.dataset.order.split("-")[0],r=document.querySelector('.full--quiz__nav__list__item[data-order="'.concat(t,'"]'));r&&r.setAttribute("data-state","voted")}},{key:"diableClickMark",value:function diableClickMark(){for(var e=0;e<this.answersLabel.length;e++)this.answersLabel[e].addEventListener("click",(function(e){e.preventDefault()}))}},{key:"moveToNextAnswer",value:function moveToNextAnswer(e){var t=e.dataset.order.split("-")[0],r=e.dataset.order.split("-")[1],i=this.getNextElement(t,r),s=o.Z.getPosition(i);setTimeout((function(){var e=document.querySelector("#header__main")||document.querySelector(".radiozet-header");n.Z.scrollTo(document.body,s.y-e.clientHeight-20)}),500)}},{key:"getNextElement",value:function getNextElement(e,t){for(var r=!1,n=parseInt(e);n<=parseInt(t);n++){var o=document.querySelector('.quiz__question[data-order="'.concat(n,"-").concat(t,'"]'));if(o&&!o.classList.contains("quiz__question--vote")){r=o;break}}if(!r)for(var i=1;i<parseInt(e);i++){var s=document.querySelector('.quiz__question[data-order="'.concat(i,"-").concat(t,'"]'));if(s&&!s.classList.contains("quiz__question--vote")){r=s;break}}return r.previousElementSibling&&r.previousElementSibling.classList.contains("advert")&&r.previousElementSibling.clientHeight>0?r.previousElementSibling:r}},{key:"setAnswersOnStart",value:function setAnswersOnStart(){for(var e={},t=this.answersLabel,r=0;r<t.length;r++)e["".concat(t[r].querySelector("input").getAttribute("name"))]=!1;return e}},{key:"addAnswer",value:function addAnswer(e){this.answers[e.getAttribute("name")]={score:e.value,key:e.dataset.key},this.checkAllAnswersChecked()&&(this.generateHash(),this.sendQuizButton(!0))}},{key:"generateHash",value:function generateHash(){this.hash=Date.now().toString(36)}},{key:"checkAllAnswersChecked",value:function checkAllAnswersChecked(){var e=this,t=!0;return Object.keys(this.answers).map((function(r){if(!1===e.answers[r])return t=!1,!1})),t}},{key:"sendQuizButton",value:function sendQuizButton(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.CheckDOMElement.querySelector(".send-quiz-button");t&&(r.classList.remove("btn--disabled"),r.addEventListener("click",(function(){e.sendQuiz()})))}},{key:"sendQuiz",value:function sendQuiz(){var e=document.querySelector("#header__main")||document.querySelector(".radiozet-header");n.Z.scrollTo(document.body,o.Z.getPosition(this.CheckDOMElement).y-e.clientHeight),this.state("loading"),this.setDataInBrowser(),window.location="".concat(window.location.origin).concat(window.location.pathname,"/(result)/").concat(this.hash)}},{key:"state",value:function state(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"show";return new Promise((function(r){switch(t){case"loading":e.CheckDOMElement.classList.add("preloader");break;case"result":e.CheckDOMElement.classList.remove("preloader"),e.CheckDOMElement.classList.add(t)}return r()}))}},{key:"checkDataInBrowser",value:function checkDataInBrowser(){return null!==sessionStorage.getItem(this.storageLabel)}},{key:"checkHash",value:function checkHash(){var e=!1;return this.CheckDOMElement.dataset.result&&!sessionStorage.getItem(this.storageLabel+"__hash")&&(e=!0),!this.CheckDOMElement.dataset.result&&sessionStorage.getItem(this.storageLabel+"__hash")&&(e=!0),sessionStorage.getItem(this.storageLabel+"__hash")&&this.CheckDOMElement.dataset.result&&sessionStorage.getItem(this.storageLabel+"__hash")!=this.CheckDOMElement.dataset.result&&(e=!0),!e||(this.resetQuiz(this.CheckDOMElement.dataset.id),!1)}},{key:"setDataInBrowser",value:function setDataInBrowser(){sessionStorage.setItem(this.storageLabel,JSON.stringify(this.answers)),sessionStorage.setItem("".concat(this.storageLabel,"__hash"),this.hash)}},{key:"resetQuizButton",value:function resetQuizButton(){for(var e=this,t=document.querySelectorAll(".quiz__score__button__reset"),r=0;r<t.length;r++)t[r].addEventListener("click",(function(t){t.currentTarget.dataset.id;e.resetQuiz(t.currentTarget.dataset.id)}
1))}},{key:"resetQuiz",value:function resetQuiz(e){sessionStorage.removeItem("quiz-".concat(e)),sessionStorage.removeItem("quiz-".concat(e,"__hash")),this.state("loading").then((function(){var e=String(window.location.href.replace(/\/\(result\)\/(.*)/,""));window.location=e}))}},{key:"quizAnhorLinkToAnswer",value:function quizAnhorLinkToAnswer(){for(var e=document.querySelectorAll(".quiz__score__anhorLink"),t=0;t<e.length;t++)e[t].addEventListener("click",(function(){var e=document.querySelector("#header__main")||document.querySelector(".radiozet-header");n.Z.scrollTo(document.body,o.Z.getPosition(document.querySelector(".full--quiz__answers")).y-e.clientHeight)}))}},{key:"facebookShare",value:function facebookShare(){var e=document.querySelector(".quiz__score__button.btn--social--facebook");if(null!==e){var t=document.querySelector('meta[property="og:image"]').getAttribute("content"),r=document.querySelector("#facebook-share-data").dataset.desc;r=""!==r&&null!==document.querySelector(".quiz__score--show .quiz__score__title")?r.replace("*",document.querySelector(".quiz__score--show .quiz__score__title").innerText):"Mój wynik to ".concat(this.points.score,"/").concat(this.points.max,". Rozwiąż Quiz!");var n=null!==document.querySelector('meta[property="og:description"]')?document.querySelector('meta[property="og:description"]').getAttribute("content"):"",o=encodeURI(document.location.href.split("/(")[0]),s="https://www.facebook.com/dialog/feed?app_id=".concat(i.Cx,"&caption=Chillizet.pl&name=").concat(r,"&description=").concat(n,"&display=popup&link=").concat(o,"&redirect_uri=").concat(o,"&picture=").concat(t,"&locale=pl_PL'");e.addEventListener("click",(function(){return window.open(s,"","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600"),!1}))}}}])}()}}]);

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.