1// ----------------------------------------------- 2// åæå¦ç 3// ----------------------------------------------- 4$(function() { 5 // ãµã¼ãã¼å¦çãã¿ã³ 6 $("button[data-svr-action]").on("click", DefaultButtonAction); 7 8 // ç»é¢é·ç§»ãã¿ã³ 9 $(".content-area button[data-reference]").on("click", function() { 10 var sUrl = $(this).data("reference"); 11 var sPram = CnvStr($(this).data("ref-pram")); 12 if (sPram != "") { 13 sUrl = sUrl + GetUrlPram(sPram); 14 } 15 location.href = sUrl; 16 return false; 17 }); 18 19 // ãã¤ãã¼ã¸, äºç´ã䏿¢ãã 20 $(".bar-progress").on("click", "button", function() { 21 var sBtn = $(this).attr("name"); 22 if (sBtn == "btnMyPage") { 23 OpenWindow("mypage.php" + GetUrlPram("on")); 24 } 25 if (sBtn == "btnCanOrder") { 26 $(".dlg-can-order").show(); 27 } 28 if (sBtn == "btnCanOrderOk") { 29 SvrAction("progress-post.php" + GetUrlPram("on")); 30 } 31 if (sBtn == "btnCanOrderNo") { 32 $(".dlg-can-order").hide(); 33 } 34 if (sBtn == "btnLogOut") { 35 $(".dlg-log-out").show(); 36 } 37 if (sBtn == "btnLogOutOk") { 38 SvrAction("logout-post.php" + GetUrlPram("on") ); 39 } 40 if (sBtn == "btnLogOutNo") { 41 $(".dlg-log-out").hide(); 42 } 43 return false; 44 }); 45 46 // ãã§ãã¯å¦ç 47 $("input[data-fld-check]").each(function() { 48 var qFld = $(this); 49 var sType = qFld.data("fld-check"); 50 var nLength = CnvNum(qFld.attr("maxlength")); 51 var bRequired = false; 52 if (sType.substr(0, 1) == "+") { 53 bRequired = true; 54 sType = sType.substr(1); 55 } 56 qFld.inputex({ inputtype: sType, length: nLength, required: bRequired }); 57 }); 58 59 // ã¹ã ã¼ãºã¹ã¯ãã¼ã« 60 $("#footer a[href^='#']").on("click", function() { 61 var sHref = $(this).attr("href"); 62 var nPos = $(sHref).offset().top; 63 $("html,body").animate({ scrollTop: nPos }); 64 return false; 65 }); 66 67 // å¤é¨ãªã³ã¯ 68 $("a[target='_blank']").on("click", function() { 69 var oWindow = OpenWindow($(this).attr("href")); 70 return (oWindow == null); 71 }); 72 73 // ãããã¼çã®å¹ èª¿æ´ 74 $(window).on("resize.HeaderResize", function() { 75 var nWindowWidth = $(window).width(); 76 /*@cc_on nWindowWidth = window.innerWidth; @*/ 77 if (nWindowWidth < $(document).width()) { 78 $(window).off("resize.HeaderResize"); 79 $("div.page-header, div.bar-progress, div.cart, div.page-footer").css("min-width", $(document).width()); 80 } 81 }); 82 83 // ãã³ãã¼ã¬ã¼ã¡ãã¥ã¼ã¢ã¤ã³ã³ã«ããã¡ãã¥ã¼éé 84 $(document).on("click", "#h-menu", function() { // åé¤ãã¿ã³ã«ããã«ã¼ãææ°æ´æ°ã§ãè¦ç´ ãå使ãããå¯è½æ§ãããããããã®æ¸ãæ¹ã«ãã¦ãã 85 $(".side-menu").toggleClass("side-menu-mobile"); 86 }); 87 88 // ã¡ãã¥ã¼å¤é åã¯ãªãã¯ã«ããã¡ãã¥ã¼ãéãã 89 $(".side-menu-mobile-bg-cover, .sm-close-icon").on("click", function() { 90 $(".side-menu").removeClass("side-menu-mobile"); 91 $("#h-menu").prop('checked', false); 92 }); 93 94 // ãµã¤ãã¡ãã¥ã¼ã®ãã°ã¢ã¦ãå¦ç 95 $("#btnSmLogOut").on("click", function() { 96 $(".dlg-sm-log-out").show(); 97 }); 98 $("button[name='btnSmLogOutOk']").on("click", function() { 99 SvrAction("logout-post.php" + GetUrlPram("on") ); 100 }); 101 $("button[name='btnSmLogOutNo']").on("click", function() { 102 $(".dlg-sm-log-out").hide(); 103 }); 104 105 // ã²ãããªâã«ã¿ã«ãèªå夿 106 $("input[hira-to-kata]").on("change", function() { 107 this.value = this.value.replace( /[\u3042-\u3093]/g, 108 m => String.fromCharCode(m.charCodeAt(0) + 96)); 109 }); 110 111 $("input[name='chkMaskPswd']").on("change", function() { 112 $("input[name^='txtPswd']").each( function() { 113 if ($(this).attr('type') == 'text') { 114 $(this).attr('type','password'); 115 } else if ($(this).attr('type') == 'password') { 116 $(this).attr('type','text'); 117 } 118 }); 119 }); 120 121 $(window).resize(); 122}); 123 124// ----------------------------------------------- 125// ãããããã¦ã³ãªã¹ã 126// ----------------------------------------------- 127$(function() { 128 $(".dropdown").on("mousedown.cmn_dropdown", "button", function(oEvent) { 129 var eDropdown = oEvent.delegateTarget; 130 $(eDropdown).toggleClass("open-list"); 131 $("input", eDropdown).focus(); 132 return false;
133 }); 134 135 $(".dropdown").on("mousedown.cmn_dropdown", "li", function(oEvent) { 136 var eDropdown = oEvent.delegateTarget; 137 var sVal = $(this).text(); 138 $(eDropdown).toggleClass("open-list", false); 139 $("input", eDropdown).val(sVal).change().trigger("focusout"); 140 oEvent.stopPropagation(); 141 return false; 142 }); 143 144 $(".dropdown").on("blur.cmn_dropdown", "input", function(oEvent) { 145 var eDropdown = oEvent.delegateTarget; 146 if ($("button", eDropdown).is(":focus") == false) { 147 $(eDropdown).toggleClass("open-list", false); 148 } 149 }); 150}); 151 152// ----------------------------------------------- 153// 使è¨å®ãã¿ã³ 154// ----------------------------------------------- 155function InitSetJuushoButton(qButton, qYuubinNo, qJuusho1, qJuusho2) { 156 qButton.on("click", function() { 157 var bCheck = $.inputex.cheack(qYuubinNo, "zip", 8, true); 158 if (bCheck) { 159 var oPram = { YuubinNo: qYuubinNo.val(), ErrSetFld: qYuubinNo.attr("name") }; 160 SvrAction("postal-code-address.php", $.param(oPram), function(oData) { 161 // éµä¾¿çªå·ã®ã¨ã©ã¼ãåè¨å® 162 SetInpErrMsgPopup(qYuubinNo, ""); 163 if (typeof(oData.FldErr) != "undefined") { 164 $.each(oData.FldErr, function(sFld, sMsg) { 165 SetInpErrMsgPopup($("[name='" + sFld + "']"), sMsg); 166 }); 167 return; 168 } 169 // 䏿¸ãç¢ºèª 170 var sJuusho = CnvStr(qJuusho1.val() + qJuusho2.val()).trim(); 171 if (sJuusho != "") { 172 var sMsg = "æ¢ã«ä½æãå ¥åããã¦ãã¾ããç½®ãæãã¾ããï¼"; 173 if (confirm(sMsg) == false) { 174 return; 175 } 176 } 177 // 使ãè¨å® ( ã¨ã©ã¼ã¯ã¯ãªã¢ ) 178 SetInpErrMsgPopup(qJuusho1, ""); 179 SetInpErrMsgPopup(qJuusho2, ""); 180 qJuusho1.val(oData.AdderssInfo.juusho1); 181 qJuusho2.val(oData.AdderssInfo.juusho2); 182 }, $(this)); 183 } 184 return false; 185 }); 186} 187 188// ----------------------------------------------- 189// ãµã¼ãã¼å¦ç 190// ----------------------------------------------- 191function SvrAction(sUrl, oPram, fCallBackSuccess, jSourceElement, sReqType) { 192 if (typeof(jSourceElement) == "undefined") jSourceElement = $("<dummy>"); 193 if (typeof(sReqType) == "undefined") sReqType = "post"; 194 195 if (jSourceElement.data("isLoading") == true) { return; } 196 197 // èªã¿è¾¼ã¿ä¸ç»ååå¾ 198 if (jSourceElement.data("imgLoading") == null) {
199 jSourceElement.data("imgLoading", CreateImgLoading(jSourceElement)); 200 } 201 var jImgLoading = jSourceElement.data("imgLoading"); 202 203 // èªã¿è¾¼ã¿ä¸è¨å® 204 jSourceElement.data("isLoading", true); 205 jImgLoading.show(); 206 207 // ãµã¼ãã¼å¦ç 208 var oAjaxPram = { 209 cache : false 210 , data : oPram 211 , dataType : "json" 212 , error : SvrAction_Error 213 , success : function(oData) { SvrAction_Success(oData, fCallBackSuccess); } 214 , complete : function() { jSourceElement.data("isLoading", false); jImgLoading.hide(); } 215 , type : sReqType 216 , url : sUrl 217 }; 218 $.ajax(oAjaxPram); 219} 220 221function CreateImgLoading(jSourceElement) { 222 var jImgLoading = $("<img src='img/load.gif' style='display:none;'>"); 223 jSourceElement.after(jImgLoading); 224 225 // ç»åã®å¹ ãæ£ããåå¾ããããã«ãä½ç½®ãè¨å®ã¯èªã¿è¾¼ã¿å®äºå¾ã«è¡ã 226 jImgLoading.ready(function() { 227 SetImagePos(jSourceElement, jImgLoading); 228 }); 229 230 return jImgLoading; 231} 232 233function SetImagePos(jSourceElement, jImgLoading) { 234 if (jSourceElement[0].tagName.toLowerCase() == "dummy") { 235 return; 236 } 237 238 var oButtonRect = jSourceElement[0].getBoundingClientRect(); 239 240 var html = document.documentElement; 241 var body = document.body; 242 var scrollTop = (body.scrollTop || html.scrollTop); 243 var scrollLeft = (body.scrollLeft || html.scrollLeft); 244 oButtonRect.top += scrollTop; 245 oButtonRect.left += scrollLeft; 246 247 // 縦ä½ç½®ï¼è¦ªãã¿ã³ã¨30%éãã 248 // 横ä½ç½®ï¼è¦ªãã¿ã³ä¸å¤® 249 jImgLoading.css({ position: "absolute" 250 , top : (oButtonRect.top + scrollTop ) - (jImgLoading.height() * 0.7) 251 , left: (oButtonRect.left + scrollLeft) + (oButtonRect.width / 2) - (jImgLoading.width() / 2) 252 }); 253} 254 255function SvrAction_Success(oRes, fCallBack) { 256 // ã¡ãã»ã¼ã¸è¡¨ç¤º 257 if (typeof(oRes.Msg) != "undefined") { 258 alert(oRes.Msg.Text); 259 } 260 261 // ãã¼ã¿å¦ç 262 if (typeof(oRes.Data) != "undefined") { 263 fCallBack(oRes.Data); 264 } 265 266 // ãã¼ã¸é·ç§» 267 if (typeof(oRes.Redirect) != "undefined") { 268 location.href = oRes.Redirect.Url; 269 } 270} 271 272function SvrAction_Error(oRequest, sStatus, oError) { 273 var sMsg = sStatus; 274 if (oRequest) { 275 var nReqStatus = oRequest.status; 276 var sReqStatusText = oRequest.statusText; 277 var sResponseText = oRequest.responseText; 278 var sErrTitle = "<title>ã·ã¹ãã ã¨ã©ã¼</title>"; 279 if ( (sStatus == "error" && nReqStatus == 500) || 280 (sStatus == "parsererror" && sResponseText.indexOf(sErrTitle) != -1) ) { 281 location.href = "system-err.html"; 282 return; 283 } 284 // Ajaxã®éä¿¡ä¸ã«ç»é¢é·ç§»ãããã¨ã§çºçããã¨ã©ã¼ã«ã¤ãã¦ã¯ç¡è¦ 285 if (sStatus == "error" && nReqStatus == 0 && CnvStr(sReqStatusText) == "error") { 286 return; 287 } 288 sMsg += " (" + CnvStr(nReqStatus) + ") " + CnvStr(sReqStatusText); 289 } 290 alert(sMsg); 291} 292 293// å ¨ãã¼ãã£ã³ã°ç»åã®åé ç½® 294function RepositionAllImgLoading(jTargetItems) { 295 if (typeof(jTargetItems) == "undefined") jTargetItems = $("*"); 296 $("*").each(function() { 297 var jSourceElement = $(this); 298 if (jSourceElement.data("img-loading") != null) { 299 var jImgLoading = jSourceElement.data("img-loading"); 300 SetImagePos(jSourceElement, jImgLoading); 301 } 302 }); 303} 304 305// ----------------------------------------------- 306// ãã¿ã³å¦ç 307// ----------------------------------------------- 308 309// ãµã¼ãã¼å¦çãã¿ã³ ( ããã©ã«ãå¦ç ) 310function DefaultButtonAction() { 311 var jButton = $(this); 312 var sPostUrl = jButton.data("svr-action") + location.search; 313 314 // ã¨ã©ã¼ã¡ãã»ã¼ã¸ãã¯ãªã¢ 315 $(".msg-error").hide(); 316 317 // ãµã¼ãã¼ã«POSTéä¿¡ 318 var sPram = $(":input").serialize() 319 + "&" + $.param({ Submit: jButton.attr("name") }); 320 SvrAction(sPostUrl, sPram, DefaultSvrActionCallBack, jButton); 321 322 return false; 323} 324 325// ãµã¼ãã¼å¦çå¾ã®ã³ã¼ã«ããã¯é¢æ° ( ããã©ã«ãå¦ç ) 326function DefaultSvrActionCallBack(oData) { 327 var jMsgError = $(".msg-error"); 328 329 // ã¨ã©ã¼è¡¨ç¤ºãã¯ãªã¢ 330 jMsgError.hide(); 331 $(":input.inp-error").each(function() { SetInpErrMsgPopup($(this), ""); }); 332 333 // åé ç®ã®ã¨ã©ã¼è¡¨ç¤º 334 if (typeof(oData.FldErr) != "undefined") {
335 $.each(oData.FldErr, function(sFld, sMsg) { 336 SetInpErrMsgPopup($("[name='" + sFld + "']"), sMsg); 337 }); 338 } 339 340 // ãã¼ã¸å ¨ä½ã®ã¨ã©ã¼è¡¨ç¤º 341 if (typeof(oData.PageErr) != "undefined" && oData.PageErr != "") { 342 var sAddMsg = ""; 343 $.each(oData.PageErr, function(nIdx, sMsg) { 344 sAddMsg += "<p>" + sMsg + "</p>"; 345 }); 346 jMsgError.html(sAddMsg); 347 jMsgError.show(); 348 } 349} 350 351// ----------------------------------------------- 352// å ±é颿° 353// ----------------------------------------------- 354 355// æå夿 356function CnvStr(oData) { 357 // null, undefined 358 if (oData == null || typeof(oData) == "undefined") { 359 return ""; 360 } 361 // æå 362 if (typeof(oData) == "string") { 363 return oData; 364 } 365 // ä¸è¨ä»¥å¤ 366 return String(oData); 367} 368 369// æ°å¤å¤æ 370function CnvNum(oData) { 371 // æ°å¤ 372 if (typeof(oData) == "number") { 373 return oData; 374 } 375 // æå 376 if (typeof(oData) == "string") { 377 var nData = Number(oData.replace(/,/g, "")); 378 return (isNaN(nData)) ? 0 : nData; 379 } 380 // ä¸è¨ä»¥å¤ 381 return 0; 382} 383 384// æ¸å¼å¤æ ( ã«ã³ãåºåã ) 385function FmtNumComma(sVal) { 386 var sRetNum = new String(CnvNum(sVal)); 387 while (sRetNum != (sRetNum = sRetNum.replace(/^(-?\d+)(\d{3})/, "$1,$2"))); 388 return sRetNum; 389} 390 391// ç¾å¨ã®URLãã©ã¡ã¼ã¿ããæå®é¨åã®ãã©ã¡ã¼ã¿ãåå¾ 392function GetUrlPram(sPram) { 393 var sNowPram = location.search; 394 395 // "*"ã®å ´åããã®ã¾ã¾ 396 if (sPram == "*") { 397 return sNowPram; 398 } 399 400 // ç¾å¨ã®ãã©ã¡ã¼ã¿ãåå¾ 401 var oNowPramHas = new Object(); 402 var sNowPramAry = sNowPram.substr(1).split("&"); 403 for (var i = 0; i < sNowPramAry.length; i++) { 404 var sKeyValAry = sNowPramAry[i].split("="); 405 oNowPramHas[sKeyValAry[0]] = sNowPramAry[i]; 406 } 407 408 // æå®é¨åã®ãã©ã¡ã¼ã¿ãåå¾ 409 var sRet = ""; 410 var sDiv = "?"; 411 var sTgtPramAry = sPram.split(","); 412 for (var i = 0; i < sTgtPramAry.length; i++) { 413 if (sTgtPramAry[i] in oNowPramHas) { 414 sRet += sDiv + oNowPramHas[sTgtPramAry[i]]; 415 sDiv = "&"; 416 } 417 } 418 419 return sRet; 420} 421 422// æ°è¦ã¦ã¤ã³ãã¦ãéã 423function OpenWindow(sUrl) { 424 var nPosX = window.screenX; 425 var nPosY = window.screenY; 426 var nSizeW = window.innerWidth; 427 var nSizeH = window.innerHeight; 428 var nWidth = Math.min(Math.ceil(nSizeW * 0.9), 1020); 429 var nHeight = Math.ceil(nSizeH * 0.9); 430 var sPram = "left=" + (nPosX + Math.floor((nSizeW - nWidth ) / 2)) 431 + ",top=" + (nPosY + Math.floor((nSizeH - nHeight) / 2)) 432 + ",width=" + nWidth 433 + ",height=" + nHeight 434 + ",menubar=no,toolbar=no,resizable=yes,scrollbars=yes"; 435 return window.open(sUrl, null, sPram); 436} 437 438// å ¥åã¨ã©ã¼ã¡ãã»ã¼ã¸ã表示 439function SetInpErrMsgPopup(qInpFld, sErrMsg) { 440 //åæå¤ã§ã¯ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ç¡ã 441 $.data(qInpFld, "errmsg", ""); 442 $.data(qInpFld, "dispval", ""); 443 444 if (sErrMsg != "") { 445 qInpFld.addClass("inp-error"); 446 if (qInpFld.next("a.tooltip").length != 0) { 447 qInpFld.next("a.tooltip").remove(); 448 } 449 qInpFld.after("<a href='#' class='tooltip' tabindex='-1' onclick='return false;'>Ã<span>" + sErrMsg + "</span></a>"); 450 $.data(qInpFld, "errmsg", sErrMsg); 451 qInpFld.data("errmsg", sErrMsg); 452 } else { 453 qInpFld.removeClass("inp-error"); 454 qInpFld.next("a.tooltip").remove(); 455 $.data(qInpFld, "errmsg", ""); 456 qInpFld.data("errmsg", ''); 457 } 458} 459
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.