Changeset 23102 for branches/version-2_13-dev/html/js/eccube.js
- Timestamp:
- 2013/08/20 09:12:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/html/js/eccube.js
r23101 r23102 32 32 33 33 eccube.defaults = { 34 'formId':'form1',35 "windowFeatures":{36 'scrollbars':'yes',37 'resizable':'yes',38 'toolbar':'no',39 'location':'no',40 'directories':'no',41 'status':'no',42 'focus':true,43 'formTarget':''34 formId:'form1', 35 windowFeatures:{ 36 scrollbars:'yes', 37 resizable:'yes', 38 toolbar:'no', 39 location:'no', 40 directories:'no', 41 status:'no', 42 focus:true, 43 formTarget:'' 44 44 } 45 45 }; … … 59 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); … … 73 73 eccube.isOpener = function() { 74 74 var ua = navigator.userAgent; 75 if( !!window.opener ) { 76 if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) { 77 return !window.opener.closed; 75 if( window.opener ) { 76 if( ua.indexOf('MSIE 4') !== -1 && ua.indexOf('Win') !== -1 ) { 77 if (window.opener.hasOwnProperty('closed')) { 78 return !window.opener['closed']; 79 } else { 80 return false; 81 } 78 82 } else { 79 return typeof window.opener.document == 'object';83 return typeof window.opener.document === 'object'; 80 84 } 81 85 } else { … … 85 89 86 90 eccube.chgImg = function(fileName,img){ 87 if (typeof(img) == "object") {91 if (typeof(img) === "object") { 88 92 img.src = fileName; 89 93 } else { … … 98 102 // 郵便番号入力呼び出し. 99 103 eccube.getAddress = function(php_url, tagname1, tagname2, input1, input2) { 100 var zip1 = document .form1[tagname1].value;101 var zip2 = document .form1[tagname2].value;102 103 if(zip1.length == 3 && zip2.length== 4) {104 var zip1 = document['form1'][tagname1].value; 105 var zip2 = document['form1'][tagname2].value; 106 107 if(zip1.length === 3 && zip2.length === 4) { 104 108 $.get( 105 109 php_url, … … 110 114 eccube.putAddress(input1, input2, arrData[0], arrData[1], arrData[2]); 111 115 } else { 112 alert(data);116 window.alert(data); 113 117 } 114 118 } 115 119 ); 116 120 } else { 117 alert("郵便番号を正しく入力して下さい。");121 window.alert("郵便番号を正しく入力して下さい。"); 118 122 } 119 123 }; … … 121 125 // 郵便番号から検索した住所を渡す. 122 126 eccube.putAddress = function(input1, input2, state, city, town) { 123 if(state != "") {127 if(state !== "") { 124 128 // 項目に値を入力する. 125 document .form1[input1].selectedIndex = state;126 document .form1[input2].value = city + town;129 document['form1'][input1].selectedIndex = state; 130 document['form1'][input2].value = city + town; 127 131 } 128 132 }; 129 133 130 134 eccube.setFocus = function(name) { 131 if(document .form1[name]) {132 document .form1[name].focus();135 if(document['form1'].hasOwnProperty(name)) { 136 document['form1'][name].focus(); 133 137 } 134 138 }; … … 160 164 break; 161 165 } 162 document .form1['mode'].value = mode;163 if(keyname != "" && keyid != "") {164 document .form1[keyname].value = keyid;165 } 166 document .form1.submit();166 document['form1']['mode'].value = mode; 167 if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 168 document['form1'][keyname].value = keyid; 169 } 170 document['form1'].submit(); 167 171 }; 168 172 … … 189 193 } 190 194 formElement.find("input[name='mode']").val(mode); 191 if(keyname != "" && keyid != "") {195 if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 192 196 formElement.find("*[name=" + keyname + "]").val(keyid); 193 197 } … … 211 215 212 216 eccube.changeAction = function(url) { 213 document .form1.action = url;217 document['form1'].action = url; 214 218 }; 215 219 … … 236 240 // ポイント入力制限。 237 241 eccube.togglePointForm = function() { 238 if(document .form1['point_check']) {242 if(document['form1']['point_check']) { 239 243 var list = ['use_point']; 240 244 var color; 241 245 var flag; 242 246 243 if(!document .form1['point_check'][0].checked) {247 if(!document['form1']['point_check'][0].checked) { 244 248 color = "#dddddd"; 245 249 flag = true; … … 250 254 251 255 var len = list.length; 252 for( i = 0; i < len; i++) {253 if(document .form1[list[i]]) {254 var current_color = document .form1[list[i]].style.backgroundColor;255 if (color != "#dddddd" && (current_color == "#ffe8e8" || current_color== "rgb(255, 232, 232)"))256 for(var i = 0; i < len; i++) { 257 if(document['form1'][list[i]]) { 258 var current_color = document['form1'][list[i]].style.backgroundColor; 259 if (color !== "#dddddd" && (current_color === "#ffe8e8" || current_color === "rgb(255, 232, 232)")) 256 260 { 257 261 continue; 258 262 } 259 document .form1[list[i]].disabled = flag;260 document .form1[list[i]].style.backgroundColor = color;263 document['form1'][list[i]].disabled = flag; 264 document['form1'][list[i]].style.backgroundColor = color; 261 265 } 262 266 } … … 266 270 // 別のお届け先入力制限。 267 271 eccube.toggleDeliveryForm = function() { 268 if(!document .form1) {272 if(!document['form1']) { 269 273 return; 270 274 } 271 if(document .form1['deliv_check']) {275 if(document['form1']['deliv_check']) { 272 276 var list = [ 273 277 'shipping_name01', … … 285 289 ]; 286 290 287 if(!document .form1['deliv_check'].checked) {291 if(!document['form1']['deliv_check'].checked) { 288 292 eccube.changeDisabled(list, '#dddddd'); 289 293 } else { … … 299 303 var len = list.length; 300 304 301 for( i = 0; i < len; i++) {302 if(document .form1[list[i]]) {303 if(color == "") {305 for(var i = 0; i < len; i++) { 306 if(document['form1'][list[i]]) { 307 if(color === "") { 304 308 // 有効にする。 305 document .form1[list[i]].disabled = false;306 document .form1[list[i]].style.backgroundColor = eccube.savedColor[list[i]];309 document['form1'][list[i]].removeAttribute('disabled'); 310 document['form1'][list[i]].style.backgroundColor = eccube.savedColor[list[i]]; 307 311 } else { 308 312 // 無効にする。 309 document .form1[list[i]].disabled = true;310 eccube.savedColor[list[i]] = document .form1[list[i]].style.backgroundColor;311 document .form1[list[i]].style.backgroundColor = color;//"#f0f0f0";313 document['form1'][list[i]].setAttribute('disabled', 'disabled'); 314 eccube.savedColor[list[i]] = document['form1'][list[i]].style.backgroundColor; 315 document['form1'][list[i]].style.backgroundColor = color;//"#f0f0f0"; 312 316 } 313 317 } … … 336 340 // 必須項目のチェック 337 341 for(var cnt = 0; cnt < max; cnt++) { 338 if(formElement.find("input[name=" + checkItems[cnt] + "]").val() == "") {342 if(formElement.find("input[name=" + checkItems[cnt] + "]").val() === "") { 339 343 errorFlag = true; 340 344 break; … … 343 347 344 348 // 必須項目が入力されていない場合 345 if(errorFlag == true) {346 alert('メールアドレス/パスワードを入力して下さい。');349 if(errorFlag === true) { 350 window.alert('メールアドレス/パスワードを入力して下さい。'); 347 351 return false; 348 352 } else { … … 394 398 395 399 // 商品一覧時 396 if (eccube. productsClassCategories !== undefined) {397 classcat2 = eccube .productsClassCategories[product_id][classcat_id1];400 if (eccube.hasOwnProperty('productsClassCategories')) { 401 classcat2 = eccube['productsClassCategories'][product_id][classcat_id1]; 398 402 } 399 403 // 詳細表示時 400 404 else { 401 classcat2 = eccube .classCategories[classcat_id1];405 classcat2 = eccube['classCategories'][classcat_id1]; 402 406 } 403 407 404 408 // 規格2の要素を設定 405 409 for (var key in classcat2) { 406 var id = classcat2[key]['classcategory_id2']; 407 var name = classcat2[key]['name']; 408 var option = $('<option />').val(id ? id : '').text(name); 409 if (id == selected_id2) { 410 option.attr('selected', true); 410 if (classcat2.hasOwnProperty(key)) { 411 var id = classcat2[key]['classcategory_id2']; 412 var name = classcat2[key]['name']; 413 var option = $('<option />').val(id ? id : '').text(name); 414 if (id === selected_id2) { 415 option.attr('selected', true); 416 } 417 $sele2.append(option); 411 418 } 412 $sele2.append(option);413 419 } 414 420 eccube.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', … … 428 434 429 435 // 商品一覧時 430 if ( typeof eccube.productsClassCategories != 'undefined') {431 classcat2 = eccube .productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];436 if (eccube.hasOwnProperty('productsClassCategories')) { 437 classcat2 = eccube['productsClassCategories'][product_id][classcat_id1]['#' + classcat_id2]; 432 438 } 433 439 // 詳細表示時 434 440 else { 435 classcat2 = eccube .classCategories[classcat_id1]['#' + classcat_id2];441 classcat2 = eccube['classCategories'][classcat_id1]['#' + classcat_id2]; 436 442 } 437 443 … … 439 445 var $product_code_default = $form.find('[id^=product_code_default]'); 440 446 var $product_code_dynamic = $form.find('[id^=product_code_dynamic]'); 441 if (classcat2 442 && typeof classcat2['product_code'] != 'undefined') { 447 if (classcat2 && typeof classcat2['product_code'] !== 'undefined') { 443 448 $product_code_default.hide(); 444 449 $product_code_dynamic.show(); … … 464 469 var $price01_default = $form.find('[id^=price01_default]'); 465 470 var $price01_dynamic = $form.find('[id^=price01_dynamic]'); 466 if (classcat2 467 && typeof classcat2['price01'] != 'undefined' 468 && String(classcat2['price01']).length >= 1) { 471 if (classcat2 && typeof classcat2['price01'] !== 'undefined' && String(classcat2['price01']).length >= 1) { 469 472 470 473 $price01_dynamic.text(classcat2['price01']).show(); … … 478 481 var $price02_default = $form.find('[id^=price02_default]'); 479 482 var $price02_dynamic = $form.find('[id^=price02_dynamic]'); 480 if (classcat2 481 && typeof classcat2['price02'] != 'undefined' 482 && String(classcat2['price02']).length >= 1) { 483 if (classcat2 && typeof classcat2['price02'] !== 'undefined' && String(classcat2['price02']).length >= 1) { 483 484 484 485 $price02_dynamic.text(classcat2['price02']).show(); … … 492 493 var $point_default = $form.find('[id^=point_default]'); 493 494 var $point_dynamic = $form.find('[id^=point_dynamic]'); 494 if (classcat2 495 && typeof classcat2['point'] != 'undefined' 496 && String(classcat2['point']).length >= 1) { 495 if (classcat2 && typeof classcat2['point'] !== 'undefined' && String(classcat2['point']).length >= 1) { 497 496 498 497 $point_dynamic.text(classcat2['point']).show(); … … 505 504 // 商品規格 506 505 var $product_class_id_dynamic = $form.find('[id^=product_class_id]'); 507 if (classcat2 508 && typeof classcat2['product_class_id'] != 'undefined' 509 && String(classcat2['product_class_id']).length >= 1) { 510 506 if (classcat2 && typeof classcat2['product_class_id'] !== 'undefined' && String(classcat2['product_class_id']).length >= 1) { 511 507 $product_class_id_dynamic.val(classcat2['product_class_id']); 512 508 } else {
Note: See TracChangeset
for help on using the changeset viewer.