"use strict"; /** * @class Oposito * @constructor * @returns {void} * @access public * @static */ const Oposito = (function(){ /** * @constructs Oposito * @returns {void} * @access private * @static */ const Oposito = function(){}; /** * @returns {void} * @access public * @static */ Oposito.load_test = () => { console.log(JSON.stringify([{ origin : "oposito.es", title : document.querySelector("h1").innerText.trim(), sources : [window.location.href], queries : [...document.querySelectorAll(".test-container>.test-question")].map(question => ({ question : question.querySelector("p").innerText.trim(), ...[...question.querySelectorAll(".test-option")].reduce((answers, answer) => { answers[answer.getAttribute("data-correct") == "true" ? "rights" : "wrongs"].push(answer.innerText.trim()); return answers; }, {rights: [], wrongs: []}) })) }])); }; /** * @returns {void} * @access public * @static */ Oposito.quit_cookies = () => { /** @type {HTMLBodyElement} */ const body = document.querySelector("body"); [ "CybotCookiebotDialog", "CybotCookiebotDialogBodyUnderlay" ].forEach(id => { /** @type {HTMLElement} */ const cookie_item = document.querySelector("#" + id); cookie_item && cookie_item.remove(); }); body.hasAttribute("style") && body.removeAttribute("style"); }; return Oposito; })(); Oposito.quit_cookies(); Oposito.load_test();