18F/forest-service-prototype

View on GitHub
third-party/uswds-0.13.1/js/uswds.min.js

Summary

Maintainability
A
0 mins
Test Coverage
!function t(e,n,i){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n?n:t)},l,l.exports,t,e,n,i)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(t,e,n){(function(t){function n(t,e,n){function o(e){var n=v,i=m;return v=m=void 0,j=e,b=t.apply(i,n)}function r(t){return j=t,g=setTimeout(l,e),k?o(t):b}function u(t){var n=t-A,i=t-j,o=e-n;return L?x(o,y-i):o}function c(t){var n=t-A,i=t-j;return void 0===A||n>=e||n<0||L&&i>=y}function l(){var t=E();return c(t)?d(t):void(g=setTimeout(l,u(t)))}function d(t){return g=void 0,T&&v?o(t):(v=m=void 0,b)}function f(){void 0!==g&&clearTimeout(g),j=0,v=A=m=g=void 0}function p(){return void 0===g?b:d(E())}function h(){var t=E(),n=c(t);if(v=arguments,m=this,A=t,n){if(void 0===g)return r(A);if(L)return g=setTimeout(l,e),o(A)}return void 0===g&&(g=setTimeout(l,e)),b}var v,m,y,b,g,A,j=0,k=!1,L=!1,T=!0;if("function"!=typeof t)throw new TypeError(a);return e=s(e)||0,i(n)&&(k=!!n.leading,L="maxWait"in n,y=L?w(s(n.maxWait)||0,e):y,T="trailing"in n?!!n.trailing:T),h.cancel=f,h.flush=p,h}function i(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function o(t){return!!t&&"object"==typeof t}function r(t){return"symbol"==typeof t||o(t)&&g.call(t)==c}function s(t){if("number"==typeof t)return t;if(r(t))return u;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(l,"");var n=f.test(t);return n||p.test(t)?h(t.slice(2),n?2:8):d.test(t)?u:+t}var a="Expected a function",u=NaN,c="[object Symbol]",l=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,p=/^0o[0-7]+$/i,h=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,y=v||m||Function("return this")(),b=Object.prototype,g=b.toString,w=Math.max,x=Math.min,E=function(){return y.Date.now()};e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){!function(t){"use strict";var e=function(t){if(!t)throw new Error("Politespace requires an element argument.");t.getAttribute&&(this.element=t,this.type=this.element.getAttribute("type"),this.delimiter=this.element.getAttribute("data-delimiter")||" ",this.reverse=null!==this.element.getAttribute("data-reverse"),this.groupLength=this.element.getAttribute("data-grouplength")||3)};e.prototype._divideIntoArray=function(t){for(var e,n,i,o=(""+this.groupLength).split(","),r=1===o.length,s=[],a=0;o.length&&a<t.length;)e=r?o[0]:o.shift()||t.length-a,i=Math.min(parseInt(e,10),t.length-a),n=this.reverse?-1*(i+a):a,s.push(t.substr(n,i)),a+=i;return this.reverse&&s.reverse(),s},e.prototype.format=function(t){var e=this.unformat(t);return this._divideIntoArray(e).join(this.delimiter)},e.prototype.trimMaxlength=function(t){var e=this.element.getAttribute("maxlength");return e&&(t=t.substr(0,e)),t},e.prototype.getValue=function(){return this.trimMaxlength(this.element.value)},e.prototype.update=function(){this.element.value=this.useProxy()?this.getValue():this.format(this.getValue())},e.prototype.unformat=function(t){return t.replace(new RegExp(this.delimiter,"g"),"")},e.prototype.reset=function(){this.element.value=this.unformat(this.element.value)},e.prototype.useProxy=function(){return"number"===this.type},e.prototype.updateProxy=function(){var t;this.useProxy()&&(t=this.element.parentNode.firstChild,t.innerHTML=this.format(this.getValue()),t.style.width=this.element.offsetWidth+"px")},e.prototype.createProxy=function(){function t(t,e){return window.getComputedStyle(t,null).getPropertyValue(e)}function e(e,n){for(var i=0,o=0,r=n.length;o<r;o++)i+=parseFloat(t(e,n[o]));return i}if(this.useProxy()){var n=this.element.parentNode,i=document.createElement("div"),o=document.createElement("div");o.style.font=t(this.element,"font"),o.style.paddingLeft=e(this.element,["padding-left","border-left-width"])+"px",o.style.paddingRight=e(this.element,["padding-right","border-right-width"])+"px",o.style.top=e(this.element,["padding-top","border-top-width","margin-top"])+"px",i.appendChild(o),i.className="politespace-proxy active";var r=n.replaceChild(i,this.element);i.appendChild(r),this.updateProxy()}},t.Politespace=e}(this)},{}],3:[function(t,e,n){function i(t,e){var n="true"===t.getAttribute("aria-expanded");return this.hideAll(),n||this.show(t),!1}function o(t){var e=this;this.root=t;var n=r("button",this.root);n.forEach(function(t){t.attachEvent?t.attachEvent("onclick",i.bind(e,t)):t.addEventListener("click",i.bind(e,t))});var o=this.$("button[aria-expanded=true]")[0];this.hideAll(),void 0!==o&&this.show(o)}var r=t("../utils/select");o.prototype.$=function(t){return r(t,this.root)},o.prototype.hide=function(t){var e=t.getAttribute("aria-controls"),n=this.$("#"+e)[0];return t.setAttribute("aria-expanded",!1),n.setAttribute("aria-hidden",!0),this},o.prototype.show=function(t){var e=t.getAttribute("aria-controls"),n=this.$("#"+e)[0];return t.setAttribute("aria-expanded",!0),n.setAttribute("aria-hidden",!1),this},o.prototype.hideAll=function(){var t=this,e=this.$("ul > li > button, .usa-accordion-button");return e.forEach(function(e){t.hide(e)}),this},e.exports=o},{"../utils/select":23}],4:[function(t,e,n){function i(t){t.preventDefault?t.preventDefault():t.returnValue=!1;var e="true"===t.target.getAttribute("aria-expanded"),n=e?s:a;n(this,"usa-banner-header-expanded")}function o(){var t=r(".usa-banner-header");t.forEach(function(t){var e=i.bind(t);r("[aria-controls]").forEach(function(t){u(t,"click",e)})})}var r=t("../utils/select"),s=t("../utils/add-class"),a=t("../utils/remove-class"),u=t("../utils/dispatch");e.exports=o},{"../utils/add-class":20,"../utils/dispatch":21,"../utils/remove-class":22,"../utils/select":23}],5:[function(t,e,n){function i(t){for(var e=t.parentNode.firstChild,n=[];e;)1==e.nodeType&&e!=t&&n.push(e),e=e.nextSibling;return n}var o=t("../utils/select"),r=t("../utils/add-class"),s=t("../utils/remove-class"),a=t("../utils/dispatch"),u=function(){var t=this.parentNode,e=i(t);s(t,"hidden"),e.forEach(function(t){r(t,"hidden")})},c=[];e.exports=function(){var t=o(".usa-footer-big nav ul"),e=o(".usa-footer-big nav .usa-footer-primary-link");c.length&&(c.forEach(function(t){t.off()}),c=[]),window.innerWidth<600?(t.forEach(function(t){r(t,"hidden")}),e.forEach(function(t){c.push(a(t,"click",u))})):t.forEach(function(t){s(t,"hidden")})}},{"../utils/add-class":20,"../utils/dispatch":21,"../utils/remove-class":22,"../utils/select":23}],6:[function(t,e,n){function i(t,e){t.classList&&t.classList.toggle(e)}function o(t){var e=s(".usa-overlay, .usa-nav"),n=s(".usa-nav-close")[0];return e.forEach(function(t){i(t,"is-visible")}),i(document.body,"usa-mobile_nav-active"),n.focus(),shouldTrigger=!1,!1}function r(){var t=s(".usa-menu-btn, .usa-overlay, .usa-nav-close");t.forEach(function(t){a(t,u,o)})}var s=t("../../utils/select"),a=(t("../../utils/add-class"),t("../../utils/remove-class"),t("../../utils/dispatch")),u="ontouchstart"in document.documentElement?"touchstart":"click";e.exports=r},{"../../utils/add-class":20,"../../utils/dispatch":21,"../../utils/remove-class":22,"../../utils/select":23}],7:[function(t,e,n){function i(t){return a(l)?s():(r(),p=y(document.body,"click touchstart",o)),!1}function o(t){var e=t.target;u(e)||(s(),p.off())}function r(){v(l,"is-visible"),v(d,"is-hidden")}function s(){m(l,"is-visible"),m(d,"is-hidden")}function a(t){var e=new RegExp("(^| )is-visible( |$)","gi");return e.test(t.className)}function u(t){return l&&l.contains(t)||f&&f.contains(t)}function c(){l=h(".js-search-form")[0],d=h(".js-search-button")[0],f=h(".js-search-button-container")[0],d&&l&&y(d,"click touchstart",i)}var l,d,f,p,h=t("../../utils/select"),v=t("../../utils/add-class"),m=t("../../utils/remove-class"),y=t("../../utils/dispatch");e.exports=c},{"../../utils/add-class":20,"../../utils/dispatch":21,"../../utils/remove-class":22,"../../utils/select":23}],8:[function(t,e,n){e.exports=function(t,e){t.forEach(function(t){t.setAttribute("autocapitalize","off"),t.setAttribute("autocorrect","off"),t.setAttribute("type",e?"password":"text")})}},{}],9:[function(t,e,n){function i(t){var e=t.split(" ");return e.map(function(t){return"#"+t}).join(", ")}function o(t){for(;t&&"FORM"!==t.tagName;)t=t.parentNode;return t}var r=t("./toggle-field-mask"),s=t("../utils/select"),a=function(t,e,n){var a=t.getAttribute("aria-controls");if(!a||0===a.trim().length)throw new Error("Did you forget to define selectors in the aria-controls attribute? Check element "+t.outerHTML);var u=i(a),c=o(t);if(!c)throw new Error("toggleFormInput() needs the supplied element to be inside a <form>. Check element "+t.outerHTML);var l=s(u,c),d=!1,f=function(i){i.preventDefault(),r(l,d),t.textContent=d?e:n,d=!d};t.attachEvent?t.attachEvent("onclick",f):t.addEventListener("click",f)};e.exports=a},{"../utils/select":23,"./toggle-field-mask":8}],10:[function(t,e,n){function i(t){if(t.hasAttributes()){for(var e={},n=t.attributes,i=n.length-1;i>=0;i--){var o=n[i].name.match(/data-(.*)/i);if(o&&o[1]){var r=o[1].replace(/-/,"");e[r]=n[i].value}}return e}}var o=t("../utils/select"),r=t("../utils/add-class"),s=t("../utils/remove-class"),a=t("../utils/dispatch");e.exports=function(t){function e(){for(n in d)n.startsWith("validate")&&(u=n.split("validate")[1],c=new RegExp(d[n]),validatorSelector="[data-validator="+u+"]",l=o(validatorSelector,f)[0],c.test(t.value)?r(l,"usa-checklist-checked"):s(l,"usa-checklist-checked"))}var n,u,c,l,d=i(t),f=o(d.validationelement)[0];a(t,"keyup",e)}},{"../utils/add-class":20,"../utils/dispatch":21,"../utils/remove-class":22,"../utils/select":23}],11:[function(t,e,n){var i=t("../utils/select"),o=t("../utils/when-dom-ready"),r=t("../components/accordion");o(function(){var t=i(".usa-accordion, .usa-accordion-bordered");t.forEach(function(t){new r(t)})})},{"../components/accordion":3,"../utils/select":23,"../utils/when-dom-ready":25}],12:[function(t,e,n){var i=t("../utils/when-dom-ready"),o=t("../components/banner");i(function(){o()})},{"../components/banner":4,"../utils/when-dom-ready":25}],13:[function(t,e,n){var i=t("lodash.debounce"),o=t("../utils/when-dom-ready"),r=t("../utils/dispatch"),s=t("../components/footer");o(function(){s(),r(window,"resize",i(s,180))})},{"../components/footer":5,"../utils/dispatch":21,"../utils/when-dom-ready":25,"lodash.debounce":1}],14:[function(t,e,n){var i=t("../utils/when-dom-ready"),o=t("../utils/select"),r=t("../components/validator"),s=t("../components/toggle-form-input");i(function(){var t=o(".usa-show_password")[0],e=o(".usa-show_multipassword")[0],n=o(".js-validate_password")[0];t&&s(t,"Show Password","Hide Password"),e&&s(e,"Show my typing","Hide my typing"),n&&r(n)})},{"../components/toggle-form-input":9,"../components/validator":10,"../utils/select":23,"../utils/when-dom-ready":25}],15:[function(t,e,n){var i=t("../utils/when-dom-ready"),o=t("../components/header/search"),r=t("../components/header/mobile");i(function(){o(),r()})},{"../components/header/mobile":6,"../components/header/search":7,"../utils/when-dom-ready":25}],16:[function(t,e,n){var i=t("../utils/verify-jquery");if(i(window)){var o=window.jQuery,r=t("../../../node_modules/politespace/src/politespace").Politespace,s="politespace";o.fn[s]=function(){return this.each(function(){var t=new r(this);"number"===t.type&&t.createProxy(),o(this).bind("input keydown",function(){t.updateProxy()}).bind("blur",function(){o(this).closest(".politespace-proxy").addClass("active"),t.update(),t.updateProxy()}).bind("focus",function(){o(this).closest(".politespace-proxy").removeClass("active"),t.reset()}).data(s,t),t.update()})},o(function(){o("[data-"+s+"]").politespace()})}},{"../../../node_modules/politespace/src/politespace":2,"../utils/verify-jquery":24}],17:[function(t,e,n){Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var n,i;if(null===this)throw new TypeError(" this is null or not defined");var o=Object(this),r=o.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(n=e),i=0;i<r;){var s;i in o&&(s=o[i],t.call(n,s,i,o)),i++}}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,i=function(){},o=function(){return n.apply(this instanceof i?this:t,e.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(i.prototype=this.prototype),o.prototype=new i,o})},{}],18:[function(t,e,n){var i=t("../utils/dispatch"),o=t("../utils/select"),r=t("../utils/when-dom-ready");r(function(){var t=o(".skipnav")[0],e=o("#main-content")[0];t&&i(t,"click",function(){e.setAttribute("tabindex","0")}),e&&i(e,"blur",function(){e.setAttribute("tabindex","-1")})})},{"../utils/dispatch":21,"../utils/select":23,"../utils/when-dom-ready":25}],19:[function(t,e,n){"use strict";t("./initializers/polyfills"),t("./initializers/header"),t("./initializers/accordions"),t("./initializers/footer"),t("./initializers/skip-nav"),t("./initializers/forms"),t("./initializers/politespace"),t("./initializers/banner")},{"./initializers/accordions":11,"./initializers/banner":12,"./initializers/footer":13,"./initializers/forms":14,"./initializers/header":15,"./initializers/politespace":16,"./initializers/polyfills":17,"./initializers/skip-nav":18}],20:[function(t,e,n){e.exports=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e}},{}],21:[function(t,e,n){e.exports=function(t,e,n,i){var o=e.split(/\s+/),r=function(t,e,n){t.attachEvent&&t.attachEvent("on"+e,n,i),t.addEventListener&&t.addEventListener(e,n,i)},s=function(t,e){var n;"createEvent"in document?(n=document.createEvent("HTMLEvents"),n.initEvent(e,!1,!0),t.dispatchEvent(n)):(n=document.createEventObject(),n.eventType=e,t.fireEvent("on"+t.eventType,n))},a=function(t,e,n){t.detachEvent&&t.detachEvent("on"+e,n,i),t.removeEventListener&&t.removeEventListener(e,n,i)};return o.forEach(function(e){r.call(null,t,e,n)}),{trigger:function(){s.call(null,t,o[0])},off:function(){o.forEach(function(e){a.call(null,t,e,n)})}}}},{}],22:[function(t,e,n){e.exports=function(t,e){var n=t.classList;if(void 0!==n)n.remove(e);else{n=t.className.split(/\s+/);var i=[];n.forEach(function(t){t!==e&&i.push(t)}),t.className=i.join(" ")}}},{}],23:[function(t,e,n){function i(t){return!!t&&"object"==typeof t&&1===t.nodeType}e.exports=function(t,e){if("string"!=typeof t)return[];void 0!==e&&i(e)||(e=window.document);var n=e.querySelectorAll(t);return Array.prototype.slice.call(n)}},{}],24:[function(t,e,n){e.exports=function(t){return t=t||window,!!(t.jQuery&&t.jQuery.fn&&t.jQuery.fn.jquery)}},{}],25:[function(t,e,n){function i(t){return"function"==typeof t}e.exports=function(t){"loading"!==document.readyState?i(t)&&t():document.addEventListener?document.addEventListener("DOMContentLoaded",t):document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&i(t)&&t()})}},{}]},{},[19]);