PageSourceSearch

https://www.shop.keihan-dept.co.jp/ec/shop/common/js/event.js?releaseVer=26091719

js keihan-dept.co.jp collected 2026-09-26 00:31:19 UTC 4,815 bytes, 191 lines download raw bytes

1/*
2 * Copyright 2004-2006 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16if (typeof(Kumu) == 'undefined') {
17  Kumu = {};
18}
19
20if (typeof(Kumu.Event) == 'undefined') {
21  Kumu.Event = {};
22
23KumuEventConf = false;
24
25
26Kumu.extend(Kumu.Event, {
27
28  KEY_BACKSPACE: 8,
29  KEY_TAB:       9,
30  KEY_RETURN:   13,
31  KEY_ESC:      27,
32  KEY_LEFT:     37,
33  KEY_UP:       38,
34  KEY_RIGHT:    39,
35  KEY_DOWN:     40,
36  KEY_DELETE:   46,
37
38  process : {},
39
40  _nodeCache : {},
41
42  _elementsById : function(id){
43    if(!(id instanceof String) && typeof id != "string"){
44      return [id];
45    }
46
47    var nodes = [];
48    var elem = $i(id);
49    if(!this._nodeCache[id]){
50      this._nodeCache[id] = [];
51    }
52    while(elem){
53      if(!elem["cached"]){
54        nodes.push(elem);
55      }
56      elem.id = "";
57      elem = $i(id);
58    }
59    this._nodeCache[id] = this._nodeCache[id].concat(nodes);
60    this._nodeCache[id].map(function(n){
61      n.id = id;
62      n.cached = true;
63    } );
64    return this._nodeCache[id];
65  },
66
67  stopEvent : function(event) {
68    if (event.preventDefault) {
69      event.preventDefault();
70      event.stopPropagation();
71    } else {
72      event.returnValue = false;
73      event.cancelBubble = true;
74    }
75  },
76
77  addEvent : function(element, name, observer, useCapture) {
78    var nodes = this._elementsById(element);
79    useCapture = useCapture || false;
80    if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
81     || element.attachevent)){
82      name = 'keydown';
83    }
84    var processList = [];
85    nodes.map(function(node){
86      var nodeFunc = observer.state();
87      var p = {
88        node : node,
89        eventName : name,
90        command : nodeFunc,
91        add : function(){
92          if (node.addEventListener) {
93            node.addEventListener(name, nodeFunc, useCapture);
94          } else if (node.attachEvent) {
95            node.attachEvent('on' + name, nodeFunc);
96          }
97        },
98        remove : function(){
99          if (node.removeEventListener) {
100  	        node.removeEventListener(name, nodeFunc, useCapture);
101    	  } else if (node.detachEvent) {
102            node.detachEvent('on' + name, nodeFunc);
103          }
104        },
105        cancel : function(c){
106          nodeFunc.cancel(c);
107		},
108		clear : function(){
109		  this.remove();
110		  Kumu.Event.process[node][name] = null;
111		}
112      };
113      if(this.process[node]){
114        if(this.process[node][name]){
115      	  this.process[node][name].push(p);
116        }else{
117      	  this.process[node][name] = [];
118      	  this.process[node][name].push(p);
119        }
120      }else{
121        this.process[node] = {};
122        this.process[node][name] = [];
123        this.process[node][name].push(p);
124      }
125      p.add();
126      processList.push(p);
127    }.bindScope(this));
128    return processList;
129  },
130
131  regist : function(o){
132    for(var v in o){
133      o[v].__name = v;
134      o[v].registEvent();
135    }
136  },
137
138  loadEvent : function(){
139    if(KumuEventConf){
140      this.regist(KumuEventConf);
141    }
142  },
143
144  addOnLoadEvent : function(func){
145    this.addEvent(window, 'load', func, false);
146  }
147
148});
149
150Function.prototype.registEventToElement = function(element, scope){
151  if(!scope){
152     scope = {};
153  }
154  var ret;
155  if(this.__name){
156    ret = this.__name;
157  }else{
158    ret = this.getName();
159  }
160  var arr = Kumu.separate(ret);
161  var callback = this.bindScopeAsEventListener(scope, element);
162   Kumu.Event.addEvent(element, arr[0], callback, false);
163}
164
165Function.prototype.registEvent = function(scope){
166  if(!scope){
167     scope = {};
168  }
169  var ret;
170  if(this.__name){
171    ret = this.__name;
172  }else{
173    ret = this.getName();
174  }
175  var arr = Kumu.separate(ret);
176  var callback = this.bindScopeAsEventListener(scope, arr[1]);
177  Kumu.Event.addEvent(arr[1],  arr[0], callback, false);
178}
179
180Function.prototype.registOnLoad = function(scope){
181  this.__name = 'window_load';
182  this.registEvent(scope);
183}
184
185Function.prototype.registOnUnLoad = function(scope){
186  this.__name = 'window_unload';
187  this.registEvent(scope);
188}
189
190Kumu.Event.addOnLoadEvent(Kumu.Event.loadEvent.bindScope(Kumu.Event));
191}

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.