Browse Source

Add minified version (captcheck.dist.js) and nice version of the CSS

tags/v0.3
Skylar Ittner 2 years ago
parent
commit
f61e08d699
3 changed files with 47 additions and 0 deletions
  1. 45
    0
      captcheck.css
  2. 1
    0
      captcheck.dist.js
  3. 1
    0
      captcheck.js

+ 45
- 0
captcheck.css View File

@@ -0,0 +1,45 @@
/**
CSS code that captcheck.js injects into the page.

Don't use this file in your site; captcheck.js contains it.
*/
.captcheck_box {
font-family: Ubuntu, Arial, sans-serif;
color: black;
border: 1px solid #e0e0e0;
border-radius: 3px;
display: inline-block;
padding: 3px;
margin: 5px 2px 5px 1px;
background-color: #f5f5f5;
}

.captcheck_label_message,
.captcheck_label_message b {
color: black;
font-family: Ubuntu, Arial, sans-serif;
}

.captcheck_answer_label > input {
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;
}

+ 1
- 0
captcheck.dist.js View File

@@ -0,0 +1 @@
function chooseAnswer(e){var a=document.getElementById("captcheck_answer_"+e);a.checked=!0}window.onload=function(){var e="https://captcheck.netsyms.com/api.php",a=function(e,a){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){4==this.readyState&&a(this.status,this.responseText)},n.send()};a(e+"?action=new",function(a,n){var c=document.createElement("style");c.innerHTML=".captcheck_box,.captcheck_label_message,.captcheck_label_message b{color:#000;font-family:Ubuntu,Arial,sans-serif}.captcheck_box{border:1px solid #e0e0e0;border-radius:3px;display:inline-block;padding:3px;margin:5px 2px 5px 1px;background-color:#f5f5f5}.captcheck_answer_label>input{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}",document.body.appendChild(c);var t=document.getElementById("captcheck_container"),s=document.createElement("div");if(s.setAttribute("class","captcheck_box"),t.appendChild(s),200==a){for(var r=JSON.parse(n),i="",o=0,p=r.answers.length;p>o;o++){var d=e+"?action=img&s="+r.session+"&c="+r.answers[o];i+="<span class='captcheck_answer_label' onclick='chooseAnswer(\""+r.answers[o]+"\")'><input id='captcheck_answer_"+r.answers[o]+"' type='radio' name='captcheck_selected_answer' value='"+r.answers[o]+"' /><img src='"+d+"' /></span>"}var l=document.createElement("div");l.innerHTML=i;var h=document.createElement("div");h.setAttribute("class","captcheck_label_message"),h.innerHTML="Click on the <b>"+r.question+"</b>:",s.appendChild(h),s.appendChild(l);var u=document.createElement("span");u.innerHTML="<input type='hidden' name='captcheck_session_code' value='"+r.session+"' />",s.appendChild(u)}else s.innerHTML="<span class='captcheck_error_message'>There was a problem loading the CAPTCHA.</span>"})};

+ 1
- 0
captcheck.js View File

@@ -13,6 +13,7 @@ window.onload = function () {
getJSON(api_url + "?action=new", function (status, json) {
/* Add custom styles */
var styles = document.createElement('style');
/* Remove newlines/comments from captcheck.css and put it here */
styles.innerHTML = ".captcheck_box {font-family: Ubuntu, Arial, sans-serif; color: black; border: 1px solid #e0e0e0; border-radius: 3px; display: inline-block; padding: 3px; margin: 5px 2px 5px 1px; background-color: #f5f5f5;} .captcheck_label_message, .captcheck_label_message b {color: black; font-family: Ubuntu, Arial, sans-serif;} .captcheck_answer_label > input {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;}";
document.body.appendChild(styles);


Loading…
Cancel
Save