PageSourceSearch

https://www.cps-jp.org/include/cps/cps.js

js cps-jp.org collected 2026-09-24 21:51:55 UTC 9,564 bytes, 318 lines download raw bytes

1/**
2 * IEチェック。
3 * @return true - IE / false - IE以外
4 */
5function checkIE() {
6  return (0 <= window.navigator.userAgent.indexOf("MSIE"));
7}
8
9/**
10 * <select:multiple>のリストに項目を追加する。
11 * @param selectObj
12 *              項目追加先 <select> オブジェクト
13 * @param motoSelectObj
14 *              項目追加元 <select> オブジェクト
15 */
16function setSelectionItem(selectObj, motoSelectObj) {
17    _setSelectionItem(selectObj, motoSelectObj, false);
18}
19
20/**
21 * <select:multiple>のリストに全項目を追加する。
22 * @param selectObj
23 *              項目追加先 <select> オブジェクト
24 * @param motoSelectObj
25 *              項目追加元 <select> オブジェクト
26 */
27function copyAllSelectionItem(selectObj, motoSelectObj) {
28    _setSelectionItem(selectObj, motoSelectObj, true);
29}
30
31/**
32 * <select:multiple>のリストに項目を追加する。
33 * @param selectObj
34 *              項目追加先 <select> オブジェクト
35 * @param motoSelectObj
36 *              項目追加元 <select> オブジェクト
37 * @param isAll
38 *              true : 全項目コピー / false : 指定項目コピー
39 */
40function _setSelectionItem(selectObj, motoSelectObj, isAll) {
41    if (selectObj != null && motoSelectObj != null) {
42        if (selectObj.length != null && motoSelectObj.length != null) {
43            for (i = 0; i < motoSelectObj.length; i++) {
44                if (motoSelectObj.options[i].selected || isAll) {
45                    var key = motoSelectObj.options[i].value;
46                    var val = motoSelectObj.options[i].text;
47                    var len = selectObj.options.length;
48
49                    var add = true;
50                    for (j = 0; j < selectObj.length; j++) {
51                        //  既に追加されていたら、追加しない!!
52                        if (selectObj.options[j].value == key) {
53                            add = false;
54                        }
55                    }
56
57                    if (add) {
58                        selectObj.options[len] = new Option(val, key);
59                    }
60                }
61            }
62        }
63    }
64}
65
66/**
67 * <select:multiple>のリストの全項目を削除する。
68 * @param selectObj
69 *              <select> オブジェクト
70 */
71function clearAllSelectionItem(selectObj) {
72    __clearSelectionItem(selectObj, true);
73}
74
75/**
76 * <select:multiple>のリストの指定項目を削除する。
77 * @param selectObj
78 *              <select> オブジェクト
79 */
80function clearSelectionItem(selectObj) {
81    __clearSelectionItem(selectObj, false);
82}
83
84/**
85 * <select:multiple>のリストの指定項目を削除する。
86 * @param selectObj
87 *              <select> オブジェクト
88 * @param index
89 *              配列番号
90 */
91function _clearSelectionItem(selectObj, index) {
92    if (selectObj != null) {
93        if (selectObj.length != null && selectObj.length != 0) {
94            selectObj.options[index] = null;
95        }
96    }
97}
98
99/**
100 * <select:multiple>のリストの指定項目を削除する。
101 * @param selectObj
102 *              <select> オブジェクト
103 * @param isAll
104 *              true : 全項目削除 / false : 指定項目削除
105 */
106function __clearSelectionItem(selectObj, isAll) {
107    if (selectObj != null) {
108        if (selectObj.length != null) {
109            //  配列の後方にあるデータから順に削除(前方からだと途中で配列番号変わってしまう為)
110            for (i = selectObj.length - 1; i >= 0; i--) {
111                if (selectObj.options[i].selected || isAll) {
112                    _clearSelectionItem(selectObj, i);
113                }
114            }
115        }
116    }
117}
118
119/**
120 * <select:multiple>のリスト数を計算する。
121 * @param selectObj
122 *              <select> オブジェクト
123 */
124function getSelectionItemNumber(selectObj) {
125    if (selectObj != null) {
126        if (selectObj.length != null) {
127            return selectObj.length;
128        }
129    }
130}
131
132/**
133 * <select:multiple>のリストを送信時に選択状態にする。
134 * @param selectObj
135 *              <select> オブジェクト
136 */
137function sendSelectionState(selectObj) {
138    selectionStateOn(selectObj);
139}
140
141/**
142 * <select:multiple>のリストを選択状態にする。
143 * @param selectObj
144 *              <select> オブジェクト
145 */
146function selectionStateOn(selectObj) {
147    if (selectObj != null) {
148        if (selectObj.length != null) {
149            for (i = 0; i < selectObj.length; i++) {
150                if (selectObj.options) {
151                    selectObj.options[i].selected = true;
152                }
153            }
154        }
155    }
156}
157
158/**
159 * <select:multiple>のリストを選択状態にする。
160 * @param selectObj
161 *              <select> オブジェクト
162 * @param appointAry
163 *              配列変数(new Array[])
164 */
165function selectionStateOnAppoint(selectObj, appointAry) {
166    if (selectObj != null) {
167        if (selectObj.length != null) {
168            if (appointAry != null) {
169                if (appointAry.length != null) {
170                    for (i = 0; i < selectObj.length; i++) {
171                        for (j = 0; j < appointAry.length; j++) {
172                            if (selectObj.options[i].value == appointAry[j]) {
173                                selectObj.options[i].selected = true;
174                                break;
175                            }
176                        }
177                    }
178                }
179            }
180        }
181    }
182}
183
184/**
185 * <select:multiple>のリストを選択解除状態にする。
186 * @param selectObj
187 *              <select> オブジェクト
188 */
189function selectionStateOff(selectObj) {
190    if (selectObj != null) {
191        if (selectObj.length != null) {
192            for (i = 0; i < selectObj.length; i++) {
193                if (selectObj.options) {
194                    selectObj.options[i].selected = false;
195                }
196            }
197        }
198    }
199}
200
201/**
202 * <select:multiple>のリストの項目を、一方の<select:multiple>のリストに該当する項目分削除する。
203 * @param targetSelectObj
204 *              選択項目 <select> オブジェクト
205 * @param removeSelectObj
206 *              削除項目 <select> オブジェクト
207 * @param targetAll
208 *              全対象フラグ = true:強制全対象/false:選択対象
209 */
210function removeSelectionItem(selectObj, removeSelectObj, targetAll) {
211    if (targetAll) {
212        selectionStateOn(selectObj);
213    }
214
215    if (selectObj != null && removeSelectObj != null) {
216        if (selectObj.length != null && removeSelectObj.length != null) {
217            for (i = 0; i < selectObj.length; i++) {
218                if (selectObj.options[i].selected) {
219                    var key = selectObj.options[i].value;
220
221                    for (j = 0; j < removeSelectObj.length; j++) {
222                        //  該当したらリストから削除!!
223                        if (removeSelectObj.options[j].value == key) {
224                            _clearSelectionItem(removeSelectObj, j)
225                            break;
226                        }
227                    }
228                }
229            }
230        }
231    }
232
233    if (targetAll) {
234        selectionStateOff(selectObj);
235    }
236}
237
238/**
239 * ポップアップウィンドウを表示する。
240 * @param url : URL
241 * @param isNew : true - 新規ウィンドウ作成 / false - 既存ウィンドウ利用
242 */
243var popWin = null;
244var popWinAry = new Array(0);
245function viewPopup(url, isNew)
246{
247    var win = null;
248    var winId = "popWin" + (new Date).getTime();
249
250    if (isNew) {
251        popWinAry[popWinAry.length] = window.open("",winId,"top=0,left=0,width=800 height=800 resizable=yes, scrollbars=yes");
252        win = popWinAry[popWinAry.length-1];
253    } else {
254        if (popWin != null) {
255            popWin.close();
256        }
257        popWin = window.open("",winId,"top=0,left=0,width=600 height=800 resizable=yes, scrollbars=yes");
258        win = popWin;
259    }
260
261    win.document.location.href = url;
262    win.focus();
263}
264
265/**
266 * <select>の背景色を変更する。
267 * @param obj : オブジェクト[select]
268 * @param color : 変更色
269 */
270function changeSelectBgColor(obj, color)
271{
272/*
273	if (obj) {
274    	obj.style.height = '13px';
275        _changeBgColor(obj, color);
276    }
277*/
278}
279
280/**
281 * <input:text>の背景色を変更する。
282 * @param obj : オブジェクト[input:text]
283 * @param color : 変更色
284 */
285function changeTextBgColor(obj, color)
286{
287    if (obj) {
288        obj.style.margin = '1 1 1 1';
289        obj.style.height = '15px';
290        _changeBgColor(obj, color);
291    }
292}
293
294/**
295 * <input:text>の背景色を変更する。
296 * @param obj : オブジェクト[select or input:text]
297 * @param color : 変更色
298 */
299function _changeBgColor(obj, color)
300{
301    if (obj) {
302        var form = obj.form;
303
304        if (color == '') {
305           color = '#FFCCFF';
306        }
307
308        obj.style.borderStyle = 'solid';
309        obj.style.borderWidth = '1 1 1 1';
310        obj.style.borderColor = '#7F9DB9';
311
312        if (!(obj.value == '' || obj.value == '0')) {
313            obj.style.backgroundColor = color;
314        } else {
315            obj.style.backgroundColor = '#FFFFFF';
316        }
317    }
318}

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.