PageSourceSearch

https://kokode.jp/user_data/kokode/packages/default/js/site.js

js kokode.jp collected 2026-10-03 20:33:28 UTC 10,204 bytes, 389 lines download raw bytes

1/*
2 * This file is part of EC-CUBE
3 *
4 * Copyright(c) 2000-2010 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// 親ウィンドウの存在確認.
24function fnIsopener() {
25  var ua = navigator.userAgent;
26  if (!!window.opener) {
27    if (ua.indexOf('MSIE 4') != -1 && ua.indexOf('Win') != -1) {
28      return !window.opener.closed;
29    } else {
30      return typeof window.opener.document == 'object';
31    }
32  } else {
33    return false;
34  }
35}
36
37// 郵便番号入力呼び出し.
38function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
39  zip1 = document.form1[tagname1].value;
40  zip2 = document.form1[tagname2].value;
41
42  if (zip1.length == 3 && zip2.length == 4) {
43    jQuery.get(
44      php_url,
45      {zip1: zip1, zip2: zip2, input1: input1, input2: input2},
46      function (data) {
47        arrdata = data.split("|");
48        if (arrdata.length > 1) {
49          fnPutAddress(input1, input2, arrdata[0], arrdata[1], arrdata[2]);
50        } else {
51          alert(data);
52        }
53      }
54    );
55  } else {
56    alert("郵便番号を正しく入力して下さい。");
57  }
58}
59
60// 郵便番号から検索した住所を渡す.
61function fnPutAddress(input1, input2, state, city, town) {
62  if (state != "") {
63    // 項目に値を入力する.
64    document.form1[input1].selectedIndex = state;
65    document.form1[input2].value = city + town;
66  }
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  window.open(URL, name, "width=" + width + ",height=" + height + ",scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no");
75}
76
77function fnSetFocus(name) {
78  if (document.form1[name]) {
79    document.form1[name].focus();
80  }
81}
82
83// セレクトボックスに項目を割り当てる.
84function fnSetSelect(name1, name2, val) {
85  sele1 = document.form1[name1];
86  sele2 = document.form1[name2];
87
88  if (sele1 && sele2) {
89    index = sele1.selectedIndex;
90
91    // セレクトボックスのクリア
92    count = sele2.options.length
93    for (i = count; i >= 0; i--) {
94      sele2.options[i] = null;
95    }
96
97    // セレクトボックスに値を割り当てる。
98    len = lists[index].length
99    for (i = 0; i < len; i++) {
100      sele2.options[i] = new Option(lists[index][i], vals[index][i]);
101      if (val != "" && vals[index][i] == val) {
102        sele2.options[i].selected = true;
103      }
104    }
105  }
106}
107
108// Enterキー入力をキャンセルする。(IEに対応)
109function fnCancelEnter() {
110  if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
111    if (window.event.keyCode == 13) {
112      return false;
113    }
114  }
115  return true;
116}
117
118// モードとキーを指定してSUBMITを行う。
119function fnModeSubmit(mode, keyname, keyid) {
120  switch (mode) {
121    case 'delete_category':
122      if (!window.confirm('選択したカテゴリとカテゴリ内のすべてのカテゴリを削除します')) {
123        return;
124      }
125      break;
126    case 'delete':
127      if (!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')) {
128        return;
129      }
130      break;
131    case 'delete_order':
132      if (!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?\n\n※ 在庫数は手動で戻してください。')) {
133        return;
134      }
135      mode = 'delete';
136      break;
137    case 'confirm':
138      if (!window.confirm('登録しても宜しいですか')) {
139        return;
140      }
141      break;
142    case 'delete_all':
143      if (!window.confirm('検索結果をすべて削除しても宜しいですか')) {
144        return;
145      }
146      break;
147    default:
148      break;
149  }
150  document.form1['mode'].value = mode;
151  if (keyname != "" && keyid != "") {
152    document.form1[keyname].value = keyid;
153  }
154  document.form1.submit();
155}
156
157function fnFormModeSubmit(form, mode, keyname, keyid) {
158  switch (mode) {
159    case 'delete':
160      if (!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')) {
161        return;
162      }
163      break;
164    case 'confirm':
165      if (!window.confirm('登録しても宜しいですか')) {
166        return;
167      }
168      break;
169    case 'regist':
170      if (!window.confirm('登録しても宜しいですか')) {
171        return;
172      }
173      break;
174    default:
175      break;
176  }
177  document.forms[form]['mode'].value = mode;
178  if (keyname != "" && keyid != "") {
179    document.forms[form][keyname].value = keyid;
180  }
181  document.forms[form].submit();
182}
183
184function fnSetFormSubmit(form, key, val) {
185  document.forms[form][key].value = val;
186  document.forms[form].submit();
187  return false;
188}
189
190function fnSetVal(key, val) {
191  fnSetFormVal('form1', key, val);
192}
193
194function fnSetFormVal(form, key, val) {
195  document.forms[form][key].value = val;
196}
197
198function fnChangeAction(url) {
199  document.form1.action = url;
200}
201
202// ページナビで使用する。
203function fnNaviPage(pageno) {
204  document.form1['pageno'].value = pageno;
205  document.form1.submit();
206}
207
208function fnSearchPageNavi(pageno) {
209  document.form1['pageno'].value = pageno;
210  document.form1['mode'].value = 'search';
211  document.form1.submit();
212}
213
214function fnSubmit() {
215  document.form1.submit();
216}
217
218// ポイント入力制限。
219function fnCheckInputPoint() {
220  if (document.form1['point_check']) {
221    list = new Array(
222      'use_point'
223    );
224
225    if (!document.form1['point_check'][0].checked) {
226      color = "#dddddd";
227      flag = true;
228    } else {
229      color = "";
230      flag = false;
231    }
232
233    len = list.length
234    for (i = 0; i < len; i++) {
235      if (document.form1[list[i]]) {
236        document.form1[list[i]].disabled = flag;
237        document.form1[list[i]].style.backgroundColor = color;
238      }
239    }
240  }
241}
242
243// 別のお届け先入力制限。
244function fnCheckInputDeliv() {
245  if (!document.form1) {
246    return;
247  }
248  if (document.form1['deliv_check']) {
249    list = new Array(
250      'shipping_name01',
251      'shipping_name02',
252      'shipping_kana01',
253      'shipping_kana02',
254      'shipping_pref',
255      'shipping_zip01',
256      'shipping_zip02',
257      'shipping_addr01',
258      'shipping_addr02',
259      'shipping_tel01',
260      'shipping_tel02',
261      'shipping_tel03'
262    );
263
264    if (!document.form1['deliv_check'].checked) {
265      fnChangeDisabled(list, '#dddddd');
266    } else {
267      fnChangeDisabled(list, '');
268    }
269  }
270}
271
272// 最初に設定されていた色を保存しておく。
273var g_savecolor = new Array();
274
275function fnChangeDisabled(list, color) {
276  len = list.length;
277
278  for (i = 0; i < len; i++) {
279    if (document.form1[list[i]]) {
280      if (color == "") {
281        // 有効にする。
282        document.form1[list[i]].disabled = false;
283        document.form1[list[i]].style.backgroundColor = g_savecolor[list[i]];
284      } else {
285        // 無効にする。
286        document.form1[list[i]].disabled = true;
287        g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor;
288        document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0";
289      }
290    }
291  }
292}
293
294
295// ログイン時の入力チェック
296function fnCheckLogin(formname) {
297  var lstitem = new Array();
298
299  if (formname == 'login_mypage') {
300    lstitem[0] = 'mypage_login_email';
301    lstitem[1] = 'mypage_login_pass';
302  } else {
303    lstitem[0] = 'login_email';
304    lstitem[1] = 'login_pass';
305  }
306  var max = lstitem.length;
307  var errflg = false;
308  var cnt = 0;
309
310  // 必須項目のチェック
311  for (cnt = 0; cnt < max; cnt++) {
312    if (document.forms[formname][lstitem[cnt]].value == "") {
313      errflg = true;
314      break;
315    }
316  }
317
318  // 必須項目が入力されていない場合
319  if (errflg == true) {
320    alert('メールアドレス/パスワードを入力して下さい。');
321    return false;
322  }
323}
324
325// 時間の計測.
326function fnPassTime() {
327  end_time = new Date();
328  time = end_time.getTime() - start_time.getTime();
329  alert((time / 1000));
330}
331
332start_time = new Date();
333
334//親ウィンドウのページを変更する.
335function fnUpdateParent(url) {
336  // 親ウィンドウの存在確認
337  if (fnIsopener()) {
338    window.opener.location.href = url;
339    window.opener.location.reload();
340  } else {
341    window.close();
342  }
343}
344
345//特定のキーをSUBMITする.
346function fnKeySubmit(keyname, keyid) {
347  if (keyname != "" && keyid != "") {
348    document.form1[keyname].value = keyid;
349  }
350  document.form1.submit();
351}
352
353//文字数をカウントする。
354//引数1:フォーム名称
355//引数2:文字数カウント対象
356//引数3:カウント結果格納対象
357function fnCharCount(form, sch, cnt) {
358  document.forms[form][cnt].value = document.forms[form][sch].value.length;
359}
360
361
362// テキストエリアのサイズを変更する.
363function ChangeSize(buttonSelector, textAreaSelector, max, min) {
364
365  if ($(textAreaSelector).attr('rows') <= min) {
366    $(textAreaSelector).attr('rows', max);
367    $(buttonSelector).text('縮小');
368  } else {
369    $(textAreaSelector).attr('rows', min);
370    $(buttonSelector).text('拡大');
371  }
372}
373
374function fnAddFigure(str) {
375  str = str + "";
376  var num = new String(str).replace(/,/g, "");
377  while (num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2"))) ;
378  return num;
379}
380
381function fnIsPositiveInteger(str) {
382  str = str + "";
383  str = str.replace(/,/g, "");
384  if (isNaN(str) || str == "" || parseInt(str) < 0) {
385   
vendor: 37 bytes, lines 385-389
385 return false;
386  }
387  return true;
388}
389

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.