PageSourceSearch

https://www.gold-traders.co.uk/js/pristine.min.js

js gold-traders.co.uk collected 2026-10-02 07:09:59 UTC 7,206 bytes, 2 lines download raw bytes

1const lang={en:{required:"This field is required",email:"This field requires a valid e-mail address",number:"This field requires a number",integer:"This field requires an integer value",url:"This field requires a valid website URL",tel:"This field requires a valid telephone number",maxlength:"This fields length must be < ${1}",minlength:"This fields length must be > ${1}",min:"Minimum value for this field is ${1}",max:"Maximum value for this field is ${1}",pattern:"Please match the requested format",equals:"The two fields do not match",default:"Please enter a correct value"}};function findAncestor(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e}function tmpl(e){return this.replace(/\${([^{}]*)}/g,((e,t)=>arguments[t]))}function groupedElemCount(e){return e.pristine.self.form.querySelectorAll('input[name="'+e.getAttribute("name")+'"]:checked').length}function mergeConfig(e,t){for(let r in t)r in e||(e[r]=t[r]);return e}let defaultConfig={classTo:"form-group",errorClass:"has-danger",successClass:"has-success",errorTextParent:"form-group",errorTextTag:"div",errorTextClass:"text-help"};const PRISTINE_ERROR="pristine-error",SELECTOR="input:not([type^=hidden]):not([type^=submit]), select, textarea",ALLOWED_ATTRIBUTES=["required","min","max","minlength","maxlength","pattern"],EMAIL_REGEX=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,MESSAGE_REGEX=/-message(?:-([a-z]{2}(?:_[A-Z]{2})?))?/;let currentLocale="en";const validators={},_=function(e,t){t.name=e,void 0===t.priority&&(t.priority=1),validators[e]=t};function Pristine(e,t,r){let n=this;function i(e,t,r,n){let i=validators[r];
1if(i&&(e.push(i),n)){let e="pattern"===r?[n]:n.split(",");e.unshift(null),t[r]=e}}function s(e){let t=[],r=!0;for(let n=0;e.validators[n];n++){let i=e.validators[n],s=e.params[i.name]?e.params[i.name]:[];if(s[0]=e.input.value,!i.fn.apply(e.input,s)&&(r=!1,"function"==typeof i.msg?t.push(i.msg(e.input.value,s)):"string"==typeof i.msg?t.push(tmpl.apply(i.msg,s)):i.msg===Object(i.msg)&&i.msg[currentLocale]?t.push(tmpl.apply(i.msg[currentLocale],s)):e.messages[currentLocale]&&e.messages[currentLocale][i.name]?t.push(tmpl.apply(e.messages[currentLocale][i.name],s)):lang[currentLocale]&&lang[currentLocale][i.name]?t.push(tmpl.apply(lang[currentLocale][i.name],s)):t.push(tmpl.apply(lang[currentLocale].default,s)),!0===i.halt))break}return e.errors=t,r}function a(e){if(e.errorElements)return e.errorElements;let t=findAncestor(e.input,n.config.classTo),r=null,i=null;return r=n.config.classTo===n.config.errorTextParent?t:t.querySelector("."+n.config.errorTextParent),r&&(i=r.querySelector(".pristine-error"),i||(i=document.createElement(n.config.errorTextTag),i.className="pristine-error "+n.config.errorTextClass,r.appendChild(i),i.pristineDisplay=i.style.display)),e.errorElements=[t,i]}function l(e){let t=a(e),r=t[0],i=t[1];const{input:s}=e,l=`error-${s.id||Math.floor((new Date).valueOf()*Math.random())}`;r&&(r.classList.remove(n.config.successClass),r.classList.add(n.config.errorClass),s.setAttribute("aria-describedby",l),s.setAttribute("aria-invalid","true")),i&&(i.setAttribute("id",l),i.setAttribute("role","alert"),i.innerHTML=e.errors.join("<br/>"),i.style.display=i.pristineDisplay||"")}function o(e){let t=function(e){let t=a(e),r=t[0],i=t[1];const{input:s}=e;return r&&(r.classList.remove(n.config.errorClass),r.classList.remove(n.config.successClass),s.removeAttribute("aria-describedby"),s.removeAttribute("aria-invalid")),i&&(i.removeAttribute("id"),i.removeAttribute("role"),i.innerHTML="",i.style.display="none"),t}(e)[0];t&&t.classList.add(n.config.successClass)}return function(e,t,r){e.setAttribute("novalidate","true"),n.form=e,n.config=mergeConfig(t||{},defaultConfig),n.live=!(!1===r),n.fields=Array.from(e.querySelectorAll(SELECTOR)).map(function(e){let t=[],r={},s={};
1return[].forEach.call(e.attributes,(function(e){if(/^data-pristine-/.test(e.name)){let n=e.name.substr(14),a=n.match(MESSAGE_REGEX);if(null!==a){let t=void 0===a[1]?"en":a[1];return s.hasOwnProperty(t)||(s[t]={}),void(s[t][n.slice(0,n.length-a[0].length)]=e.value)}"type"===n&&(n=e.value),i(t,r,n,e.value)}else~ALLOWED_ATTRIBUTES.indexOf(e.name)?i(t,r,e.name,e.value):"type"===e.name&&i(t,r,e.value)})),t.sort(((e,t)=>t.priority-e.priority)),n.live&&e.addEventListener(~["radio","checkbox"].indexOf(e.getAttribute("type"))?"change":"input",function(e){n.validate(e.target)}.bind(n)),e.pristine={input:e,validators:t,params:r,messages:s,self:n}}.bind(n))}(e,t,r),n.validate=function(e,t){t=e&&!0===t||!0===e;let r=n.fields;!0!==e&&!1!==e&&(e instanceof HTMLElement?r=[e.pristine]:(e instanceof NodeList||e instanceof(window.$||Array)||e instanceof Array)&&(r=Array.from(e).map((e=>e.pristine))));let i=!0;for(let e=0;r[e];e++){let n=r[e];s(n)?!t&&o(n):(i=!1,!t&&l(n))}return i},n.getErrors=function(e){if(!e){let e=[];for(let t=0;t<n.fields.length;t++){let r=n.fields[t];r.errors.length&&e.push({input:r.input,errors:r.errors})}return e}return e.tagName&&"select"===e.tagName.toLowerCase()?e.pristine.errors:e.length?e[0].pristine.errors:e.pristine.errors},n.addValidator=function(e,t,r,n,i){e instanceof HTMLElement?(e.pristine.validators.push({fn:t,msg:r,priority:n,halt:i}),e.pristine.validators.sort(((e,t)=>t.priority-e.priority))):console.warn("The parameter elem must be a dom element")},n.addError=function(e,t){(e=e.length?e[0]:e).pristine.errors.push(t),l(e.pristine)},n.reset=function(){for(let e=0;n.fields[e];e++)n.fields[e].errorElements=null;Array.from(n.form.querySelectorAll(".pristine-error")).map((function(e){e.parentNode.removeChild(e)})),Array.from(n.form.querySelectorAll("."+n.config.classTo)).map((function(e){e.classList.remove(n.config.successClass),e.classList.remove(n.config.errorClass)}))},n.destroy=function(){n.reset(),n.fields.forEach((function(e){delete e.input.pristine})),n.fields=[]},n.setGlobalConfig=function(e){defaultConfig=e},n}_("text",{fn:e=>!0,priority:0}),_("required",{fn:function(e){return"radio"===this.type||"checkbox"===this.type?groupedElemCount(this):void 0!==e&&""!==e.trim()},priority:99,halt:!0}),_("email",{fn:e=>!e||EMAIL_REGEX.test(e)}),_("number",{fn:e=>!e||!isNaN(parseFloat(e)),priority:2}),_("integer",{fn:e=>!e||/^\d+$/.test(e)}),_("minlength",{fn:(e,t)=>!e||e.length>=parseInt(t)}),_("maxlength",{fn:(e,t)=>!e||e.length<=parseInt(t)}),_("min",{fn:function(e,t){return!e||("checkbox"===this.type?groupedElemCount(this)>=parseInt(t):parseFloat(e)>=parseFloat(t))}}),_("max",{fn:function(e,t){return!e||("checkbox"===this.type?groupedElemCount(this)<=parseInt(t):parseFloat(e)<=parseFloat(t))}}),_("pattern",{fn:(e,t)=>{let r=t.match(new RegExp("^/(.*?)/([gimy]*)$"));return!e||new RegExp(r[1],r[2]).test(e)}}),_("equals",{fn:(e,t)=>{let r=document.querySelector(t);return r&&(!e&&!r.value||r.value===e)}}),Pristine.addValidator=function(e,t,r,n,i){_(e,{fn:t,msg:r,priority:n,halt:i})},Pristine.addMessages=function(e,t){let r=lang.hasOwnProperty(e)?lang[e]:lang[e]={};Object.keys(t).forEach((function(e,n){r[e]=t[e]}))},Pristine.setLocale=function(e){currentLocale=e};
2//# sourceMappingURL=maps/pristine.min.js.map

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.