Changeset 23379
- Timestamp:
- 2014/04/30 12:13:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/html/js/eccube.js
r23264 r23379 1 1 /* 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 * This file is part of EC-CUBE 3 * 4 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. 5 * 6 * http://www.lockon.co.jp/ 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 */ 22 22 23 23 (function( window, undefined ){ … … 53 53 } 54 54 features = features + ",scrollbars=" + option.scrollbars + 55 56 57 58 59 55 ",resizable=" + option.resizable + 56 ",toolbar=" + option.toolbar + 57 ",location=" + option.location + 58 ",directories=" + option.directories + 59 ",status=" + option.status; 60 60 if (option.hasOwnProperty('menubar')) { 61 features = features + ",menubar=" + option ['menubar'];61 features = features + ",menubar=" + option.menubar; 62 62 } 63 63 var WIN = window.open(URL,name,features); … … 76 76 if( ua.indexOf('MSIE 4') !== -1 && ua.indexOf('Win') !== -1 ) { 77 77 if (window.opener.hasOwnProperty('closed')) { 78 return !window.opener ['closed'];78 return !window.opener.closed; 79 79 } else { 80 80 return false; … … 90 90 // 郵便番号入力呼び出し. 91 91 eccube.getAddress = function(php_url, tagname1, tagname2, input1, input2) { 92 var zip1 = document ['form1'][tagname1].value;93 var zip2 = document ['form1'][tagname2].value;92 var zip1 = document.form1[tagname1].value; 93 var zip2 = document.form1[tagname2].value; 94 94 95 95 if(zip1.length === 3 && zip2.length === 4) { … … 115 115 if(state !== "") { 116 116 // 項目に値を入力する. 117 document ['form1'][input1].selectedIndex = state;118 document ['form1'][input2].value = city + town;117 document.form1[input1].selectedIndex = state; 118 document.form1[input2].value = city + town; 119 119 } 120 120 }; 121 121 122 122 eccube.setFocus = function(name) { 123 if(document ['form1'].hasOwnProperty(name)) {124 document ['form1'][name].focus();123 if(document.form1.hasOwnProperty(name)) { 124 document.form1[name].focus(); 125 125 } 126 126 }; … … 152 152 break; 153 153 } 154 document ['form1']['mode'].value = mode;154 document.form1.mode.value = mode; 155 155 if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 156 document ['form1'][keyname].value = keyid;157 } 158 document ['form1'].submit();156 document.form1[keyname].value = keyid; 157 } 158 document.form1.submit(); 159 159 }; 160 160 … … 221 221 222 222 /** 223 224 225 226 227 223 * フォームを送信する. 224 * 225 * @param values 226 * @param form 227 */ 228 228 eccube.submitForm = function(values, form){ 229 229 var formElement = eccube.getFormElement(form); … … 237 237 238 238 /** 239 240 241 242 243 239 * フォームを特定してエレメントを返す. 240 * 241 * @param form 242 * @returns {*} 243 */ 244 244 eccube.getFormElement = function(form){ 245 245 var formElement; … … 256 256 // ポイント入力制限。 257 257 eccube.togglePointForm = function() { 258 if(document ['form1']['point_check']) {258 if(document.form1.point_check) { 259 259 var list = ['use_point']; 260 260 var color; 261 261 var flag; 262 262 263 if(!document ['form1']['point_check'][0].checked) {263 if(!document.form1.point_check[0].checked) { 264 264 color = "#dddddd"; 265 265 flag = true; … … 271 271 var len = list.length; 272 272 for(var i = 0; i < len; i++) { 273 if(document ['form1'][list[i]]) {274 var current_color = document ['form1'][list[i]].style.backgroundColor;273 if(document.form1[list[i]]) { 274 var current_color = document.form1[list[i]].style.backgroundColor; 275 275 if (color !== "#dddddd" && (current_color === "#ffe8e8" || current_color === "rgb(255, 232, 232)")) 276 276 { 277 277 continue; 278 278 } 279 document ['form1'][list[i]].disabled = flag;280 document ['form1'][list[i]].style.backgroundColor = color;279 document.form1[list[i]].disabled = flag; 280 document.form1[list[i]].style.backgroundColor = color; 281 281 } 282 282 } … … 286 286 // 別のお届け先入力制限。 287 287 eccube.toggleDeliveryForm = function() { 288 if(!document ['form1']) {288 if(!document.form1) { 289 289 return; 290 290 } 291 if(document ['form1']['deliv_check']) {291 if(document.form1.deliv_check) { 292 292 var list = [ 293 293 'shipping_name01', … … 311 311 ]; 312 312 313 if(!document ['form1']['deliv_check'].checked) {313 if(!document.form1.deliv_check.checked) { 314 314 eccube.changeDisabled(list, '#dddddd'); 315 315 } else { … … 326 326 327 327 for(var i = 0; i < len; i++) { 328 if(document ['form1'][list[i]]) {328 if(document.form1[list[i]]) { 329 329 if(color === "") { 330 330 // 有効にする。 331 document ['form1'][list[i]].removeAttribute('disabled');332 document ['form1'][list[i]].style.backgroundColor = eccube.savedColor[list[i]];331 document.form1[list[i]].removeAttribute('disabled'); 332 document.form1[list[i]].style.backgroundColor = eccube.savedColor[list[i]]; 333 333 } else { 334 334 // 無効にする。 335 document ['form1'][list[i]].setAttribute('disabled', 'disabled');336 eccube.savedColor[list[i]] = document ['form1'][list[i]].style.backgroundColor;337 document ['form1'][list[i]].style.backgroundColor = color;//"#f0f0f0";335 document.form1[list[i]].setAttribute('disabled', 'disabled'); 336 eccube.savedColor[list[i]] = document.form1[list[i]].style.backgroundColor; 337 document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0"; 338 338 } 339 339 } … … 408 408 409 409 /** 410 411 410 * 規格2のプルダウンを設定する. 411 */ 412 412 eccube.setClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) { 413 413 if ($sele1 && $sele1.length) { … … 421 421 // 商品一覧時 422 422 if (eccube.hasOwnProperty('productsClassCategories')) { 423 classcat2 = eccube ['productsClassCategories'][product_id][classcat_id1];423 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]; 424 424 } 425 425 // 詳細表示時 426 426 else { 427 classcat2 = eccube ['classCategories'][classcat_id1];427 classcat2 = eccube.classCategories[classcat_id1]; 428 428 } 429 429 … … 431 431 for (var key in classcat2) { 432 432 if (classcat2.hasOwnProperty(key)) { 433 var id = classcat2[key] ['classcategory_id2'];434 var name = classcat2[key] ['name'];433 var id = classcat2[key].classcategory_id2; 434 var name = classcat2[key].name; 435 435 var option = $('<option />').val(id ? id : '').text(name); 436 436 if (id === selected_id2) { … … 441 441 } 442 442 eccube.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', 443 443 $sele2.val() ? $sele2.val() : ''); 444 444 } 445 445 } … … 447 447 448 448 /** 449 450 449 * 規格の選択状態に応じて, フィールドを設定する. 450 */ 451 451 eccube.checkStock = function($form, product_id, classcat_id1, classcat_id2) { 452 452 … … 457 457 // 商品一覧時 458 458 if (eccube.hasOwnProperty('productsClassCategories')) { 459 classcat2 = eccube ['productsClassCategories'][product_id][classcat_id1]['#' + classcat_id2];459 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 460 460 } 461 461 // 詳細表示時 462 462 else { 463 classcat2 = eccube ['classCategories'][classcat_id1]['#' + classcat_id2];463 classcat2 = eccube.classCategories[classcat_id1]['#' + classcat_id2]; 464 464 } 465 465 … … 467 467 var $product_code_default = $form.find('[id^=product_code_default]'); 468 468 var $product_code_dynamic = $form.find('[id^=product_code_dynamic]'); 469 if (classcat2 && typeof classcat2 ['product_code']!== 'undefined') {469 if (classcat2 && typeof classcat2.product_code !== 'undefined') { 470 470 $product_code_default.hide(); 471 471 $product_code_dynamic.show(); 472 $product_code_dynamic.text(classcat2 ['product_code']);472 $product_code_dynamic.text(classcat2.product_code); 473 473 } else { 474 474 $product_code_default.show(); … … 479 479 var $cartbtn_default = $form.find('[id^=cartbtn_default]'); 480 480 var $cartbtn_dynamic = $form.find('[id^=cartbtn_dynamic]'); 481 if (classcat2 && classcat2 ['stock_find']=== false) {481 if (classcat2 && classcat2.stock_find === false) { 482 482 483 483 $cartbtn_dynamic.text('申し訳ございませんが、只今品切れ中です。').show(); … … 491 491 var $price01_default = $form.find('[id^=price01_default]'); 492 492 var $price01_dynamic = $form.find('[id^=price01_dynamic]'); 493 if (classcat2 && typeof classcat2 ['price01'] !== 'undefined' && String(classcat2['price01']).length >= 1) {494 495 $price01_dynamic.text(classcat2 ['price01']).show();493 if (classcat2 && typeof classcat2.price01 !== 'undefined' && String(classcat2.price01).length >= 1) { 494 495 $price01_dynamic.text(classcat2.price01).show(); 496 496 $price01_default.hide(); 497 497 } else { … … 503 503 var $price02_default = $form.find('[id^=price02_default]'); 504 504 var $price02_dynamic = $form.find('[id^=price02_dynamic]'); 505 if (classcat2 && typeof classcat2 ['price02'] !== 'undefined' && String(classcat2['price02']).length >= 1) {506 507 $price02_dynamic.text(classcat2 ['price02']).show();505 if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) { 506 507 $price02_dynamic.text(classcat2.price02).show(); 508 508 $price02_default.hide(); 509 509 } else { … … 515 515 var $point_default = $form.find('[id^=point_default]'); 516 516 var $point_dynamic = $form.find('[id^=point_dynamic]'); 517 if (classcat2 && typeof classcat2 ['point'] !== 'undefined' && String(classcat2['point']).length >= 1) {518 519 $point_dynamic.text(classcat2 ['point']).show();517 if (classcat2 && typeof classcat2.point !== 'undefined' && String(classcat2.point).length >= 1) { 518 519 $point_dynamic.text(classcat2.point).show(); 520 520 $point_default.hide(); 521 521 } else { … … 526 526 // 商品規格 527 527 var $product_class_id_dynamic = $form.find('[id^=product_class_id]'); 528 if (classcat2 && typeof classcat2 ['product_class_id'] !== 'undefined' && String(classcat2['product_class_id']).length >= 1) {529 $product_class_id_dynamic.val(classcat2 ['product_class_id']);528 if (classcat2 && typeof classcat2.product_class_id !== 'undefined' && String(classcat2.product_class_id).length >= 1) { 529 $product_class_id_dynamic.val(classcat2.product_class_id); 530 530 } else { 531 531 $product_class_id_dynamic.val(''); … … 537 537 538 538 /** 539 540 539 * Initialize. 540 */ 541 541 $(function() { 542 542 // 規格1選択時 543 543 $('select[name=classcategory_id1]') 544 545 546 547 548 549 550 551 552 553 554 555 556 557 544 .change(function() { 545 var $form = $(this).parents('form'); 546 var product_id = $form.find('input[name=product_id]').val(); 547 var $sele1 = $(this); 548 var $sele2 = $form.find('select[name=classcategory_id2]'); 549 550 // 規格1のみの場合 551 if (!$sele2.length) { 552 eccube.checkStock($form, product_id, $sele1.val(), '0'); 553 // 規格2ありの場合 554 } else { 555 eccube.setClassCategories($form, product_id, $sele1, $sele2); 556 } 557 }); 558 558 559 559 // 規格2選択時 560 560 $('select[name=classcategory_id2]') 561 562 563 564 565 566 567 561 .change(function() { 562 var $form = $(this).parents('form'); 563 var product_id = $form.find('input[name=product_id]').val(); 564 var $sele1 = $form.find('select[name=classcategory_id1]'); 565 var $sele2 = $(this); 566 eccube.checkStock($form, product_id, $sele1.val(), $sele2.val()); 567 }); 568 568 569 569 // マウスオーバーで画像切り替え … … 583 583 584 584 // モーダルウィンドウ 585 if ($('a.expansion').length) { 586 $('a.expansion').colorbox(); 585 if ($('a.expansion').length) { 586 $('a.expansion').colorbox(); 587 587 } 588 588 });
Note: See TracChangeset
for help on using the changeset viewer.