source: branches/version-2_13-dev/html/js/eccube.legacy.js @ 23240

Revision 23240, 9.9 KB checked in by pineray, 10 years ago (diff)

#2365 eccube.legacy.js をリファクタリング

Line 
1/*
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
23function chgImg(fileName,img){
24    if (typeof(img) == "object") {
25        img.src = fileName;
26    } else {
27        document.images[img].src = fileName;
28    }
29}
30
31function chgImgImageSubmit(fileName,imgObj){
32    imgObj.src = fileName;
33}
34
35function win01(URL,Winname,Wwidth,Wheight){
36    var option = {scrollbars: "no", resizable: "no"};
37    eccube.openWindow(URL,Winname,Wwidth,Wheight,option);
38}
39
40function win02(URL,Winname,Wwidth,Wheight){
41    eccube.openWindow(URL,Winname,Wwidth,Wheight);
42}
43
44function win03(URL,Winname,Wwidth,Wheight){
45    var option = {menubar: "no"};
46    eccube.openWindow(URL,Winname,Wwidth,Wheight,option);
47}
48
49function winSubmit(URL,formName,Winname,Wwidth,Wheight){
50    var option = {menubar: "no", formTarget: formName};
51    eccube.openWindow(URL,Winname,Wwidth,Wheight,option);
52}
53
54// 親ウィンドウの存在確認.
55function fnIsopener() {
56    return eccube.isOpener();
57}
58
59// 郵便番号入力呼び出し.
60function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
61    eccube.getAddress(php_url, tagname1, tagname2, input1, input2);
62}
63
64// 郵便番号から検索した住所を渡す.
65function fnPutAddress(input1, input2, state, city, town) {
66    eccube.putAddress(input1, input2, state, city, town);
67}
68
69function fnOpenNoMenu(URL) {
70    window.open(URL,"nomenu","scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
71}
72
73function fnOpenWindow(URL,name,width,height) {
74    var option = {resizable: "no", focus: false};
75    eccube.openWindow(URL,name,width,height,option);
76}
77
78function fnSetFocus(name) {
79    eccube.setFocus(name);
80}
81
82// セレクトボックスに項目を割り当てる.
83function fnSetSelect(name1, name2, val) {
84    sele1 = document.form1[name1];
85    sele2 = document.form1[name2];
86
87    if(sele1 && sele2) {
88        index=sele1.selectedIndex;
89
90        // セレクトボックスのクリア
91        count=sele2.options.length
92        for(i = count; i >= 0; i--) {
93            sele2.options[i]=null;
94        }
95
96        // セレクトボックスに値を割り当てる。
97        len = lists[index].length
98        for(i = 0; i < len; i++) {
99            sele2.options[i]=new Option(lists[index][i], vals[index][i]);
100            if(val != "" && vals[index][i] == val) {
101                sele2.options[i].selected = true;
102            }
103        }
104    }
105}
106
107// Enterキー入力をキャンセルする。(IEに対応)
108function fnCancelEnter()
109{
110    if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
111        if (window.event.keyCode == 13)
112        {
113            return false;
114        }
115    }
116    return true;
117}
118
119// モードとキーを指定してSUBMITを行う。
120function fnModeSubmit(mode, keyname, keyid) {
121    eccube.setModeAndSubmit(mode, keyname, keyid);
122}
123
124function fnFormModeSubmit(form, mode, keyname, keyid) {
125    eccube.fnFormModeSubmit(form, mode, keyname, keyid);
126}
127
128function fnSetFormSubmit(form, key, val) {
129    return eccube.setValueAndSubmit(form, key, val);
130}
131
132function fnSetVal(key, val) {
133    eccube.setValue(key, val);
134}
135
136function fnSetFormVal(form, key, val) {
137    eccube.setValue(key, val, form);
138}
139
140function fnChangeAction(url) {
141    eccube.changeAction(url);
142}
143
144// ページナビで使用する。
145function fnNaviPage(pageno) {
146    eccube.movePage(pageno);
147}
148
149function fnSearchPageNavi(pageno) {
150    eccube.movePage(pageno, 'search');
151}
152
153function fnSubmit(){
154    eccube.submitForm();
155}
156
157// ポイント入力制限。
158function fnCheckInputPoint() {
159    eccube.togglePointForm();
160}
161
162// 別のお届け先入力制限。
163function fnCheckInputDeliv() {
164    eccube.toggleDeliveryForm();
165}
166
167// 最初に設定されていた色を保存しておく。
168var g_savecolor = new Array();
169
170function fnChangeDisabled(list, color) {
171    eccube.changeDisabled(list, color);
172}
173
174// ログイン時の入力チェック
175function fnCheckLogin(formname) {
176    return eccube.checkLoginFormInputted(formname);
177}
178
179// 時間の計測.
180function fnPassTime(){
181    end_time = new Date();
182    time = end_time.getTime() - start_time.getTime();
183    alert((time/1000));
184}
185start_time = new Date();
186
187//親ウィンドウのページを変更する.
188function fnUpdateParent(url) {
189    eccube.changeParentUrl(url);
190}
191
192//特定のキーをSUBMITする.
193function fnKeySubmit(keyname, keyid) {
194    var values = {};
195    values[keyname] = keyid;
196    eccube.submitForm(values);
197}
198
199//文字数をカウントする。
200//引数1:フォーム名称
201//引数2:文字数カウント対象
202//引数3:カウント結果格納対象
203function fnCharCount(form,sch,cnt) {
204    eccube.countChars(form,sch,cnt);
205}
206
207// テキストエリアのサイズを変更する.
208function ChangeSize(buttonSelector, textAreaSelector, max, min) {
209    eccube.toggleRows(buttonSelector, textAreaSelector, max, min);
210}
211
212/**
213 * 規格2のプルダウンを設定する.
214 */
215function setClassCategories($form, product_id, $sele1, $sele2, selected_id2) {
216    eccube.setClassCategories($form, product_id, $sele1, $sele2, selected_id2);
217}
218
219/**
220 * 規格の選択状態に応じて, フィールドを設定する.
221 */
222function checkStock($form, product_id, classcat_id1, classcat_id2) {
223    eccube.checkStock($form, product_id, classcat_id1, classcat_id2);
224}
225
226gCssUA = navigator.userAgent.toUpperCase();
227gCssBrw = navigator.appName.toUpperCase();
228
229with (document) {
230    write("<style type=\"text/css\"><!--");
231
232    //WIN-IE
233    if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
234        write(".fs10 {font-size: 62.5%; line-height: 150%; letter-spacing:1px;}");
235        write(".fs12 {font-size: 75%; line-height: 150%; letter-spacing:1.5px;}");
236        write(".fs14 {font-size: 87.5%; line-height: 150%; letter-spacing:2px;}");
237        write(".fs18 {font-size: 117.5%; line-height: 130%; letter-spacing:2.5px;}");
238        write(".fs22 {font-size: 137.5%; line-height: 130%; letter-spacing:3px;}");
239        write(".fs24 {font-size: 150%; line-height: 130%; letter-spacing:3px;}");
240        write(".fs30 {font-size: 187.5%; line-height: 125%; letter-spacing:3.5px;}");
241        write(".fs10n {font-size: 62.5%; letter-spacing:1px;}");
242        write(".fs12n {font-size: 75%; letter-spacing:1.5px;}");
243        write(".fs14n {font-size: 87.5%; letter-spacing:2px;}");
244        write(".fs18n {font-size: 117.5%; letter-spacing:2.5px;}");
245        write(".fs22n {font-size: 137.5%; letter-spacing:1px;}");
246        write(".fs24n {font-size: 150%; letter-spacing:1px;}");
247        write(".fs30n {font-size: 187.5%; letter-spacing:1px;}");
248        write(".fs12st {font-size: 75%; line-height: 150%; letter-spacing:1.5px; font-weight: bold;}");
249    }
250
251    //WIN-NN
252    if (gCssUA.indexOf("WIN") != -1 && gCssBrw.indexOf("NETSCAPE") != -1) {
253        write(".fs10 {font-size:72%; line-height:130%;}");
254        write(".fs12 {font-size: 75%; line-height: 150%;}");
255        write(".fs14 {font-size: 87.5%; line-height: 140%;}");
256        write(".fs18 {font-size: 117.5%; line-height: 130%;}");
257        write(".fs22 {font-size: 137.5%; line-height: 130%;}");
258        write(".fs24 {font-size: 150%; line-height: 130%;}");
259        write(".fs30 {font-size: 187.5%; line-height: 120%;}");
260        write(".fs10n {font-size:72%;}");
261        write(".fs12n {font-size: 75%;}");
262        write(".fs14n {font-size: 87.5%;}");
263        write(".fs18n {font-size: 117.5%;}");
264        write(".fs22n {font-size: 137.5%;}");
265        write(".fs24n {font-size: 150%;}");
266        write(".fs30n {font-size: 187.5%;}");
267        write(".fs12st {font-size: 75%; line-height: 150%; font-weight: bold;}");
268    }
269
270    //WIN-NN4.x
271    if ( navigator.appName == "Netscape" && navigator.appVersion.substr(0,2) == "4." ) {
272        write(".fs10 {font-size:90%; line-height: 130%;}");
273        write(".fs12 {font-size: 100%; line-height: 140%;}");
274        write(".fs14 {font-size: 110%; line-height: 135%;}");
275        write(".fs18 {font-size: 130%; line-height: 175%;}");
276        write(".fs24 {font-size: 190%; line-height: 240%;}");
277        write(".fs30 {font-size: 240%; line-height: 285%;}");
278        write(".fs10n {font-size:90%;}");
279        write(".fs12n {font-size: 100%;}");
280        write(".fs14n {font-size: 110%;}");
281        write(".fs18n {font-size: 130%;}");
282        write(".fs24n {font-size: 190%;}");
283        write(".fs30n {font-size: 240%;}");
284        write(".fs12st {font-size: 100%; line-height: 140%; font-weight: bold;}");
285    }
286
287    //MAC
288    if (gCssUA.indexOf("MAC") != -1) {
289        write(".fs10 {font-size: 10px; line-height: 14px;}");
290        write(".fs12 {font-size: 12px; line-height: 18px;}");
291        write(".fs14 {font-size: 14px; line-height: 18px;}");
292        write(".fs18 {font-size: 18px; line-height: 23px;}");
293        write(".fs22 {font-size: 22px; line-height: 27px;}");
294        write(".fs24 {font-size: 24px; line-height: 30px;}");
295        write(".fs30 {font-size: 30px; line-height: 35px;}");
296        write(".fs10n {font-size: 10px;}");
297        write(".fs12n {font-size: 12px;}");
298        write(".fs14n {font-size: 14px;}");
299        write(".fs18n {font-size: 18px;}");
300        write(".fs22n {font-size: 22px;}");
301        write(".fs24n {font-size: 24px;}");
302        write(".fs30n {font-size: 30px;}");
303        write(".fs12st {font-size: 12px; line-height: 18px; font-weight: bold;}");
304    }
305
306    write("--></style>");
307}
Note: See TracBrowser for help on using the repository browser.