From f61e08d6995e4bc76eaa1103095d6f62a61ca4c2 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 10 Jun 2017 21:08:38 -0600 Subject: [PATCH] Add minified version (captcheck.dist.js) and nice version of the CSS --- captcheck.css | 45 +++++++++++++++++++++++++++++++++++++++++++++ captcheck.dist.js | 1 + captcheck.js | 1 + 3 files changed, 47 insertions(+) create mode 100644 captcheck.css create mode 100644 captcheck.dist.js diff --git a/captcheck.css b/captcheck.css new file mode 100644 index 0000000..83783c8 --- /dev/null +++ b/captcheck.css @@ -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; +} \ No newline at end of file diff --git a/captcheck.dist.js b/captcheck.dist.js new file mode 100644 index 0000000..36d1f33 --- /dev/null +++ b/captcheck.dist.js @@ -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+=""}var l=document.createElement("div");l.innerHTML=i;var h=document.createElement("div");h.setAttribute("class","captcheck_label_message"),h.innerHTML="Click on the "+r.question+":",s.appendChild(h),s.appendChild(l);var u=document.createElement("span");u.innerHTML="",s.appendChild(u)}else s.innerHTML="There was a problem loading the CAPTCHA."})}; \ No newline at end of file diff --git a/captcheck.js b/captcheck.js index 79dfec1..44bb0e6 100644 --- a/captcheck.js +++ b/captcheck.js @@ -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);