1/* 2* This file is part of EC-CUBE 3* 4* Copyright(c) 2000-2014 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 23(function( window, undefined ){ 24 25 26 // åå空éã®éè¤ãé²ã 27 if (window.eccube === undefined) { 28 window.eccube = {}; 29 } 30 31 var eccube = window.eccube; 32 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:'' 44 } 45 }; 46 47 eccube.openWindow = function(URL,name,width,height,option) { 48 var features = "width="+width+",height="+height; 49 if (option === undefined) { 50 option = eccube.defaults.windowFeatures; 51 } else { 52 option = $.extend(eccube.defaults.windowFeatures, option); 53 } 54 features = features + ",scrollbars=" + option.scrollbars + 55 ",resizable=" + option.resizable + 56 ",toolbar=" + option.toolbar + 57 ",location=" + option.location + 58 ",directories=" + option.directories + 59 ",status=" + option.status; 60 if (option.hasOwnProperty('menubar')) { 61 features = features + ",menubar=" + option.menubar; 62 } 63 var WIN = window.open(URL,name,features); 64 if (option.formTarget !== "") { 65 document.forms[option.formTarget].target = name; 66 } 67 if (option.focus) { 68 WIN.focus(); 69 } 70 }; 71 72 // 親ã¦ã£ã³ãã¦ã®åå¨ç¢ºèª. 73 eccube.isOpener = function() { 74 var ua = navigator.userAgent; 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 } 82 } else { 83 return typeof window.opener.document === 'object'; 84 } 85 } else { 86 return false; 87 } 88 }; 89 90 // éµä¾¿çªå·å ¥åå¼ã³åºã. 91 eccube.getAddress = function(php_url, tagname1, tagname2, input1, input2) { 92 var zip1 = document.form1[tagname1].value; 93 var zip2 = document.form1[tagname2].value; 94 95 if(zip1.length === 3 && zip2.length === 4) { 96 $.get( 97 php_url, 98 {zip1: zip1, zip2: zip2, input1: input1, input2: input2}, 99 function(data) { 100 var arrData = data.split("|"); 101 if (arrData.length > 1) { 102 eccube.putAddress(input1, input2, arrData[0], arrData[1], arrData[2]); 103 } else { 104 window.alert(data); 105 } 106 } 107 ); 108 } else { 109 window.alert("éµä¾¿çªå·ãæ£ããå ¥åãã¦ä¸ããã"); 110 } 111 }; 112 113 // éµä¾¿çªå·ããæ¤ç´¢ããä½æãæ¸¡ã. 114 eccube.putAddress = function(input1, input2, state, city, town) { 115 if(state !== "") { 116 // é ç®ã«å¤ãå ¥åãã. 117 document.form1[input1].selectedIndex = state; 118 document.form1[input2].value = city + town; 119 } 120 }; 121 122 eccube.setFocus = function(name) { 123 if(document.form1.hasOwnProperty(name)) { 124 document.form1[name].focus(); 125 } 126 }; 127 128 // ã¢ã¼ãã¨ãã¼ãæå®ãã¦SUBMITãè¡ãã 129 eccube.setModeAndSubmit = function(mode, keyname, keyid) { 130 switch(mode) { 131 case 'delete_category': 132 if(!window.confirm('鏿ããã«ãã´ãªã¨ã«ãã´ãªå ã®å ¨ã¦ã®ã«ãã´ãªãåé¤ãã¾ã')){ 133 return; 134 } 135 break; 136 case 'delete': 137 if(!window.confirm('ä¸åº¦åé¤ãããã¼ã¿ã¯ãå ã«æ»ãã¾ããã\nåé¤ãã¦ãå®ããã§ããï¼')){ 138 return; 139 } 140 break; 141 case 'confirm': 142 if(!window.confirm('ç»é²ãã¦ãå®ããã§ãã')){ 143 return; 144 } 145 break; 146 case 'delete_all': 147 if(!window.confirm('æ¤ç´¢çµæãå ¨ã¦åé¤ãã¦ãå®ããã§ãã')){ 148 return; 149 } 150 break; 151 default: 152 break; 153 } 154 document.form1.mode.value = mode; 155 if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 156 document.form1[keyname].value = keyid; 157 } 158 document.form1.submit(); 159 }; 160 161 eccube.fnFormModeSubmit = function(form, mode, keyname, keyid) { 162 switch(mode) { 163 case 'delete': 164 if(!window.confirm('ä¸åº¦åé¤ãããã¼ã¿ã¯ãå ã«æ»ãã¾ããã\nåé¤ãã¦ãå®ããã§ããï¼')){ 165 return; 166 } 167 break; 168 case 'cartDelete': 169 if(!window.confirm('ã«ã´ããååãåé¤ãã¦ãå®ããã§ããããï¼')){ 170 return; 171 } 172 mode = 'delete'; 173 break; 174 case 'confirm': 175 if(!window.confirm('ç»é²ãã¦ãå®ããã§ãã')){ 176 return; 177 } 178 break; 179 case 'regist': 180 if(!window.confirm('ç»é²ãã¦ãå®ããã§ãã')){ 181 return; 182 } 183 break; 184 default: 185 break; 186 } 187 var values = {mode:mode}; 188 if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 189 values[keyname] = keyid; 190 } 191 eccube.submitForm(values, form); 192 }; 193 194 eccube.setValueAndSubmit = function(form, key, val, msg) { 195 var ret; 196 if (msg !== undefined) { 197 ret = window.confirm(msg); 198 } else { 199 ret = true; 200 } 201 if (ret) { 202 var values = {}; 203 values[key] = val; 204 eccube.submitForm(values, form); 205 } 206 return false;
207 }; 208 209 eccube.setValue = function(key, val, form) { 210 var formElement = eccube.getFormElement(form); 211 formElement.find("*[name=" + key + "]").val(val); 212 }; 213 214 eccube.changeAction = function(url, form) { 215 var formElement = eccube.getFormElement(form); 216 formElement.attr("action", url); 217 }; 218 219 // ãã¼ã¸ããã§ä½¿ç¨ããã 220 eccube.movePage = function(pageno, mode, form) { 221 var values = {pageno: pageno}; 222 if (mode !== undefined) { 223 values.mode = mode; 224 } 225 eccube.submitForm(values, form); 226 }; 227 228 /** 229 * ãã©ã¼ã ãéä¿¡ãã. 230 * 231 * @param values 232 * @param form 233 */ 234 eccube.submitForm = function(values, form){ 235 var formElement = eccube.getFormElement(form); 236 if (values !== undefined && typeof values === "object") { 237 $.each(values, function(index, value) { 238 eccube.setValue(index, value, formElement); 239 }); 240 } 241 formElement.submit(); 242 }; 243 244 /** 245 * ãã©ã¼ã ãç¹å®ãã¦ã¨ã¬ã¡ã³ããè¿ã. 246 * 247 * @param form 248 * @returns {*} 249 */ 250 eccube.getFormElement = function(form){ 251 var formElement; 252 if (form !== undefined && typeof form === "string" && form !== "") { 253 formElement = $("form#" + form); 254 } else if (form !== undefined && typeof form === "object") { 255 formElement = form; 256 } else { 257 formElement = $("form#" + eccube.defaults.formId); 258 } 259 return formElement; 260 }; 261 262 // ãã¤ã³ãå ¥åå¶éã 263 eccube.togglePointForm = function() { 264 if(document.form1.point_check) { 265 var list = ['use_point']; 266 var color; 267 var flag; 268 269 if(!document.form1.point_check[0].checked) { 270 color = "#dddddd"; 271 flag = true; 272 } else { 273 color = ""; 274 flag = false; 275 } 276 277 var len = list.length; 278 for(var i = 0; i < len; i++) { 279 if(document.form1[list[i]]) { 280 var current_color = document.form1[list[i]].style.backgroundColor; 281 if (color !== "#dddddd" && (current_color === "#ffe8e8" || current_color === "rgb(255, 232, 232)")) 282 { 283 continue; 284 } 285 document.form1[list[i]].disabled = flag; 286 document.form1[list[i]].style.backgroundColor = color; 287 } 288 } 289 } 290 }; 291 292 // å¥ã®ãå±ãå å ¥åå¶éã 293 eccube.toggleDeliveryForm = function() { 294 if(!document.form1) { 295 return; 296 } 297 if(document.form1.deliv_check) { 298 var list = [ 299 'shipping_name01', 300 'shipping_name02', 301 'shipping_kana01', 302 'shipping_kana02', 303 'shipping_pref', 304 'shipping_zip01', 305 'shipping_zip02', 306 'shipping_addr01', 307 'shipping_addr02', 308 'shipping_tel01', 309 'shipping_tel02', 310 'shipping_tel03', 311 'shipping_company_name', 312 'shipping_country_id', 313 'shipping_zipcode', 314 'shipping_fax01', 315 'shipping_fax02', 316 'shipping_fax03' 317 ]; 318 319 if(!document.form1.deliv_check.checked) { 320 eccube.changeDisabled(list, '#dddddd'); 321 } else { 322 eccube.changeDisabled(list, ''); 323 } 324 } 325 }; 326 327 // æåã«è¨å®ããã¦ããè²ãä¿åãã¦ããã 328 eccube.savedColor = []; 329 330 eccube.changeDisabled = function(list, color) { 331 var len = list.length; 332 333 for(var i = 0; i < len; i++) { 334 if(document.form1[list[i]]) { 335 if(color === "") { 336 // æå¹ã«ããã 337 document.form1[list[i]].removeAttribute('disabled'); 338 document.form1[list[i]].style.backgroundColor = eccube.savedColor[list[i]]; 339 } else { 340 // ç¡å¹ã«ããã 341 document.form1[list[i]].setAttribute('disabled', 'disabled'); 342 eccube.savedColor[list[i]] = document.form1[list[i]].style.backgroundColor; 343 document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0"; 344 } 345 } 346 } 347 }; 348 349 // ãã°ã¤ã³æã®å ¥åãã§ã㯠350 eccube.checkLoginFormInputted = function(form, emailKey, passKey) { 351 var formElement = $("form#" + form); 352 var checkItems = []; 353 354 if (typeof emailKey === 'undefined') { 355 checkItems[0] = 'login_email'; 356 } else { 357 checkItems[0] = emailKey; 358 } 359 if (typeof passKey === 'undefined') { 360 checkItems[1] = 'login_pass'; 361 } else { 362 checkItems[1] = passKey; 363 } 364 365 var max = checkItems.length; 366 var errorFlag = false;
367 368 //ãå¿ é é ç®ã®ãã§ã㯠369 for(var cnt = 0; cnt < max; cnt++) { 370 if(formElement.find("input[name=" + checkItems[cnt] + "]").val() === "") { 371 errorFlag = true; 372 break; 373 } 374 } 375 376 // å¿ é é ç®ãå ¥åããã¦ããªãå ´å 377 if(errorFlag === true) { 378 window.alert('ã¡ã¼ã«ã¢ãã¬ã¹/ãã¹ã¯ã¼ããå ¥åãã¦ä¸ããã'); 379 return false; 380 } else { 381 return true; 382 } 383 }; 384 385 //親ã¦ã£ã³ãã¦ã®ãã¼ã¸ã夿´ãã. 386 eccube.changeParentUrl = function(url) { 387 // 親ã¦ã£ã³ãã¦ã®åå¨ç¢ºèª 388 if(eccube.isOpener()) { 389 window.opener.location.href = url; 390 } else { 391 window.close(); 392 } 393 }; 394 395 //æåæ°ãã«ã¦ã³ãããã 396 //弿°1ï¼ãã©ã¼ã åç§° 397 //弿°2ï¼æåæ°ã«ã¦ã³ã対象 398 //弿°3ï¼ã«ã¦ã³ãçµææ ¼ç´å¯¾è±¡ 399 eccube.countChars = function(form,sch,cnt) { 400 var formElement = $("form#" + form); 401 formElement.find("input[name="+cnt+"]").val(formElement.find("*[name="+sch+"]").val().length); 402 }; 403 404 // ããã¹ãã¨ãªã¢ã®ãµã¤ãºã夿´ãã. 405 eccube.toggleRows = function(buttonSelector, textAreaSelector, max, min) { 406 if ($(textAreaSelector).attr('rows') <= min) { 407 $(textAreaSelector).attr('rows', max); 408 $(buttonSelector).text('縮å°'); 409 } else { 410 $(textAreaSelector).attr('rows', min); 411 $(buttonSelector).text('æ¡å¤§'); 412 } 413 }; 414 415 /** 416 * è¦æ ¼2ã®ãã«ãã¦ã³ãè¨å®ãã. 417 */ 418 eccube.setClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) { 419 if ($sele1 && $sele1.length) { 420 var classcat_id1 = $sele1.val() ? $sele1.val() : ''; 421 if ($sele2 && $sele2.length) { 422 // è¦æ ¼2ã®é¸æè¢ãã¯ãªã¢ 423 $sele2.children().remove(); 424 425 var classcat2; 426 427 // ååä¸è¦§æ 428 if (eccube.hasOwnProperty('productsClassCategories')) { 429 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]; 430 } 431 // 詳細表示æ 432 else { 433 classcat2 = eccube.classCategories[classcat_id1]; 434 } 435 436 // è¦æ ¼2ã®è¦ç´ ãè¨å® 437 for (var key in classcat2) { 438 if (classcat2.hasOwnProperty(key)) { 439 var id = classcat2[key].classcategory_id2; 440 var name = classcat2[key].name; 441 var option = $('<option />').val(id ? id : '').text(name); 442 if (id === selected_id2) { 443 option.attr('selected', true); 444 } 445 $sele2.append(option); 446 } 447 } 448 eccube.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', 449 $sele2.val() ? $sele2.val() : ''); 450 } 451 } 452 }; 453 454 /** 455 * è¦æ ¼ã®é¸æç¶æ ã«å¿ãã¦, ãã£ã¼ã«ããè¨å®ãã. 456 */ 457 eccube.checkStock = function($form, product_id, classcat_id1, classcat_id2) { 458 459 classcat_id2 = classcat_id2 ? classcat_id2 : ''; 460 461 var classcat2; 462 463 // ååä¸è¦§æ 464 if (eccube.hasOwnProperty('productsClassCategories')) { 465 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 466 } 467 // 詳細表示æ 468 else { 469 classcat2 = eccube.classCategories[classcat_id1]['#' + classcat_id2]; 470 } 471 472 // ååã³ã¼ã 473 var $product_code = $('#item_code_default'); 474 if (typeof this.product_code_origin === 'undefined') { 475 // åæå¤ãä¿æãã¦ãã 476 this.product_code_origin = $product_code.text(); 477 } 478 if (classcat2 && typeof classcat2.product_code !== 'undefined') { 479 $product_code.text(classcat2.product_code); 480 } else { 481 $product_code.text(this.product_code_origin); 482 } 483 484 // å¨åº«(ååã) 485 var $cartbtn = $('#add-cart'); 486 if (classcat2 && classcat2.stock_find === false) { 487 $cartbtn.prop('disabled', true); 488 $cartbtn.text('ãã ãã¾ååãä¸ã§ã'); 489 } else { 490 $cartbtn.prop('disabled', false); 491 $cartbtn.text('ã«ã¼ãã«å ¥ãã'); 492 } 493 494 // éå¸¸ä¾¡æ ¼ 495 var $price01 = $('#detail_description_box__class_normal_range_price') 496 .find('.price01_default') 497 .first(); 498 if (typeof this.proce01_origin === 'undefined') { 499 // åæå¤ãä¿æãã¦ãã 500 this.proce01_origin = $price01.text(); 501 } 502 if (classcat2 && typeof classcat2.price01 !== 'undefined' && String(classcat2.price01).length >= 1) { 503 $price01.text('Â¥ ' + classcat2.price01); 504 } else { 505 $price01.text(this.proce01_origin); 506 } 507 508 // è²©å£²ä¾¡æ ¼ 509 var $price02 = $('#detail_description_box__class_range_sale_price') 510 .find('.price02_default') 511 .first(); 512 if (typeof this.proce02_origin === 'undefined') { 513 // åæå¤ãä¿æãã¦ãã 514 this.proce02_origin = $price02.text(); 515 } 516 if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) { 517 $price02.text('Â¥ ' + classcat2.price02); 518 } else { 519 $price02.text(this.proce02_origin); 520 } 521 522 // ãã¤ã³ã 523 var $point_default = $form.find('[id^=point_default]'); 524 var $point_dynamic = $form.find('[id^=point_dynamic]'); 525 if (classcat2 && typeof classcat2.point !== 'undefined' && String(classcat2.point).length >= 1) { 526 527 $point_dynamic.text(classcat2.point).show(); 528 $point_default.hide(); 529 } else { 530 $point_dynamic.hide(); 531 $point_default.show(); 532 } 533 534 // ååè¦æ ¼ 535 var $product_class_id_dynamic = $form.find('[id^=product_class_id]'); 536 if (classcat2 && typeof classcat2.product_class_id !== 'undefined' && String(classcat2.product_class_id).length >= 1) { 537 $product_class_id_dynamic.val(classcat2.product_class_id); 538 } else { 539 $product_class_id_dynamic.val(''); 540 } 541 }; 542 543 // ã°ãã¼ãã«ã«ä½¿ç¨ã§ããããã«ãã 544 window.eccube = eccube; 545 546 /** 547 * Initialize. 548 */ 549 $(function() { 550 // è¦æ ¼1鏿æ 551 $('select[name=classcategory_id1]') 552 .change(function() { 553 var $form = $(this).parents('form'); 554 var product_id = $form.find('input[name=product_id]').val(); 555 var $sele1 = $(this); 556 var $sele2 = $form.find('select[name=classcategory_id2]'); 557 558 // è¦æ ¼1ã®ã¿ã®å ´å 559 if (!$sele2.length) { 560 eccube.checkStock($form, product_id, $sele1.val(), null); 561 // è¦æ ¼2ããã®å ´å 562 } else { 563 eccube.setClassCategories($form, product_id, $sele1, $sele2); 564 } 565 }); 566 567 // è¦æ ¼2鏿æ 568 $('select[name=classcategory_id2]') 569 .change(function() { 570 var $form = $(this).parents('form'); 571 var product_id = $form.find('input[name=product_id]').val(); 572 var $sele1 = $form.find('select[name=classcategory_id1]'); 573 var $sele2 = $(this); 574 eccube.checkStock($form, product_id, $sele1.val(), $sele2.val()); 575 }); 576 577 // ãã¦ã¹ãªã¼ãã¼ã§ç»ååãæ¿ã 578 $(".hover_change_image").each(function(){ 579 var target = $(this); 580 var srcOrig = target.attr("src"); 581 var srcOver = srcOrig.substr(0, srcOrig.lastIndexOf('.')) + '_on' + srcOrig.substr(srcOrig.lastIndexOf('.')); 582 target.hover( 583 function(){ 584 target.attr("src", srcOver); 585 }, 586 function(){ 587 target.attr("src", srcOrig); 588 } 589 ); 590 }); 591 592 }); 593})(window);
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.