Changeset 23379


Ignore:
Timestamp:
2014/04/30 12:13:26 (10 years ago)
Author:
kimoto
Message:

#2448 jshintのエラーを修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/html/js/eccube.js

    r23264 r23379  
    11/* 
    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  */ 
     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*/ 
    2222 
    2323(function( window, undefined ){ 
     
    5353        } 
    5454        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; 
     55            ",resizable=" + option.resizable + 
     56            ",toolbar=" + option.toolbar + 
     57            ",location=" + option.location + 
     58            ",directories=" + option.directories + 
     59            ",status=" + option.status; 
    6060        if (option.hasOwnProperty('menubar')) { 
    61             features = features + ",menubar=" + option['menubar']; 
     61            features = features + ",menubar=" + option.menubar; 
    6262        } 
    6363        var WIN = window.open(URL,name,features); 
     
    7676            if( ua.indexOf('MSIE 4') !== -1 && ua.indexOf('Win') !== -1 ) { 
    7777                if (window.opener.hasOwnProperty('closed')) { 
    78                     return !window.opener['closed']; 
     78                    return !window.opener.closed; 
    7979                } else { 
    8080                    return false; 
     
    9090    // 郵便番号入力呼び出し. 
    9191    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; 
    9494 
    9595        if(zip1.length === 3 && zip2.length === 4) { 
     
    115115        if(state !== "") { 
    116116            // 項目に値を入力する. 
    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; 
    119119        } 
    120120    }; 
    121121 
    122122    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(); 
    125125        } 
    126126    }; 
     
    152152                break; 
    153153        } 
    154         document['form1']['mode'].value = mode; 
     154        document.form1.mode.value = mode; 
    155155        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(); 
    159159    }; 
    160160 
     
    221221 
    222222    /** 
    223      * フォームを送信する. 
    224      * 
    225      * @param values 
    226      * @param form 
    227      */ 
     223    * フォームを送信する. 
     224    * 
     225    * @param values 
     226    * @param form 
     227    */ 
    228228    eccube.submitForm = function(values, form){ 
    229229        var formElement = eccube.getFormElement(form); 
     
    237237 
    238238    /** 
    239      * フォームを特定してエレメントを返す. 
    240      * 
    241      * @param form 
    242      * @returns {*} 
    243      */ 
     239    * フォームを特定してエレメントを返す. 
     240    * 
     241    * @param form 
     242    * @returns {*} 
     243    */ 
    244244    eccube.getFormElement = function(form){ 
    245245        var formElement; 
     
    256256    // ポイント入力制限。 
    257257    eccube.togglePointForm = function() { 
    258         if(document['form1']['point_check']) { 
     258        if(document.form1.point_check) { 
    259259            var list = ['use_point']; 
    260260            var color; 
    261261            var flag; 
    262262 
    263             if(!document['form1']['point_check'][0].checked) { 
     263            if(!document.form1.point_check[0].checked) { 
    264264                color = "#dddddd"; 
    265265                flag = true; 
     
    271271            var len = list.length; 
    272272            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; 
    275275                    if (color !== "#dddddd" && (current_color === "#ffe8e8" || current_color === "rgb(255, 232, 232)")) 
    276276                    { 
    277277                        continue; 
    278278                    } 
    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; 
    281281                } 
    282282            } 
     
    286286    // 別のお届け先入力制限。 
    287287    eccube.toggleDeliveryForm = function() { 
    288         if(!document['form1']) { 
     288        if(!document.form1) { 
    289289            return; 
    290290        } 
    291         if(document['form1']['deliv_check']) { 
     291        if(document.form1.deliv_check) { 
    292292            var list = [ 
    293293                'shipping_name01', 
     
    311311            ]; 
    312312 
    313             if(!document['form1']['deliv_check'].checked) { 
     313            if(!document.form1.deliv_check.checked) { 
    314314                eccube.changeDisabled(list, '#dddddd'); 
    315315            } else { 
     
    326326 
    327327        for(var i = 0; i < len; i++) { 
    328             if(document['form1'][list[i]]) { 
     328            if(document.form1[list[i]]) { 
    329329                if(color === "") { 
    330330                    // 有効にする。 
    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]]; 
    333333                } else { 
    334334                    // 無効にする。 
    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"; 
    338338                } 
    339339            } 
     
    408408 
    409409    /** 
    410      * 規格2のプルダウンを設定する. 
    411      */ 
     410    * 規格2のプルダウンを設定する. 
     411    */ 
    412412    eccube.setClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) { 
    413413        if ($sele1 && $sele1.length) { 
     
    421421                // 商品一覧時 
    422422                if (eccube.hasOwnProperty('productsClassCategories')) { 
    423                     classcat2 = eccube['productsClassCategories'][product_id][classcat_id1]; 
     423                    classcat2 = eccube.productsClassCategories[product_id][classcat_id1]; 
    424424                } 
    425425                // 詳細表示時 
    426426                else { 
    427                     classcat2 = eccube['classCategories'][classcat_id1]; 
     427                    classcat2 = eccube.classCategories[classcat_id1]; 
    428428                } 
    429429 
     
    431431                for (var key in classcat2) { 
    432432                    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; 
    435435                        var option = $('<option />').val(id ? id : '').text(name); 
    436436                        if (id === selected_id2) { 
     
    441441                } 
    442442                eccube.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', 
    443                     $sele2.val() ? $sele2.val() : ''); 
     443                $sele2.val() ? $sele2.val() : ''); 
    444444            } 
    445445        } 
     
    447447 
    448448    /** 
    449      * 規格の選択状態に応じて, フィールドを設定する. 
    450      */ 
     449    * 規格の選択状態に応じて, フィールドを設定する. 
     450    */ 
    451451    eccube.checkStock = function($form, product_id, classcat_id1, classcat_id2) { 
    452452 
     
    457457        // 商品一覧時 
    458458        if (eccube.hasOwnProperty('productsClassCategories')) { 
    459             classcat2 = eccube['productsClassCategories'][product_id][classcat_id1]['#' + classcat_id2]; 
     459            classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 
    460460        } 
    461461        // 詳細表示時 
    462462        else { 
    463             classcat2 = eccube['classCategories'][classcat_id1]['#' + classcat_id2]; 
     463            classcat2 = eccube.classCategories[classcat_id1]['#' + classcat_id2]; 
    464464        } 
    465465 
     
    467467        var $product_code_default = $form.find('[id^=product_code_default]'); 
    468468        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') { 
    470470            $product_code_default.hide(); 
    471471            $product_code_dynamic.show(); 
    472             $product_code_dynamic.text(classcat2['product_code']); 
     472            $product_code_dynamic.text(classcat2.product_code); 
    473473        } else { 
    474474            $product_code_default.show(); 
     
    479479        var $cartbtn_default = $form.find('[id^=cartbtn_default]'); 
    480480        var $cartbtn_dynamic = $form.find('[id^=cartbtn_dynamic]'); 
    481         if (classcat2 && classcat2['stock_find'] === false) { 
     481        if (classcat2 && classcat2.stock_find === false) { 
    482482 
    483483            $cartbtn_dynamic.text('申し訳ございませんが、只今品切れ中です。').show(); 
     
    491491        var $price01_default = $form.find('[id^=price01_default]'); 
    492492        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(); 
    496496            $price01_default.hide(); 
    497497        } else { 
     
    503503        var $price02_default = $form.find('[id^=price02_default]'); 
    504504        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(); 
    508508            $price02_default.hide(); 
    509509        } else { 
     
    515515        var $point_default = $form.find('[id^=point_default]'); 
    516516        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(); 
    520520            $point_default.hide(); 
    521521        } else { 
     
    526526        // 商品規格 
    527527        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); 
    530530        } else { 
    531531            $product_class_id_dynamic.val(''); 
     
    537537 
    538538    /** 
    539      * Initialize. 
    540      */ 
     539    * Initialize. 
     540    */ 
    541541    $(function() { 
    542542        // 規格1選択時 
    543543        $('select[name=classcategory_id1]') 
    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             }); 
     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        }); 
    558558 
    559559        // 規格2選択時 
    560560        $('select[name=classcategory_id2]') 
    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             }); 
     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        }); 
    568568 
    569569        // マウスオーバーで画像切り替え 
     
    583583 
    584584        // モーダルウィンドウ 
    585         if ($('a.expansion').length) {  
    586             $('a.expansion').colorbox();  
     585        if ($('a.expansion').length) { 
     586            $('a.expansion').colorbox(); 
    587587        } 
    588588    }); 
Note: See TracChangeset for help on using the changeset viewer.