1var $jQueryMakeShop = $.noConflict(true); 2(function($) { 3$(function() { 4 initCommonLogin(); 5 initCommonCart(); 6 initCommonOrderForm(); 7 initCommonFavorite(); 8 initCommonSearchForm(); 9 initCommonContactForm(); 10 initCommonSlideshow(); 11}); 12 13// Deletion Candidate 14function initCommonLogin() 15{ 16 var loginUrlPrefix = '#makeshop-common-login-url:'; 17 $('[href^="' + loginUrlPrefix + '"]').on('click', function() { 18 var key = $(this).attr('href').replace(loginUrlPrefix, ''); 19 switch (key) { 20 case 'login': location.replace('/view/member/login'); break; 21 case 'mypage': location.replace('/view/member/mypage'); break; 22 case 'confirm': location.replace('/view/member/order-history'); break; 23 case 'reserve': location.replace('/view/member/point'); break; 24 case 'favorite': location.replace('/view/member/favorite'); break; 25 case 'member': location.replace('/view/member/member-edit'); break; 26 default: break; 27 } 28 29 return false; 30 }); 31} 32 33function initCommonCart() 34{ 35 var pageData = $('#makeshop-page-common-cart-data'); 36 var cartUrl = pageData.attr('data-cart-url'); 37 var entryUrlPrefix = pageData.attr('data-cart-entry-url-prefix'); 38 var removeUrlPrefix = pageData.attr('data-cart-remove-url-prefix'); 39 var quantityUrlPrefix = pageData.attr('data-cart-quantity-url-prefix'); 40 var quantityIdPrefix = pageData.attr('data-id-quantity-prefix'); 41 42 $('[href^="' + entryUrlPrefix + '"]').on('click', function() { 43 var source = $(this).attr('href'); 44 var index = $('[href="' + source + '"]').index(this); 45 var itemCode = source.replace(entryUrlPrefix, ''); 46 47 $.ajax({ 48 url: '/api/cart/', 49 type: 'POST', 50 data: JSON.stringify({ 51 'action': 'add', 52 'source': source, 53 'element_index': index, 54 'item_code': itemCode, 55 'option_list': [], 56 'quantity': 1, 57 'is_subscription': false, 58 'name_print' : [] 59 }), 60 contentType: 'application/json', 61 dataType: 'json' 62 }).done(function(data) { 63 if (data.result && data.conversion_list) { 64 insertConversionHtml(data.conversion_list); 65 } 66 if (data.result && data.ga4.event) { 67 makeshop_ga_gtag('event', data.ga4.event, data.ga4.parameters); 68 } 69 70 if (typeof MakeShop_afterListCartEntry === 'function') { 71 var hookData = { 72 result: data.result, 73 source: data.source, 74 elementIndex: data.element_index, 75 systemCode: data.item_code, 76 totalQuantity: data.total_quantity, 77 error: data.error, 78 method: { 79 modal: openModalMessage 80 } 81 }; 82 if (MakeShop_afterListCartEntry(hookData) === false) { 83 return; 84 } 85 } 86 87 if (!data.result) { 88 openModalMessage(data.error.message); 89 return; 90 } 91 92 location.href = cartUrl; 93 }); 94 95 return false; 96 }); 97 98 $('[href^="' + removeUrlPrefix + '"]').on('click', function() { 99 var source = $(this).attr('href'); 100 var index = $('[href="' + source + '"]').index(this); 101 var key = source.replace(removeUrlPrefix, ''); 102 var item = key.split('-'); 103 var customSelectBasketId = item.length > 5 ? parseInt(item[5], 10) : 0; 104 105 $.ajax({ 106 url: '/api/cart/', 107 type: 'POST', 108 data: JSON.stringify({ 109 'action': 'remove', 110 'source': source, 111 'element_index': index, 112 'item_code': item[0], 113 'option1': item[1], 114 'option2': item[2], 115 'option_group': item[3], 116 'name_print_number': item[4], 117 'custom_select_basket_id': customSelectBasketId 118 }), 119 contentType: 'application/json', 120 dataType: 'json' 121 }).done(function(data) { 122 if (typeof MakeShop_afterCartRemove === 'function') { 123 var hookData = { 124 result: data.result, 125 source: data.source, 126 elementIndex: data.element_index, 127 systemCode: data.item_code, 128 totalQuantity: data.total_quantity, 129 error: data.error, 130 method: { 131 modal: openModalMessage 132 } 133 }; 134 if (MakeShop_afterCartRemove(hookData) === false) { 135 return; 136 } 137 } 138 139 if (!data.result) { 140 openModalMessage(data.error.message); 141 return; 142 } 143 location.href = cartUrl; 144 }); 145 146 return false;
147 }); 148 149 $('[href^="' + quantityUrlPrefix + '"]').on('click', function() { 150 var source = $(this).attr('href'); 151 var index = $('[href="' + source + '"]').index(this); 152 var key = source.replace(quantityUrlPrefix, ''); 153 var item = key.split('-'); 154 var customSelectBasketId = item.length > 5 ? parseInt(item[5], 10) : 0; 155 156 var quantity = getFormValue(quantityIdPrefix + key, index); 157 158 $.ajax({ 159 url: '/api/cart/', 160 type: 'POST', 161 data: JSON.stringify({ 162 'action': 'quantity', 163 'source': source, 164 'element_index': index, 165 'item_code': item[0], 166 'option1': item[1], 167 'option2': item[2], 168 'option_group': item[3], 169 'name_print_number': item[4], 170 'quantity': quantity, 171 'custom_select_basket_id': customSelectBasketId 172 }), 173 contentType: 'application/json', 174 dataType: 'json' 175 }).done(function(data) { 176 if (typeof MakeShop_afterCartQuantity === 'function') { 177 var hookData = { 178 result: data.result, 179 source: data.source, 180 elementIndex: data.element_index, 181 systemCode: data.item_code, 182 totalQuantity: data.total_quantity, 183 error: data.error, 184 method: { 185 modal: openModalMessage 186 } 187 }; 188 if (MakeShop_afterCartQuantity(hookData) === false) { 189 return; 190 } 191 } 192 193 if (!data.result) { 194 openModalMessage(data.error.message); 195 return; 196 } 197 location.href = cartUrl; 198 }); 199 200 return false; 201 }); 202} 203 204function initCommonOrderForm() 205{ 206 var pageData = $('#makeshop-page-common-order-data'); 207 var orderUrl = pageData.attr('data-order-url'); 208 209 $('[href="' + orderUrl + '"]').on('click', function() { 210 $.ajax({ 211 url: '/api/cart/', 212 type: 'POST', 213 data: JSON.stringify({ 214 'service_type': 'makeshop', 215 'action': 'order' 216 }), 217 contentType: 'application/json', 218 dataType: 'json' 219 }).done(function(data) { 220 if (!data.result) { 221 openModalMessage(data.error.message); 222 return; 223 } 224 225 if (data.action === 'login') { 226 var opt = '&ssl_tempid=' + $('#makeshop-form-common-order input[name=ssl_tempid]').val(); 227 ssl_login(data.login_type, opt); 228 return; 229 } 230 231 $('#makeshop-form-common-order').attr('action', data.order_url); 232 233 $('#makeshop-form-common-order').trigger('submit'); 234 }); 235 236 return false; 237 }); 238} 239 240function initCommonFavorite() 241{ 242 var pageData = $('#makeshop-page-common-favorite-data'); 243 var entryUrlPrefix = pageData.attr('data-favorite-entry-url-prefix'); 244 var removeUrlPrefix = pageData.attr('data-favorite-remove-url-prefix'); 245 246 $('[href^="' + entryUrlPrefix + '"]').on('click', function() { 247 var source = $(this).attr('href'); 248 var index = $('[href="' + source + '"]').index(this); 249 var itemCode = source.replace(entryUrlPrefix, ''); 250 251 $.ajax({ 252 url: '/api/favorite/', 253 type: 'POST', 254 data: JSON.stringify({ 255 'action': 'add', 256 'source': source, 257 'element_index': index, 258 'item_code': itemCode 259 }), 260 contentType: 'application/json', 261 dataType: 'json' 262 }).done(function(data) { 263 if (typeof MakeShop_afterListFavoriteEntry === 'function') { 264 var hookData = { 265 result: data.result, 266 source: data.source, 267 elementIndex: data.element_index, 268 systemCode: data.item_code, 269 error: data.error, 270 method: { 271 modal: openModalMessage 272 } 273 }; 274 if (MakeShop_afterListFavoriteEntry(hookData) === false) { 275 return; 276 } 277 } 278 279 if (!data.result) { 280 openModalMessage(data.error.message); 281 return; 282 } 283 284 openModalMessage(data.message); 285 }); 286 287 return false;
288 }); 289 290 $('[href^="' + removeUrlPrefix + '"]').on('click', function() { 291 var source = $(this).attr('href'); 292 var index = $('[href="' + source + '"]').index(this); 293 var itemCode = source.replace(removeUrlPrefix, ''); 294 295 $.ajax({ 296 url: '/api/favorite/', 297 type: 'POST', 298 data: JSON.stringify({ 299 'action': 'remove', 300 'source': source, 301 'element_index': index, 302 'item_code': itemCode 303 }), 304 contentType: 'application/json', 305 dataType: 'json' 306 }).done(function(data) { 307 if (typeof MakeShop_afterListFavoriteRemove === 'function') { 308 var hookData = { 309 result: data.result, 310 source: data.source, 311 elementIndex: data.element_index, 312 systemCode: data.item_code, 313 error: data.error, 314 method: { 315 modal: openModalMessage 316 } 317 }; 318 if (MakeShop_afterListFavoriteRemove(hookData) === false) { 319 return; 320 } 321 } 322 323 if (!data.result) { 324 openModalMessage(data.error.message); 325 return; 326 } 327 328 openModalMessage(data.message); 329 }); 330 331 return false; 332 }); 333} 334 335function initCommonSearchForm() 336{ 337 var pageData = $('#makeshop-page-common-search-data'); 338 var searchUrl = pageData.attr('data-search-url'); 339 var keywordId = pageData.attr('data-id-keyword'); 340 var nameId = pageData.attr('data-id-name'); 341 var priceLowId = pageData.attr('data-id-price-low'); 342 var priceHighId = pageData.attr('data-id-price-high'); 343 var categoryId = pageData.attr('data-id-category'); 344 var originalCodeId = pageData.attr('data-id-original-code'); 345 346 $('[href="' + searchUrl + '"]').on('click', function() { 347 var index = $('[href="' + searchUrl + '"]').index(this); 348 var count = $('[href="' + searchUrl + '"]').length; 349 350 var keyword = getFormValue(keywordId, count === $('[data-id="' + keywordId + '"]').length ? index : 0); 351 var name = getFormValue(nameId, count === $('[data-id="' + nameId + '"]').length ? index : 0); 352 var priceLow = getFormValue(priceLowId, count === $('[data-id="' + priceLowId + '"]').length ? index : 0); 353 var priceHigh = getFormValue(priceHighId, count === $('[data-id="' + priceHighId + '"]').length ? index : 0); 354 var category = getFormValue(categoryId, count === $('[data-id="' + categoryId + '"]').length ? index : 0); 355 var originalCode = getFormValue(originalCodeId, count === $('[data-id="' + originalCodeId + '"]').length ? index : 0); 356 357 $.ajax({ 358 url: '/shop/shopsearch_url.html', 359 type: 'POST', 360 data: JSON.stringify({ 361 'keyword': keyword, 362 'name': name, 363 'price_low': priceLow, 364 'price_high': priceHigh, 365 'category': category, 366 'original_code': originalCode 367 }), 368 contentType: 'application/json', 369 dataType: 'json' 370 }).done(function(data) { 371 if (!data.result) { 372 openModalMessage(data.error.message); 373 return; 374 } 375 location.href = data.url; 376 }); 377 378 return false; 379 }); 380} 381 382function initCommonContactForm() 383{ 384 var pageData = $('#makeshop-page-common-contact-data'); 385 var contactUrl = pageData.attr('data-contact-url'); 386 387 $('[href="' + contactUrl + '"]').on('click', function() { 388 $('#makeshop-form-common-contact').trigger('submit'); 389 return false; 390 }); 391} 392 393function initCommonSlideshow() 394{ 395 var pageData = $('#makeshop-page-common-slideshow-data'); 396 397 if (pageData.attr('data-enabled') !== 'Y') { 398 return; 399 } 400 401 $('#M_slider .M_sliderFirstImage').remove(); 402 $('#M_slider li').show(); 403 $('#M_slider').bxSlider({ 404 pause: pageData.attr('data-pause'), 405 speed: pageData.attr('data-speed'), 406 controls: pageData.attr('data-controls') === 'Y', 407 captions: pageData.attr('data-captions') === 'Y', 408 mode: pageData.attr('data-mode'), 409 auto: true 410 }); 411} 412 413function openModalMessage(message, callback) 414{ 415 $('[data-remodal-id=makeshop-common-modal] .error-text').html(message); 416 var modal = $('[data-remodal-id=makeshop-common-modal]').remodal({ 417 hashTracking: false, 418 closeOnOutsideClick: false, 419 modifier: 'makeshop-modal' 420 }); 421 if (callback !== undefined) { 422 $(document).on('closed', '.makeshop-modal .remodal', function (e) { 423 callback(); 424 }); 425 } 426 modal.open(); 427} 428window.openAmazonBuyNowModalMessage = function(message, callback) { 429 $('[data-remodal-id=makeshop-common-modal] .error-text').html(message); 430 var modal = $('[data-remodal-id=makeshop-common-modal]').remodal({ 431 hashTracking: false, 432 closeOnOutsideClick: false, 433 modifier: 'makeshop-modal' 434 }); 435 436 if (callback !== undefined) { 437 // åå空éåãããã¤ãã³ãã使ç¨ãã¦ãæ¢åã®ãã³ãã©ãè§£é¤ãã¦ããç»é² 438 $(document).off('closed.amazonBuyNow', '.makeshop-modal .remodal'); 439 $(document).on('closed.amazonBuyNow', '.makeshop-modal .remodal', function (e) { 440 callback(); 441 // å®è¡å¾ã«ãã³ãã©ãè§£é¤ï¼ã¡ã¢ãªãªã¼ã¯é²æ¢ï¼ 442 $(document).off('closed.amazonBuyNow', '.makeshop-modal .remodal'); 443 }); 444 } 445 446 modal.open(); 447}; 448 449function getFormValue(dataId, index) 450{ 451 var result = $('[data-id="' + dataId + '"]').eq(index).val(); 452 return (result === undefined) ? '' : result; 453} 454 455function setFormValue(dataId, index, value) 456{ 457 $('[data-id="' + dataId + '"]').eq(index).val(value); 458} 459 460function insertConversionHtml(conversionList) 461{ 462 for (const conversion of conversionList) {
463 const div = $('<div>').css('display', 'none'); 464 465 if (conversion.position === 'head') { 466 $('head').append(div); 467 } else if (conversion.position === 'body_top') { 468 $('body').prepend(div); 469 } else if (conversion.position === 'body_bottom') { 470 $('body').append(div); 471 } 472 473 div.html(conversion.html); 474 } 475} 476 477})($jQueryMakeShop); 478$jQueryMakeShop = null;
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.