PageSourceSearch

https://nishinofamily.com/files/15/_assets/fc15/js/nk_util_371_20241011142510.js

js nishinofamily.com collected 2026-10-06 16:22:18 UTC 10,094 bytes, 2 lines download raw bytes

1/*! util 1.0.0 */
2!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).util=e()}(this,(function(){"use strict";const t={state:{els:null,el:null,now:0,total:0,row:5,dot:{prev:null,next:null}},getData(){this.state.els=document.querySelectorAll("[data-pagination]"),this.state.els.forEach((t=>{this.state.el=t,this.state.el_li=this.state.el.querySelectorAll("[data-pagination-item]"),this.state.now=Number(this.state.el.getAttribute("data-pagination-now")),this.state.total=Number(this.state.el.getAttribute("data-pagination-total")),this.state.row=Number(this.state.el.getAttribute("data-pagination-row")),this.state.dot.prev=this.state.el.querySelector("[data-pagination-dot-prev]"),this.state.dot.next=this.state.el.querySelector("[data-pagination-dot-next]"),this.adjustLink(),this.state.total>this.state.row?this.setVisible():this.setDisable()}))},adjustLink(){this.state.el_li.forEach(((t,e)=>{if(t.querySelector("a[href]")){let e=t.querySelector("a[href]"),i=e.getAttribute("href"),a=i.replace(/\?.+/,""),o=this.util.parseQuery(i),s=Object.assign(this.util.parseQuery(),o);e.setAttribute("href",`${a}?${this.util.buildQuery(s)}`)}}))},setVisible(){this.state.el.insertAdjacentHTML("afterbegin","<style>[data-pagination-item][disabled] { display: none; }</style>"),this.state.el.insertBefore(this.state.dot.prev,this.state.el_li[1]),this.state.el.insertBefore(this.state.dot.next,this.state.el_li[this.state.el_li.length-1]);let t=this.state.row/2;this.state.el_li.forEach(((e,i)=>{let a=i+1;this.state.row<this.state.total?this.state.now<=t+1?a>t+2&&a!=this.state.total&&(e.setAttribute("disabled",!0),this.state.dot.prev.remove()):this.state.now>=this.state.total-t?a<this.state.total-t-1&&1!=a&&(e.setAttribute("disabled",!0),this.state.dot.next.remove()):(a<this.state.now-t+1||a>this.state.now+t-1)&&1!=a&&a!=this.state.total&&e.setAttribute("disabled",!0):this.setDisable()}))},setDisable(){this.state.dot.prev&&this.state.dot.prev.remove(),this.state.dot.next&&this.state.dot.next.remove()},util:{buildQuery:t=>(t?.list&&0===t.list.length&&delete t.list,Object.keys(t).filter((e=>""!==t[e])).map((e=>"list"===e?t[e].map((t=>"list[]="+encodeURIComponent(t))).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(t[e]))).join("&")),parseQuery(t=window.location.search){/.+\?/.test(t)&&(t=t.replace(/.+\?/,"?"));const e={};if(/\?.*\=/.test(t)){const i=("?"===t[0]?t.substr(1):t).split("&");for(let t=0;t<i.length;t++){let a=i[t].split("=");"list[]"===a[0]?(e.list||(e.list=[]),e.list.push(decodeURIComponent(a[1]||""))):e[decodeURIComponent(a[0])]=decodeURIComponent(a[1]||"")}}return e?.ima&&delete e.ima,e}},init(){this.getData()}},e={config:{api:{show:"",change:"",add:"",del:""},target:"[data-cart]",target_quantity:"data-cart-quantity",target_loading:"data-cart-loading",ui_add:"[data-cart-ui-add]",step_up:"[data-cart-ui-up]",step_down:"[data-cart-ui-down]",dialog:"[data-cart-ui-dialog]",price:"[data-cart-ui-price]",ui_quantity:"[data-cart-ui-quantity]",state:{dialog_show:"[data-cart-state-dialog-show]",dialog_show_type:"[data-cart-state-dialog-show-type]",quantity:"[data-cart-state-quantity]"},classname_cart_item_active:"is-cart-item-active",show_dialog_time:4e3,on_posted(){},on_ok(){},on_error(){},on_init(){},on_init_error(){}},_timer_snackbar:void 0,showDialog(){this._timer_snackbar&&clearTimeout(this._timer_snackbar),document.querySelectorAll(this.config.dialog).length>0&&document.querySelector(this.config.dialog).setAttribute("aria-hidden",!1),document.querySelectorAll(this.config.state.dialog_show).length>0&&document.querySelectorAll(this.config.state.dialog_show).forEach(((t,e)=>{t.setAttribute(this.config.state.dialog_show.replace(/[\[\]]/g,""),"true")})),this._timer_snackbar=setTimeout((()=>{document.querySelectorAll(this.config.dialog).length>0&&document.querySelector(this.config.dialog).setAttribute("aria-hidden",!0),document.querySelectorAll(this.config.state.dialog_show).length>0&&document.querySelectorAll(this.config.state.dialog_show).forEac
2h(((t,e)=>{t.setAttribute(this.config.state.dialog_show.replace(/[\[\]]/g,""),"false")})),document.querySelectorAll(this.config.state.dialog_show_type).length>0&&document.querySelectorAll(this.config.state.dialog_show_type).forEach(((t,e)=>{t.setAttribute(this.config.state.dialog_show_type.replace(/[\[\]]/g,""),"")}))}),this.config.show_dialog_time)},hideDialog(){this._timer_snackbar&&clearTimeout(this._timer_snackbar),document.querySelectorAll(this.config.dialog).length>0&&document.querySelector(this.config.dialog).setAttribute("aria-hidden",!0),document.querySelectorAll(this.config.state.dialog_show_type).length>0&&document.querySelectorAll(this.config.state.dialog_show_type).forEach(((t,e)=>{t.setAttribute(this.config.state.dialog_show_type.replace(/[\[\]]/g,""),"")})),document.querySelectorAll(this.config.state.dialog_show).length>0&&document.querySelectorAll(this.config.state.dialog_show).forEach(((t,e)=>{t.setAttribute(this.config.state.dialog_show.replace(/[\[\]]/g,""),"false")}))},updateItemCartData(t){document.querySelectorAll(this.config.target).length>0&&document.querySelectorAll(this.config.target).forEach((e=>{const i=t.items.find((t=>t.idetId==e.dataset.cartIdetid)),a=e.querySelector('input[name="quantity"]'),o=i?i.quantity:0;a.value=o,e.setAttribute(this.config.target_quantity,o),0!=a.value?e.classList.add(this.config.classname_cart_item_active):e.classList.remove(this.config.classname_cart_item_active);const s=e.querySelector(this.config.step_up);i&&0!==i.limitCount&&i.quantity>=i.limitCount?s.disabled=!0:s.disabled=!1,e.removeAttribute(this.config.target_loading)}));const e=(t,e)=>{document.querySelectorAll(t).length>0&&document.querySelectorAll(t).forEach((t=>{t.innerHTML=e}))},i=(t,e,i)=>{document.querySelectorAll(t).length>0&&document.querySelectorAll(t).forEach((t=>{t.setAttribute(e,i)}))};t.total_quantity?(e(this.config.ui_quantity,t.total_quantity),i(this.config.state.quantity,this.config.state.quantity.replace(/[\[\]]/g,""),t.total_quantity),document.querySelectorAll(this.config.price).length>0&&document.querySelectorAll(this.config.price).forEach((e=>{e.innerHTML=Number(t.gross_total).toLocaleString()})),this.showDialog()):(e(this.config.ui_quantity,"0"),i(this.config.state.quantity,this.config.state.quantity.replace(/[\[\]]/g,""),"0"),document.querySelectorAll(this.config.price).length>0&&document.querySelectorAll(this.config.price).forEach((t=>{t.innerHTML="0"})),this.hideDialog())},attachEvent(){0!==document.querySelectorAll(this.config.target).length&&document.querySelectorAll(this.config.target).forEach((t=>{const e=async({type:e})=>{const i=new FormData;i.append(`items[${t.dataset.cartIdetid}]`,t.querySelector('input[name="quantity"]').value),this.config.on_prepost(e,Object.fromEntries(i.entries()));try{const t=await fetch(this.config.api.change,{method:"POST",body:i}),a=await t.json();"OK"===a.result?(document.querySelectorAll(this.config.state.dialog_show_type).length>0&&document.querySelectorAll(this.config.state.dialog_show_type).forEach(((t,i)=>{t.setAttribute(this.config.state.dialog_show_type.replace(/[\[\]]/g,""),e)})),this.updateItemCartData(a),this.config.on_ok(e,a,Object.fromEntries(i.entries()))):(this.updateItemCartData(a),this.config.on_error(e,a,Object.fromEntries(i.entries()))),this.config.on_posted(e,a,Object.fromEntries(i.entries()))}catch(t){console.error("Error:",t),this.config.on_error(e,data,Object.fromEntries(i.entries()))}},i=(i,a)=>{t.setAttribute(this.config.target_loading,"");const o=i.currentTarget.closest(this.config.target).querySelector('input[name="quantity"]');"add"===a?o.stepUp():o.stepDown(),e({type:a})};document.querySelectorAll(this.config.ui_add).length>0&&t.querySelectorAll(`${this.config.ui_add}, ${this.config.step_up}`).forEach((t=>{t.addEventListener("click",(t=>i(t,"add")))})),document.querySelectorAll(this.config.step_down).length>
20&&t.querySelectorAll(this.config.step_down).forEach((t=>{t.addEventListener("click",(t=>i(t,"del")))}))}))},async init(t){this.config={...this.config,...t};const e=async()=>{const t=`${this.config.api.show}&_=${Date.now()}`;return(await fetch(t)).json()};try{const t=await e();document.querySelectorAll(this.config.state.dialog_show_type).length>0&&document.querySelectorAll(this.config.state.dialog_show_type).forEach(((t,e)=>{t.setAttribute(this.config.state.dialog_show_type.replace(/[\[\]]/g,""),"init")})),this.updateItemCartData(t),this.attachEvent(),this.config.on_init(t)}catch(t){console.error("Error fetching data:",t),this.config.on_init_error(data)}}},i={config:{api:"",target:"body",target_data_login_state:"data-login-state",target_data_login_api:"data-login-api"},state:{login:{result:!1}},setLoginState(t="NG"){"NG"===t?(this.state.login.result=!1,this.config.target.setAttribute(this.config.target_data_login_state,"false")):(this.state.login.result=!0,this.config.target.setAttribute(this.config.target_data_login_state,"true"))},getApi(){let t=this.config.api=/\?/.test(this.config.api)?`${this.config.api}&_=${Date.now()}`:`${this.config.api}?_=${Date.now()}`;const e=new XMLHttpRequest;e.addEventListener("load",(()=>{let t=JSON.parse(e.response);"OK"!==t.result&&"NG"!==t.result||this.setLoginState(t.result)})),e.open("GET",t),e.send()},init(t){if(this.config={...this.config,...t},this.config.target=document.querySelector(this.config.target),this.config.target.getAttribute(this.config.target_data_login_api)&&(this.config.api=this.config.target.getAttribute(this.config.target_data_login_api)),!this.config.api)return!1;this.config.target.setAttribute(this.config.target_data_login_state,"loading"),this.getApi()}};document.addEventListener("DOMContentLoaded",(()=>{const a=document.querySelectorAll("[data-pagination]"),o=document.querySelectorAll("[data-cart][data-cart-init]"),s=document.body.hasAttribute("data-login")&&document.body.hasAttribute("data-login-init");a.length&&t.init(),o.length&&e.init(),s&&i.init()}));return{pagination:t,cart:e,login:i}}));

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.