PageSourceSearch

https://swatchgroup.jp/assets/vendor/@swup/forms-plugin/forms-plugin.index-caa8edfbe6265fb9d1dab6a86404e1c3.js

js swatchgroup.jp collected 2026-10-02 04:28:28 UTC 2,632 bytes, 7 lines download raw bytes

1/**
2 * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
3 * Original file: /npm/@swup/[email protected]/dist/index.modern.js
4 *
5 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 */
7import e from"@swup/plugin";import{getCurrentUrl as t,Location as s}from"swup";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},r.apply(this,arguments)}class o extends e{constructor(e){super(),this.name="FormsPlugin",this.onKeyDown=e=>{this.specialKeys.hasOwnProperty(e.key)&&(this.specialKeys[e.key]=!0)},this.onKeyUp=e=>{this.specialKeys.hasOwnProperty(e.key)&&(this.specialKeys[e.key]=!1)},this.options=r({},{formSelector:"form[data-swup-form]"},e),this.specialKeys={Meta:!1,Control:!1,Shift:!1}}mount(){const e=this.swup;e._handlers.submitForm=[],e._handlers.openFormSubmitInNewTab=[],e.delegatedListeners.formSubmit=e.delegateEvent(this.options.formSelector,"submit",this.beforeFormSubmit.bind(this),{capture:!0}),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)}unmount(){this.swup.delegatedListeners.formSubmit.destroy(),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp)}beforeFormSubmit(e){const t=this.swup;t.triggerEvent("submitForm",e);const s=e.target;if(this.isSpecialKeyPressed()){this.resetSpecialKeys(),t.triggerEvent("openFormSubmitInNewTab",e);const r=s.getAttribute("target");return s.setAttribute("target","_blank"),void s.addEventListener("submit",(e=>{requestAnimationFrame((()=>{this.restorePreviousFormTarget(e.target,r)}))}),{once:!0})}this.submitForm(e)}restorePreviousFormTarget(e,t){t?e.setAttribute("target",t):e.removeAttribute("target")}submitForm(e){const r=this.swup;e.preventDefault();const o=e.target,i=new FormData(o),n=o.getAttribute("action")||t(),a=(o.getAttribute("method")||"get").toUpperCase(),m=o.getAttribute("data-swup-transition");let{url:u,hash:p}=s.fromUrl(n);p&&(r.scrollToElement=p),"GET"===a?(u=this.appendQueryParams(u,i),r.cache.remove(u),r.loadPage({url:u,customTransition:m})):(r.cache.remove(u),r.loadPage({url:u,method:a,data:i,customTransition:m}))}appendQueryParams(e,t){e=e.split("?")[0];const s=new URLSearchParams(t).toString();return s?`${e}?${s}`:e}isSpecialKeyPressed(){return Object.values(this.specialKeys).some((e=>e))}resetSpecialKeys(){for(const[e,t]of Object.entries(this.specialKeys))this.specialKeys[e]=!1}}export{o as default};

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.