Changeset 23240
- Timestamp:
- 2013/10/09 13:40:56 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/html/js/eccube.legacy.js
r23112 r23240 34 34 35 35 function win01(URL,Winname,Wwidth,Wheight){ 36 var WIN; 37 WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no"); 38 WIN.focus(); 36 var option = {scrollbars: "no", resizable: "no"}; 37 eccube.openWindow(URL,Winname,Wwidth,Wheight,option); 39 38 } 40 39 41 40 function win02(URL,Winname,Wwidth,Wheight){ 42 var WIN; 43 WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no"); 44 WIN.focus(); 41 eccube.openWindow(URL,Winname,Wwidth,Wheight); 45 42 } 46 43 47 44 function win03(URL,Winname,Wwidth,Wheight){ 48 var WIN; 49 WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no"); 50 WIN.focus(); 45 var option = {menubar: "no"}; 46 eccube.openWindow(URL,Winname,Wwidth,Wheight,option); 51 47 } 52 48 53 49 function winSubmit(URL,formName,Winname,Wwidth,Wheight){ 54 var WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no"); 55 document.forms[formName].target = Winname; 56 WIN.focus(); 50 var option = {menubar: "no", formTarget: formName}; 51 eccube.openWindow(URL,Winname,Wwidth,Wheight,option); 57 52 } 58 53 59 54 // 親ウィンドウの存在確認. 60 55 function fnIsopener() { 61 var ua = navigator.userAgent; 62 if( !!window.opener ) { 63 if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) { 64 return !window.opener.closed; 65 } else { 66 return typeof window.opener.document == 'object'; 67 } 68 } else { 69 return false; 70 } 56 return eccube.isOpener(); 71 57 } 72 58 73 59 // 郵便番号入力呼び出し. 74 60 function fnCallAddress(php_url, tagname1, tagname2, input1, input2) { 75 zip1 = document.form1[tagname1].value; 76 zip2 = document.form1[tagname2].value; 77 78 if(zip1.length == 3 && zip2.length == 4) { 79 $.get( 80 php_url, 81 {zip1: zip1, zip2: zip2, input1: input1, input2: input2}, 82 function(data) { 83 arrdata = data.split("|"); 84 if (arrdata.length > 1) { 85 fnPutAddress(input1, input2, arrdata[0], arrdata[1], arrdata[2]); 86 } else { 87 alert(data); 88 } 89 } 90 ); 91 } else { 92 alert("郵便番号を正しく入力して下さい。"); 93 } 61 eccube.getAddress(php_url, tagname1, tagname2, input1, input2); 94 62 } 95 63 96 64 // 郵便番号から検索した住所を渡す. 97 65 function fnPutAddress(input1, input2, state, city, town) { 98 if(state != "") { 99 // 項目に値を入力する. 100 document.form1[input1].selectedIndex = state; 101 document.form1[input2].value = city + town; 102 } 66 eccube.putAddress(input1, input2, state, city, town); 103 67 } 104 68 … … 108 72 109 73 function fnOpenWindow(URL,name,width,height) { 110 window.open(URL,name,"width="+width+",height="+height+",scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no"); 74 var option = {resizable: "no", focus: false}; 75 eccube.openWindow(URL,name,width,height,option); 111 76 } 112 77 113 78 function fnSetFocus(name) { 114 if(document.form1[name]) { 115 document.form1[name].focus(); 116 } 79 eccube.setFocus(name); 117 80 } 118 81 … … 156 119 // モードとキーを指定してSUBMITを行う。 157 120 function fnModeSubmit(mode, keyname, keyid) { 158 switch(mode) { 159 case 'delete_category': 160 if(!window.confirm('選択したカテゴリとカテゴリ内の全てのカテゴリを削除します')){ 161 return; 162 } 163 break; 164 case 'delete': 165 if(!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')){ 166 return; 167 } 168 break; 169 case 'confirm': 170 if(!window.confirm('登録しても宜しいですか')){ 171 return; 172 } 173 break; 174 case 'delete_all': 175 if(!window.confirm('検索結果を全て削除しても宜しいですか')){ 176 return; 177 } 178 break; 179 default: 180 break; 181 } 182 document.form1['mode'].value = mode; 183 if(keyname != "" && keyid != "") { 184 document.form1[keyname].value = keyid; 185 } 186 document.form1.submit(); 121 eccube.setModeAndSubmit(mode, keyname, keyid); 187 122 } 188 123 189 124 function fnFormModeSubmit(form, mode, keyname, keyid) { 190 switch(mode) { 191 case 'delete': 192 if(!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')){ 193 return; 194 } 195 break; 196 case 'confirm': 197 if(!window.confirm('登録しても宜しいですか')){ 198 return; 199 } 200 break; 201 case 'regist': 202 if(!window.confirm('登録しても宜しいですか')){ 203 return; 204 } 205 break; 206 default: 207 break; 208 } 209 document.forms[form]['mode'].value = mode; 210 if(keyname != "" && keyid != "") { 211 document.forms[form][keyname].value = keyid; 212 } 213 document.forms[form].submit(); 125 eccube.fnFormModeSubmit(form, mode, keyname, keyid); 214 126 } 215 127 216 128 function fnSetFormSubmit(form, key, val) { 217 document.forms[form][key].value = val; 218 document.forms[form].submit(); 219 return false; 129 return eccube.setValueAndSubmit(form, key, val); 220 130 } 221 131 222 132 function fnSetVal(key, val) { 223 fnSetFormVal('form1',key, val);133 eccube.setValue(key, val); 224 134 } 225 135 226 136 function fnSetFormVal(form, key, val) { 227 document.forms[form][key].value = val;137 eccube.setValue(key, val, form); 228 138 } 229 139 230 140 function fnChangeAction(url) { 231 document.form1.action = url;141 eccube.changeAction(url); 232 142 } 233 143 234 144 // ページナビで使用する。 235 145 function fnNaviPage(pageno) { 236 document.form1['pageno'].value = pageno; 237 document.form1.submit(); 146 eccube.movePage(pageno); 238 147 } 239 148 240 149 function fnSearchPageNavi(pageno) { 241 document.form1['pageno'].value = pageno; 242 document.form1['mode'].value = 'search'; 243 document.form1.submit(); 150 eccube.movePage(pageno, 'search'); 244 151 } 245 152 246 153 function fnSubmit(){ 247 document.form1.submit();154 eccube.submitForm(); 248 155 } 249 156 250 157 // ポイント入力制限。 251 158 function fnCheckInputPoint() { 252 if(document.form1['point_check']) { 253 list = new Array( 254 'use_point' 255 ); 256 257 if(!document.form1['point_check'][0].checked) { 258 color = "#dddddd"; 259 flag = true; 260 } else { 261 color = ""; 262 flag = false; 263 } 264 265 len = list.length 266 for(i = 0; i < len; i++) { 267 if(document.form1[list[i]]) { 268 var current_color = document.form1[list[i]].style.backgroundColor; 269 if (color != "#dddddd" && (current_color == "#ffe8e8" || current_color == "rgb(255, 232, 232)")) 270 { 271 continue; 272 } 273 document.form1[list[i]].disabled = flag; 274 document.form1[list[i]].style.backgroundColor = color; 275 } 276 } 277 } 159 eccube.togglePointForm(); 278 160 } 279 161 280 162 // 別のお届け先入力制限。 281 163 function fnCheckInputDeliv() { 282 if(!document.form1) { 283 return; 284 } 285 if(document.form1['deliv_check']) { 286 list = new Array( 287 'shipping_name01', 288 'shipping_name02', 289 'shipping_kana01', 290 'shipping_kana02', 291 'shipping_pref', 292 'shipping_zip01', 293 'shipping_zip02', 294 'shipping_addr01', 295 'shipping_addr02', 296 'shipping_tel01', 297 'shipping_tel02', 298 'shipping_tel03' 299 ); 300 301 if(!document.form1['deliv_check'].checked) { 302 fnChangeDisabled(list, '#dddddd'); 303 } else { 304 fnChangeDisabled(list, ''); 305 } 306 } 164 eccube.toggleDeliveryForm(); 307 165 } 308 166 … … 311 169 312 170 function fnChangeDisabled(list, color) { 313 len = list.length; 314 315 for(i = 0; i < len; i++) { 316 if(document.form1[list[i]]) { 317 if(color == "") { 318 // 有効にする。 319 document.form1[list[i]].disabled = false; 320 document.form1[list[i]].style.backgroundColor = g_savecolor[list[i]]; 321 } else { 322 // 無効にする。 323 document.form1[list[i]].disabled = true; 324 g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor; 325 document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0"; 326 } 327 } 328 } 171 eccube.changeDisabled(list, color); 329 172 } 330 173 331 174 // ログイン時の入力チェック 332 175 function fnCheckLogin(formname) { 333 var lstitem = new Array(); 334 335 lstitem[0] = 'login_email'; 336 lstitem[1] = 'login_pass'; 337 338 var max = lstitem.length; 339 var errflg = false; 340 var cnt = 0; 341 342 // 必須項目のチェック 343 for(cnt = 0; cnt < max; cnt++) { 344 if(document.forms[formname][lstitem[cnt]].value == "") { 345 errflg = true; 346 break; 347 } 348 } 349 350 // 必須項目が入力されていない場合 351 if(errflg == true) { 352 alert('メールアドレス/パスワードを入力して下さい。'); 353 return false; 354 } else { 355 return true; 356 } 176 return eccube.checkLoginFormInputted(formname); 357 177 } 358 178 … … 367 187 //親ウィンドウのページを変更する. 368 188 function fnUpdateParent(url) { 369 // 親ウィンドウの存在確認 370 if(fnIsopener()) { 371 window.opener.location.href = url; 372 } else { 373 window.close(); 374 } 189 eccube.changeParentUrl(url); 375 190 } 376 191 377 192 //特定のキーをSUBMITする. 378 193 function fnKeySubmit(keyname, keyid) { 379 if(keyname != "" && keyid != "") { 380 document.form1[keyname].value = keyid; 381 } 382 document.form1.submit(); 194 var values = {}; 195 values[keyname] = keyid; 196 eccube.submitForm(values); 383 197 } 384 198 … … 388 202 //引数3:カウント結果格納対象 389 203 function fnCharCount(form,sch,cnt) { 390 document.forms[form][cnt].value= document.forms[form][sch].value.length;204 eccube.countChars(form,sch,cnt); 391 205 } 392 206 393 207 // テキストエリアのサイズを変更する. 394 208 function ChangeSize(buttonSelector, textAreaSelector, max, min) { 395 if ($(textAreaSelector).attr('rows') <= min) { 396 $(textAreaSelector).attr('rows', max); 397 $(buttonSelector).text('縮小'); 398 } else { 399 $(textAreaSelector).attr('rows', min); 400 $(buttonSelector).text('拡大'); 401 } 209 eccube.toggleRows(buttonSelector, textAreaSelector, max, min); 402 210 } 403 211 … … 406 214 */ 407 215 function setClassCategories($form, product_id, $sele1, $sele2, selected_id2) { 408 if ($sele1 && $sele1.length) { 409 var classcat_id1 = $sele1.val() ? $sele1.val() : ''; 410 if ($sele2 && $sele2.length) { 411 // 規格2の選択肢をクリア 412 $sele2.children().remove(); 413 414 var classcat2; 415 416 // 商品一覧時 417 if (typeof productsClassCategories != 'undefined') { 418 classcat2 = productsClassCategories[product_id][classcat_id1]; 419 } 420 // 詳細表示時 421 else { 422 classcat2 = classCategories[classcat_id1]; 423 } 424 425 // 規格2の要素を設定 426 for (var key in classcat2) { 427 var id = classcat2[key]['classcategory_id2']; 428 var name = classcat2[key]['name']; 429 var option = $('<option />').val(id ? id : '').text(name); 430 if (id == selected_id2) { 431 option.attr('selected', true); 432 } 433 $sele2.append(option); 434 } 435 checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', 436 $sele2.val() ? $sele2.val() : ''); 437 } 438 } 216 eccube.setClassCategories($form, product_id, $sele1, $sele2, selected_id2); 439 217 } 440 218 … … 443 221 */ 444 222 function checkStock($form, product_id, classcat_id1, classcat_id2) { 445 446 classcat_id2 = classcat_id2 ? classcat_id2 : ''; 447 448 var classcat2; 449 450 // 商品一覧時 451 if (typeof productsClassCategories != 'undefined') { 452 classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 453 } 454 // 詳細表示時 455 else { 456 classcat2 = classCategories[classcat_id1]['#' + classcat_id2]; 457 } 458 459 // 商品コード 460 var $product_code_default = $form.find('[id^=product_code_default]'); 461 var $product_code_dynamic = $form.find('[id^=product_code_dynamic]'); 462 if (classcat2 463 && typeof classcat2['product_code'] != 'undefined') { 464 $product_code_default.hide(); 465 $product_code_dynamic.show(); 466 $product_code_dynamic.text(classcat2['product_code']); 467 } else { 468 $product_code_default.show(); 469 $product_code_dynamic.hide(); 470 } 471 472 // 在庫(品切れ) 473 var $cartbtn_default = $form.find('[id^=cartbtn_default]'); 474 var $cartbtn_dynamic = $form.find('[id^=cartbtn_dynamic]'); 475 if (classcat2 && classcat2['stock_find'] === false) { 476 477 $cartbtn_dynamic.text('申し訳ございませんが、只今品切れ中です。').show(); 478 $cartbtn_default.hide(); 479 } else { 480 $cartbtn_dynamic.hide(); 481 $cartbtn_default.show(); 482 } 483 484 // 通常価格 485 var $price01_default = $form.find('[id^=price01_default]'); 486 var $price01_dynamic = $form.find('[id^=price01_dynamic]'); 487 if (classcat2 488 && typeof classcat2['price01'] != 'undefined' 489 && String(classcat2['price01']).length >= 1) { 490 491 $price01_dynamic.text(classcat2['price01']).show(); 492 $price01_default.hide(); 493 } else { 494 $price01_dynamic.hide(); 495 $price01_default.show(); 496 } 497 498 // 販売価格 499 var $price02_default = $form.find('[id^=price02_default]'); 500 var $price02_dynamic = $form.find('[id^=price02_dynamic]'); 501 if (classcat2 502 && typeof classcat2['price02'] != 'undefined' 503 && String(classcat2['price02']).length >= 1) { 504 505 $price02_dynamic.text(classcat2['price02']).show(); 506 $price02_default.hide(); 507 } else { 508 $price02_dynamic.hide(); 509 $price02_default.show(); 510 } 511 512 // ポイント 513 var $point_default = $form.find('[id^=point_default]'); 514 var $point_dynamic = $form.find('[id^=point_dynamic]'); 515 if (classcat2 516 && typeof classcat2['point'] != 'undefined' 517 && String(classcat2['point']).length >= 1) { 518 519 $point_dynamic.text(classcat2['point']).show(); 520 $point_default.hide(); 521 } else { 522 $point_dynamic.hide(); 523 $point_default.show(); 524 } 525 526 // 商品規格 527 var $product_class_id_dynamic = $form.find('[id^=product_class_id]'); 528 if (classcat2 529 && typeof classcat2['product_class_id'] != 'undefined' 530 && String(classcat2['product_class_id']).length >= 1) { 531 532 $product_class_id_dynamic.val(classcat2['product_class_id']); 533 } else { 534 $product_class_id_dynamic.val(''); 535 } 223 eccube.checkStock($form, product_id, classcat_id1, classcat_id2); 536 224 } 537 225
Note: See TracChangeset
for help on using the changeset viewer.