diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..7ebb957 --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine On +RewriteRule ^captcheck.dist.js captcheck.min.js [L] \ No newline at end of file diff --git a/captcheck.dist.js b/captcheck.dist.js deleted file mode 100644 index c08790f..0000000 --- a/captcheck.dist.js +++ /dev/null @@ -1 +0,0 @@ -window.onload=function(){var e="https://captcheck.netsyms.com/api.php";function t(e,t){return document.getElementById("captcheck_"+e+"_answer_"+t).checked=!0,!1}function a(e){var t=document.getElementById("captcheck_"+e+"_alt_question_button"),a=document.getElementById("captcheck_"+e+"_question_image"),n=document.getElementById("captcheck_"+e+"_question_access"),c=document.getElementById("captcheck_"+e+"_answer_images"),i=document.getElementById("captcheck_"+e+"_answer_access");"> Text mode"==t.innerHTML?(t.innerHTML="> Image mode",a.style.display="none",n.style.display="initial",c.style.display="none",i.style.display="initial",i.innerHTML=""):(t.innerHTML="> Text mode",a.style.display="initial",n.style.display="none",c.style.display="initial",i.style.display="none",i.innerHTML="")}var n="";Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"),function(c){c.dataset.stylenonce&&(n=c.dataset.stylenonce);var i=new XMLHttpRequest;i.open("GET",e+"?action=new",!0),i.onreadystatechange=function(){if(4==this.readyState){var n=this.status,i=this.responseText,s=document.createElement("div");if(s.setAttribute("class","captcheck_box"),c.appendChild(s),200==n){for(var r=JSON.parse(i),o=r.id_prefix,d="
",l=0,p=r.answers.length;l"}d+="
";var u=document.createElement("div");u.innerHTML=d+"
";var h=document.createElement("div");h.setAttribute("class","captcheck_label_message"),h.setAttribute("id","captcheck_"+o+"_label_message"),h.innerHTML=""+r.question_i+""+r.question_a+"> Text mode",s.appendChild(h),s.appendChild(u);var m=document.createElement("span");m.innerHTML="",s.appendChild(m);var k=document.querySelectorAll('.captcheck_answer_label[data-prefix="'+o+'"]');for(l=0;linput{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit;border:0}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}",document.body.appendChild(c)}; \ No newline at end of file diff --git a/captcheck.min.js b/captcheck.min.js new file mode 100644 index 0000000..551c07f --- /dev/null +++ b/captcheck.min.js @@ -0,0 +1,10 @@ +/* 2018 Netsyms Technologies. See repository license. */ +window.onload=function(){function m(c,g){document.getElementById("captcheck_"+c+"_answer_"+g).checked=!0;return!1}function n(c){var g=document.getElementById("captcheck_"+c+"_alt_question_button"),b=document.getElementById("captcheck_"+c+"_question_image"),d=document.getElementById("captcheck_"+c+"_question_access"),f=document.getElementById("captcheck_"+c+"_answer_images");c=document.getElementById("captcheck_"+c+"_answer_access");"> Text mode"==g.innerHTML?(g.innerHTML="> Image mode",b.style.display= +"none",d.style.display="initial",f.style.display="none",c.style.display="initial",c.innerHTML=""):(g.innerHTML="> Text mode",b.style.display="initial",d.style.display="none",f.style.display="initial",c.style.display="none",c.innerHTML="")}var k="";Array.prototype.forEach.call(document.getElementsByClassName("captcheck_container"),function(c){c.dataset.stylenonce&&(k=c.dataset.stylenonce); +var g=new XMLHttpRequest;g.open("GET","https://captcheck.netsyms.com/api.php?action=new",!0);g.onreadystatechange=function(){if(4==this.readyState){var b=this.status,d=this.responseText;if(""==c.innerHTML.trim()){var f=document.createElement("div");f.setAttribute("class","captcheck_box");c.appendChild(f);if(200==b){d=JSON.parse(d);b=d.id_prefix;for(var h="
",e=0,g=d.answers.length;e";h+="
";e=document.createElement("div");e.innerHTML=h+"
";h=document.createElement("div");h.setAttribute("class","captcheck_label_message");h.setAttribute("id","captcheck_"+b+"_label_message");h.innerHTML=""+d.question_i+""+d.question_a+"> Text mode"; +f.appendChild(h);f.appendChild(e);h=document.createElement("span");h.innerHTML="";f.appendChild(h);f=document.querySelectorAll('.captcheck_answer_label[data-prefix="'+b+'"]');for(e=0;einput{visibility:hidden;position:absolute}.captcheck_answer_label>input+img{cursor:pointer;border:2px solid transparent;border-radius:3px;min-width:32px;width:18%;max-width:64px}.captcheck_answer_label>input:checked+img{cursor:pointer;border:2px solid #424242;border-radius:3px}.captcheck_error_message{color:red}.captcheck_question_image{display:initial}.captcheck_question_access{display:none}.captcheck_alt_question_button{float:right;font-size:80%;cursor:pointer;color:inherit;text-decoration:inherit;border:0}.captcheck_answer_images{display:initial}.captcheck_answer_access{display:none}"; +document.body.appendChild(l)}; \ No newline at end of file diff --git a/index.html b/index.html index 40e1481..c02f060 100644 --- a/index.html +++ b/index.html @@ -100,7 +100,7 @@
Put this in your page somewhere: -
<script src="https://captcheck.netsyms.com/captcheck.dist.js"></script>
+
<script src="https://captcheck.netsyms.com/captcheck.min.js"></script>
Put this in your form where you want the CAPTCHA:
<div class="captcheck_container"></div>
Put this in your server-side form validation (PHP example): diff --git a/readme.md b/readme.md index 057b9d2..0337d22 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ How to use ---------- In your form, put an empty div with the class "captcheck_container". -Add `captcheck.js` (or `captcheck.dist.js`) into your page. +Add `captcheck.js` (or `captcheck.min.js`) into your page. diff --git a/test.html b/test.html index 6d21587..46bf4dc 100644 --- a/test.html +++ b/test.html @@ -1,17 +1,12 @@ - - - Captcheck Sample Form - - - - - -
- -
-
- -
- - + +Captcheck Sample Form + + + +
+ +
+
+ +
\ No newline at end of file