1/*! 2 * Validetta (http://lab.hasanaydogdu.com/validetta/) 3 * Version 1.0.1 ( 16-08-2015 ) 4 * Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE) 5 * Copyright 2013-2015 Hasan AydoÄdu - http://www.hasanaydogdu.com 6 */ 7//!function(a){"use strict";var b={},c={},d=new RegExp(/^([a-zA-Z]+)\[([\w\[\]]+)\]/i),e=new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/),f=new RegExp(/^[\-\+]?(\d+|\d+\.?\d+)$/),g={required:"This field is required. Please be sure to check.",email:"Your E-mail address appears to be invalid. Please be sure to check.",number:"You can enter only numbers in this field.",maxLength:"Maximum {count} characters allowed!",minLength:"Minimum {count} characters allowed!",maxChecked:"Maximum {count} options allowed. Please be sure to check.",minChecked:"Please select minimum {count} options.",maxSelected:"Maximum {count} selection allowed. Please be sure to check.",minSelected:"Minimum {count} selection allowed. Please be sure to check.",notEqual:"Fields do not match. Please be sure to check.",different:"Fields cannot be the same as each other",creditCard:"Invalid credit card number. Please be sure to check."},h={showErrorMessages:!0,display:"bubble",errorTemplateClass:"validetta-bubble",errorClass:"validetta-error",validClass:"validetta-valid",bubblePosition:"right",bubbleGapLeft:15,bubbleGapTop:0,realTime:!1,onValid:function(){},onError:function(){},validators:{}},i=function(a){return"string"==typeof a?a.replace(/^\s+|\s+$/g,""):a},j={required:function(a,b){switch(a.el.type){case"checkbox":return a.el.checked||g.required;case"radio":return this.radio.call(b,a.el)||g.required;case"select-multiple":return null!==a.val||g.required;default:return""!==a.val||g.required}},email:function(a){return e.test(a.val)||g.email},number:function(a){return f.test(a.val)||g.number},minLength:function(a){var b=a.val.length;return 0===b||b>=a.arg||g.minLength.replace("{count}",a.arg)},maxLength:function(a){return a.val.length<=a.arg||g.maxLength.replace("{count}",a.arg)},equalTo:function(a,b){return b.form.querySelector('input[name="'+a.arg+'"]').value===a.val||g.notEqual},different:function(a,b){return b.form.querySelector('input[name="'+a.arg+'"]').value!==a.val||g.different},creditCard:function(a){if(""===a.val)return!0;var b,c,d,e,f,h,i,j=0;if(b=new RegExp(/[^0-9]+/g),c=a.val.replace(b,""),i=c.length,16>i)return g.creditCard;for(f=0;i>f;f++)d=i-f,e=parseInt(c.substring(d-1,d),10),f%2===1?(h=2*e,h>9&&(h=1+(h-10))):h=e,j+=h;return j>0&&j%10===0?!0:g.creditCard},maxChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;if(0!==e)return e<=b.arg||g.maxChecked.replace("{count}",b.arg)}},minChecked:function(b,c){var d=a(c.form.querySelectorAll('input[type=checkbox][name="'+b.el.name+'"]'));if(0===d.index(b.el)){var e=d.filter(":checked").length;return e>=b.arg||g.minChecked.replace("{count}",b.arg)}},maxSelected:function(a){return null!==a.val?a.val.length<=a.arg||g.maxSelected.replace("{count}",a.arg):void 0},minSelected:function(a){return null!==a.val&&a.val.length>=a.arg||g.minSelected.replace("{count}",a.arg)},radio:function(a){var b=this.form.querySelectorAll('input[type=radio][name="'+a.name+'"]:checked').length;return 1===b},regExp:function(a,b){var c=b.options.validators.regExp[a.arg],d=new RegExp(c.pattern);return d.test(a.val)||c.errorMessage},remote:function(a){a.remote=a.arg},callback:function(a,b){var c=b.options.validators.callback[a.arg];return c.callback(a.el,a.val)||c.errorMessage}};b=function(b,c){this.handler=!1,this.options=a.extend(!0,{},h,c),this.form=b,this.xhr={},this.events()},b.prototype={constructor:b,events:function(){var b=this;a(this.form).submit(function(a){return c=this.querySelectorAll("[data-validetta]"),b.init(a)}),this.options.realTime===!0&&(a(this.form).find("[data-validetta]").not("[type=checkbox]").on("change",function(d){return c=a(this),b.init(d)}),a(this.form).find("[data-validetta][type=checkbox]").on("click",function(a){return c=b.form.querySelectorAll('[data-validetta][type=checkbox][name="'+this.name+'"]'),b.init(a)})),a(this.form).on("reset",function(){return a(b.form.querySelectorAll("."+b.options.errorClass+", ."+b.options.validClass)).removeClass(b.options.errorClass+" "+b.options.validClass),b.reset()})},init:function(a){return this.reset(c),this.checkFields(a),"submit"!==a.type?void 0:"pending"===this.handler?!1:this.handler===!0?(this.options.onError.call(this,a),!1):this.options.onValid.call(this,a)},checkFields:function(b){var e=this,f=[];this.getInvalidFields=function(){return f};for(var g=0,h=c.length;h>g;g++)if(!c[g].disabled){var k,l=c[g],m="",n=i(a(l).val()),o=l.getAttribute("data-validetta").split(",");this.tmp={},this.tmp={el:l,val:n,parent:this.parents(l)};for(var p=0,q=o.length;q>p;p++){var r,s=o[p].match(d);if(null!==s?("undefined"!=typeof s[2]&&(this.tmp.arg=s[2]),r=s[1]):r=o[p],(""!==n||l.hasAttribute("data-requiredifempty")||"required"===r||"equalTo"===r)&&j.hasOwnProperty(r)&&(k=j[r](e.tmp,e),"undefined"!=typeof k&&k!==!0)){var t=l.getAttribute("data-vd-message-"+r);null!==t&&(k=t),m+=k+"<br/>"}}""!==m?(f.push({field:l,errors:m}),this.addErrorClass(this.tmp.parent),this.window.open.call(this,l,m)):"undefined"!=typeof this.tmp.remote?this.checkRemote(l,b):("undefined"!=typeof k?this.addValidClass(this.tmp.parent):a(this.tmp.parent).removeClass(this.options.errorClass+" "+this.options.validClass),
7k=void 0)}},checkRemote:function(b,c){var d={},e={},f=b.name||b.id;"undefined"==typeof this.remoteCache&&(this.remoteCache={}),e[f]=this.tmp.val,d=a.extend(!0,{},{data:e},this.options.validators.remote[this.tmp.remote]||{});var g=a.param(d),h=this.remoteCache[g];if("undefined"!=typeof h)switch(h.state){case"pending":this.handler="pending",h.event=c.type;break;case"rejected":throw c.preventDefault(),new Error(h.result.message);case"resolved":h.result.valid===!1?(this.addErrorClass(this.tmp.parent),this.window.open.call(this,b,h.result.message)):this.addValidClass(this.tmp.parent)}else{var i=this.xhr[f];"undefined"!=typeof i&&"pending"===i.state()&&i.abort(),h=this.remoteCache[g]={state:"pending",event:c.type},this.remoteRequest(d,h,b,f)}},remoteRequest:function(b,c,d,e,f){var g=this;a(this.tmp.parent).addClass("validetta-pending"),this.xhr[e]=a.ajax(b).done(function(b){"object"!=typeof b&&(b=JSON.parse(b)),c.state="resolved",c.result=b,"submit"===c.event?(g.handler=!1,a(g.form).trigger("submit")):b.valid===!1?(g.addErrorClass(g.tmp.parent),g.window.open.call(g,d,b.message)):g.addValidClass(g.tmp.parent)}).fail(function(a,b){if("abort"!==b){var d="Ajax request failed for field ("+e+") : "+a.status+" "+a.statusText;throw c.state="rejected",c.result={valid:!1,message:d},new Error(d)}}).always(function(b){a(g.tmp.parent).removeClass("validetta-pending")}),this.handler="pending"},window:{open:function(b,c){if(!this.options.showErrorMessages)return void(this.handler=!0);var d=this.parents(b);if("undefined"==typeof d&&(d=b[0].parentNode),!d.querySelectorAll("."+this.options.errorTemplateClass).length){var e=document.createElement("span");if(e.className=this.options.errorTemplateClass+" "+this.options.errorTemplateClass+"--"+this.options.bubblePosition,"bubble"===this.options.display){var f,g=0,h=0;f=a(b).position(),"bottom"===this.options.bubblePosition?h=b.offsetHeight:g=b.offsetWidth,e.innerHTML="",e.style.top=f.top+h+this.options.bubbleGapTop+"px",e.style.left=f.left+g+this.options.bubbleGapLeft+"px"}d.appendChild(e),e.innerHTML=c,this.handler=!0}},close:function(a){a.parentNode.removeChild(a)}},reset:function(a){var b={};b="undefined"==typeof a||a.length>1&&"checkbox"!==a[0].type?this.form.querySelectorAll("."+this.options.errorTemplateClass):this.parents(a[0]).querySelectorAll("."+this.options.errorTemplateClass);for(var c=0,d=b.length;d>c;c++)this.window.close.call(this,b[c]);this.handler=!1},addErrorClass:function(b){a(b).removeClass(this.options.validClass).addClass(this.options.errorClass)},addValidClass:function(b){a(b).removeClass(this.options.errorClass).addClass(this.options.validClass)},parents:function(a){for(var b=parseInt(a.getAttribute("data-vd-parent-up"),10)||0,c=0;b>=c;c++)a=a.parentNode;return a}},a.fn.validetta=function(c,d){return a.validettaLanguage&&(g=a.extend(!0,{},g,a.validettaLanguage.messages)),"undefined"!=typeof d&&(g=a.extend(!0,{},g,d)),this.each(function(){new b(this,c)})}}(jQuery); 8 9! function(a) { 10 "use strict"; 11 var b = {}, 12 c = {}, 13 d = new RegExp(/^([a-zA-Z]+)\[([\w\[\]]+)\]/i), 14 e = new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/), 15 f = new RegExp(/^[\-\+]?(\d+|\d+\.?\d+)$/), 16 g = { 17 required: "This field is required. Please be sure to check.", 18 email: "Your E-mail address appears to be invalid. Please be sure to check.", 19 number: "You can enter only numbers in this field.", 20 maxLength: "Maximum {count} characters allowed!", 21 minLength: "Minimum {count} characters allowed!", 22 maxChecked: "Maximum {count} options allowed. Please be sure to check.", 23 minChecked: "Please select minimum {count} options.", 24 maxSelected: "Maximum {count} selection allowed. Please be sure to check.", 25 minSelected: "Minimum {count} selection allowed. Please be sure to check.", 26 notEqual: "Fields do not match. Please be sure to check.", 27 different: "Fields cannot be the same as each other", 28 creditCard: "Invalid credit card number. Please be sure to check." 29 }, 30 h = { 31 showErrorMessages: !0, 32 display: "bubble", 33 errorTemplateClass: "validetta-bubble", 34 errorClass: "validetta-error", 35 validClass: "validetta-valid", 36 bubblePosition: "right", 37 bubbleGapLeft: 15, 38 bubbleGapTop: 0, 39 realTime: !1, 40 onValid: function() {}, 41 onError: function() {}, 42 validators: {} 43 }, 44 i = function(a) { 45 return "string" == typeof a ? a.replace(/^\s+|\s+$/g, "") : a 46 }, 47 j = { 48 required: function(a, b) { 49 switch (a.el.type) { 50 case "checkbox": 51 return a.el.checked || g.required; 52 case "radio": 53 return this.radio.call(b, a.el) || g.required; 54 case "select-multiple": 55 return null !== a.val || g.required; 56 default: 57 return "" !== a.val || g.required 58 } 59 }, 60 email: function(a) { 61 return e.test(a.val) || g.email 62 }, 63 number: function(a) { 64 return f.test(a.val) || g.number 65 }, 66 minLength: function(a) { 67 var b = a.val.length; 68 return 0 === b || b >= a.arg || g.minLength.replace("{count}", a.arg) 69 }, 70 maxLength: function(a) { 71 return a.val.length <= a.arg || g.maxLength.replace("{count}", a.arg) 72 }, 73 equalTo: function(a, b) { 74 return b.form.querySelector('input[name="' + a.arg + '"]').value === a.val || g.notEqual 75 }, 76 different: function(a, b) { 77 return b.form.querySelector('input[name="' + a.arg + '"]').value !== a.val || g.different 78 }, 79 creditCard: function(a) { 80 if ("" === a.val) return !0; 81 var b, c, d, e, f, h, i, j = 0; 82 if (b = new RegExp(/[^0-9]+/g), c = a.val.replace(b, ""), i = c.length, 16 > i) return g.creditCard; 83 for (f = 0; i > f; f++) d = i - f, e = parseInt(c.substring(d - 1, d), 10), f % 2 === 1 ? (h = 2 * e, h > 9 && (h = 1 + (h - 10))) : h = e, j += h; 84 return j > 0 && j % 10 === 0 ? !0 : g.creditCard 85 }, 86 maxChecked: function(b, c) { 87 var d = a(c.form.querySelectorAll('input[type=checkbox][name="' + b.el.name + '"]')); 88 if (0 === d.index(b.el)) { 89 var e = d.filter(":checked").length; 90 if (0 !== e) return e <= b.arg || g.maxChecked.replace("{count}", b.arg) 91 } 92 }, 93 minChecked: function(b, c) { 94 var d = a(c.form.querySelectorAll('input[type=checkbox][name="' + b.el.name + '"]')); 95 if (0 === d.index(b.el)) { 96 var e = d.filter(":checked").length; 97 return e >= b.arg || g.minChecked.replace("{count}", b.arg) 98 } 99 }, 100 maxSelected: function(a) { 101 return null !== a.val ? a.val.length <= a.arg || g.maxSelected.replace("{count}", a.arg) : void 0 102 }, 103 minSelected: function(a) { 104 return null !== a.val && a.val.length >= a.arg || g.minSelected.replace("{count}", a.arg) 105 }, 106 radio: function(a) { 107 var b = this.form.querySelectorAll('input[type=radio][name="' + a.name + '"]:checked').length; 108 return 1 === b 109 }, 110 regExp: function(a, b) { 111 var c = b.options.validators.regExp[a.arg], 112 d = new RegExp(c.pattern); 113 return d.test(a.val) || c.errorMessage 114 }, 115 remote: function(a) { 116 a.remote = a.arg 117 }, 118 callback: function(a, b) { 119 var c = b.options.validators.callback[a.arg]; 120 return c.callback(a.el, a.val) || c.errorMessage 121 } 122 }; 123 b = function(b, c) { 124 this.handler = !1, this.options = a.extend(!0, {}, h, c), this.form = b, this.xhr = {}, this.events() 125 }, b.prototype = { 126 constructor: b, 127 events: function() { 128 var b = this; 129 a(this.form).submit(function(a) { 130 return c = this.querySelectorAll("[data-validetta]"), b.init(a) 131 }), this.options.realTime === !0 && (a(this.form).find("[data-validetta]").not("[type=checkbox]").on("change", function(d) { 132 return c = a(this), b.init(d) 133 }), a(this.form).find("[data-validetta][type=checkbox]").on("click", function(a) { 134 return c = b.form.querySelectorAll('[data-validetta][type=checkbox][name="' + this.name + '"]'), b.init(a) 135 })), a(this.form).on("reset", function() { 136 return a(b.form.querySelectorAll("." + b.options.errorClass + ", ." + b.options.validClass)).removeClass(b.options.errorClass + " " + b.options.validClass), b.reset() 137 }) 138 }, 139 init: function(a) { 140 return this.reset(c), this.checkFields(a), "submit" !== a.type ? void 0 : "pending" === this.handler ? !1 : this.handler === !0 ? (this.options.onError.call(this, a), !1) : this.options.onValid.call(this, a) 141 }, 142 checkFields: function(b) { 143 var e = this, 144 f = []; 145 this.getInvalidFields = function() { 146 return f 147 }; 148 for (var g = 0, h = c.length; h > g; g++) 149 if (!c[g].disabled) { 150 var k, l = c[g], 151 m = "", 152 n = i(a(l).val()), 153 o = l.getAttribute("data-validetta").split(","); 154 this.tmp = {}, this.tmp = { 155 el: l, 156 val: n, 157 parent: this.parents(l) 158 }; 159 for (var p = 0, q = o.length; q > p; p++) { 160 var r, s = o[p].match(d); 161 if (null !== s ? ("undefined" != typeof s[2] && (this.tmp.arg = s[2]), r = s[1]) : r = o[p], ("" !== n || l.hasAttribute("data-requiredifempty") || "required" === r || "equalTo" === r) && j.hasOwnProperty(r) && (k = j[r](e.tmp, e), "undefined" != typeof k && k !== !0)) { 162 var t = l.getAttribute("data-vd-message-" + r); 163 null !== t && (k = t), m += k + "<br/>" 164 } 165 } 166 "" !== m ? (f.push({ 167 field: l, 168 errors: m 169 }), this.addErrorClass(this.tmp.parent), this.window.open.call(this, l, m)) : "undefined" != typeof this.tmp.remote ? this.checkRemote(l, b) : ("undefined" != typeof k ? this.addValidClass(this.tmp.parent) : a(this.tmp.parent).removeClass(this.options.errorClass + " " + this.options.validClass), k = void 0) 170 } 171 }, 172 checkRemote: function(b, c) { 173 var d = {}, 174 e = {}, 175 f = b.name || b.id; 176 "undefined" == typeof this.remoteCache && (this.remoteCache = {}), e[f] = this.tmp.val, d = a.extend(!0, {}, { 177 data: e 178 }, this.options.validators.remote[this.tmp.remote] || {}); 179 var g = a.param(d), 180 h = this.remoteCache[g]; 181 if ("undefined" != typeof h) switch (h.state) { 182 case "pending": 183 this.handler = "pending", h.event = c.type; 184 break; 185 case "rejected": 186 throw c.preventDefault(), new Error(h.result.message); 187 case "resolved": 188 h.result.valid === !1 ? (this.addErrorClass(this.tmp.parent), this.window.open.call(this, b, h.result.message)) : this.addValidClass(this.tmp.parent) 189 } else { 190 var i = this.xhr[f]; 191 "undefined" != typeof i && "pending" === i.state() && i.abort(), h = this.remoteCache[g] = { 192 state: "pending", 193 event: c.type 194 }, this.remoteRequest(d, h, b, f) 195 } 196 }, 197 remoteRequest: function(b, c, d, e, f) { 198 var g = this;
199 a(this.tmp.parent).addClass("validetta-pending"), this.xhr[e] = a.ajax(b).done(function(b) { 200 "object" != typeof b && (b = JSON.parse(b)), c.state = "resolved", c.result = b, "submit" === c.event ? (g.handler = !1, a(g.form).trigger("submit")) : b.valid === !1 ? (g.addErrorClass(g.tmp.parent), g.window.open.call(g, d, b.message)) : g.addValidClass(g.tmp.parent) 201 }).fail(function(a, b) { 202 if ("abort" !== b) { 203 var d = "Ajax request failed for field (" + e + ") : " + a.status + " " + a.statusText; 204 throw c.state = "rejected", c.result = { 205 valid: !1, 206 message: d 207 }, new Error(d) 208 } 209 }).always(function(b) { 210 a(g.tmp.parent).removeClass("validetta-pending") 211 }), this.handler = "pending" 212 }, 213 window: { 214 open: function(b, c) { 215 if (!this.options.showErrorMessages) return void(this.handler = !0); 216 var d = this.parents(b); 217 if ("undefined" == typeof d && (d = b[0].parentNode), !d.querySelectorAll("." + this.options.errorTemplateClass).length) { 218 var e = document.createElement("span"); 219 if (e.className = this.options.errorTemplateClass + " " + this.options.errorTemplateClass + "--" + this.options.bubblePosition, "bubble" === this.options.display) { 220 var f, g = 0, 221 h = 0; 222 f = a(b).position(), "bottom" === this.options.bubblePosition ? h = b.offsetHeight : g = b.offsetWidth, e.innerHTML = "", e.style.top = f.top + h + this.options.bubbleGapTop + "px", e.style.left = f.left + g + this.options.bubbleGapLeft + "px" 223 } 224 d.appendChild(e), e.innerHTML = c, this.handler = !0 225 } 226 }, 227 close: function(a) { 228 a.parentNode.removeChild(a) 229 } 230 }, 231 reset: function(a) { 232 var b = {}; 233 b = "undefined" == typeof a || a.length > 1 && "checkbox" !== a[0].type ? this.form.querySelectorAll("." + this.options.errorTemplateClass) : this.parents(a[0]).querySelectorAll("." + this.options.errorTemplateClass); 234 for (var c = 0, d = b.length; d > c; c++) this.window.close.call(this, b[c]); 235 this.handler = !1 236 }, 237 addErrorClass: function(b) { 238 a(b).removeClass(this.options.validClass).addClass(this.options.errorClass) 239 }, 240 addValidClass: function(b) { 241 a(b).removeClass(this.options.errorClass).addClass(this.options.validClass) 242 }, 243 parents: function(a) { 244 for (var b = parseInt(a.getAttribute("data-vd-parent-up"), 10) || 0, c = 0; b >= c; c++) a = a.parentNode; 245 return a 246 } 247 }, a.fn.validetta = function(c, d) { 248 return a.validettaLanguage && (g = a.extend(!0, {}, g, a.validettaLanguage.messages)), "undefined" != typeof d && (g = a.extend(!0, {}, g, d)), this.each(function() { 249 new b(this, c) 250 }) 251 } 252}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.