Minify JS and CSS for production.
This commit is contained in:
parent
4bac5c10a0
commit
f7a07182c1
BIN
production/images/refresh.png
Normal file
BIN
production/images/refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 355 B |
1
production/script.js
Normal file
1
production/script.js
Normal file
@ -0,0 +1 @@
|
||||
!function(e){let t=e.querySelectorAll("div.captcha-service-kor-elf");function n(e){e.style.display="none"}function c(t,n,c,a){let i=t.querySelector("div.window-captcha__content__body");if(i.querySelectorAll(".loading").length>0)return null;i.innerHTML='<div class="loading"></div>',fetch(n+"/api/v1/captcha",{headers:{"Content-Type":"application/json",Accept:"application/json","public-token":c}}).then(e=>e.json()).then(function(t){let r=t.image_body.width,l=t.image_body.height;i.innerHTML=`<form method="post"><div class="window-captcha__content__body__head"><img src="${t.image_head.base64}" width="100%"></div><p>Выберите значение в том порядке, на котором на картинке выше:</p><div class="window-captcha__content__body__coordinator"><img src="${t.image_body.base64}" width="100%" /></div><input type="hidden" name="captcha_key" class="captcha_key" value="${t.captcha_key}" /><button type="button" class="window-captcha__content__body__button">Я не робот!</button></form>`;let d=i.querySelector("div.window-captcha__content__body__coordinator"),s=d.querySelector("img");s.addEventListener("click",function(t){let n=e.createElement("div");n.style.left=t.offsetX/s.width*100+"%",n.style.top=t.offsetY/s.height*100+"%",n.classList.add("pointer");let c=t.offsetX*(r/s.width),o=t.offsetY*(l/s.height),a=d.querySelectorAll(".pointer").length+1;n.innerHTML=`<span class="pounter__number">${a}</span><input type="hidden" class="x" name="pointer[][x]" value="${Math.round(c)}" /><input type="hidden" class="y" name="pointer[][y]" value="${Math.round(o)}" />`,n.addEventListener("click",function(){n.remove(),d.querySelectorAll(".pointer").forEach(function(e,t){e.querySelector("span.pounter__number").textContent=t+1})}),d.appendChild(n)}),i.querySelector(".window-captcha__content__body__button").addEventListener("click",function(){(function t(n,c,a,i){let r=n.querySelector("button.window-captcha__content__body__button");if(r.querySelectorAll(".loading").length>0)return null;let l=e.createElement("span");l.classList.add("loading"),r.appendChild(l);let d={captcha_key:n.querySelector(".captcha_key").value,verification:[]};n.querySelectorAll(".pointer").forEach(function(e){d.verification.push({x:e.querySelector(".x").value,y:e.querySelector(".y").value})}),fetch(c+"/api/v1/captcha",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","public-token":a},body:JSON.stringify(d)}).then(e=>{if(429===e.status){o("Вы превысили количество попыток. Обновите каптчу.",r);return}return e.json()}).then(function(t){if(void 0!==t.errors){let n="";for(let c in t.errors)n+=t.errors[c]+"<br>";""===n&&(n=t.message),o(n,r);return}if(void 0===t.captcha_key){o("Произошла ошибка!",r);return}i.querySelector("button.button-open-window-captcha").remove();let a=e.createElement("div");a.innerHTML=`<span class="captcha-verified">Ура!!! Проверку прошли!</span><input type="hidden" name="captcha-verified" value="${t.captcha_key}">`,i.appendChild(a),i.querySelector(".window-captcha").remove()}).catch(e=>{o("Произошла ошибка!",r)}).finally(function(){l.remove()})})(i,n,c,a)})}).catch(e=>{i.innerHTML=`<div class="window-captcha__content__body__error">Произошла ошибка, сервис с каптчей не ответил. Попробуйте ещё раз!</div>`})}function o(t,n){let c=e.createElement("div");c.classList.add("error-message"),c.innerHTML=t,n.before(c),setTimeout(function(){c.remove()},3e3)}t.forEach(function(t){let o=t.attachShadow({mode:"closed"}),a=e.createElement("button"),i=e.createElement("link"),r=t.getAttribute("data-domain"),l=t.getAttribute("data-token"),d=t.getAttribute("data-static-path"),s=null;i.rel="stylesheet",i.type="text/css",i.href=d+"/style.css",o.appendChild(i),a.textContent="Я не робот!",a.type="button",a.classList.add("button-open-window-captcha"),o.appendChild(a),a.addEventListener("click",function(){null===s&&(s=function t(o,a,i){let r=e.createElement("div");return r.classList.add("window-captcha"),r.innerHTML=`<div class="window-captcha__content"><div class="window-captcha__content__header">Я не робот! <button type="button" class="window-captcha__reload"></button><button type="button" class="window-captcha__close">X</button></div><div class="window-captcha__content__body"></div></div>`,o.appendChild(r),r.addEventListener("click",function(e){if(e.target!==r)return null;n(r)}),r.querySelector("button.window-captcha__close").addEventListener("click",function(){n(r)}),r.querySelector("button.window-captcha__reload").addEventListener("click",function(){c(r,a,i,o)}),r}(o,r,l)),s.style.display="block",c(s,r,l,o)})})}(document);
|
1
production/style.css
Normal file
1
production/style.css
Normal file
@ -0,0 +1 @@
|
||||
.button-open-window-captcha:hover,.window-captcha__close:hover,.window-captcha__content__body__button:hover{opacity:.8}.captcha-verified{background:#1d8100;border:1px solid #ddd;border-radius:90px;padding:10px 20px;color:#000;font-size:18px;font-weight:700;font-family:serif;display:inline-block;vertical-align:top}.button-open-window-captcha,.window-captcha__content__body__button{background:#68aaff;border:1px solid #ddd;border-radius:90px;padding:10px 20px;cursor:pointer;color:#000;font-size:18px;font-weight:700;font-family:serif}.window-captcha__content__body__button{border-radius:0;width:100%;padding:20px 0;border:0;position:relative}.window-captcha__content__body__button .loading{background:rgba(255,255,255,.48)}.window-captcha{background:rgba(0,0,0,.48);position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;display:none}.window-captcha__close{background:#961b1b;position:absolute;top:0;right:0;padding:15px;font-size:20px;font-weight:700;font-family:serif;color:#fff;border:0;cursor:pointer}.window-captcha__content{background:#fff;border-radius:3px;margin:20px auto;max-width:600px;box-shadow:3px 3px 10px rgba(0,0,0,.33)}.window-captcha__content__header{position:relative;font-size:20px;font-weight:700;color:#000;font-family:serif;padding:14px 40px 7px 20px;border-bottom:2px solid #ccc}.window-captcha__content__body .error-message,.window-captcha__content__body__error{color:#961b1b;font-size:16px;font-weight:700;padding:20px}.window-captcha__reload{background:url('images/refresh.png') center center no-repeat;width:32px;height:32px;border:1px solid #ddd;border-radius:90px;cursor:pointer;vertical-align:middle;margin-left:10px}.window-captcha__content__reload:hover{background-color:rgba(0,0,0,.15)}.window-captcha__content__body{min-height:400px;position:relative}.window-captcha__content__body .loading{position:absolute;left:0;top:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.window-captcha__content__body .loading:before{width:40px;height:40px;border:4px solid #ddd;border-top:4px solid #2e93e6;border-radius:50%;animation:.8s linear infinite sp-anime;display:flex;justify-content:center;align-items:center;content:' '}.window-captcha__content__body p{font-size:20px;font-weight:700;padding:5px 20px;font-family:serif}.window-captcha__content__body__coordinator{cursor:pointer;position:relative}.window-captcha__content__body__coordinator .pointer{background:#fff;position:absolute;border-radius:90px;border:1px solid #961b1b;width:30px;height:30px;margin:-15px 0 0 -15px;display:flex;align-items:center;justify-content:center;font-weight:700;font-family:serif;font-size:16px}.window-captcha__content__body__coordinator .pointer:hover span{font-size:0}.window-captcha__content__body__coordinator .pointer:hover span:after{content:"X";font-size:16px;color:#961b1b}.window-captcha__content__body__error{border:1px solid #961b1b;margin:20px}@keyframes sp-anime{100%{transform:rotate(360deg)}}
|
Loading…
Reference in New Issue
Block a user