PageSourceSearch

https://www.editarea.com/iwetc/res/js/common.js?v=2

js editarea.com collected 2026-10-04 20:52:09 UTC 8,316 bytes, 274 lines download raw bytes

1function f0() {}
2function lookupArea(areas,pos) {
3  // es: areas=new Array("horizontal",new Object({from:0,to:103,name:"options"}),new Object({from:104,to:123,name:"openclose"}));
4  var type=areas[0];
5  var v=type=="horizontal" ? pos.x : pos.y;
6  var j=-1;
7  for (var i=1;i<areas.length;i++) {
8    if (v>=areas[i].from && v<areas[i].to) {
9      j=i;
10      break;
11    }
12  }
13  return j==-1 ? null : areas[j].name;
14}
15function getBrowserSize() {
16  var bodyWidth = document.documentElement.clientWidth;
17  var bodyHeight = document.documentElement.clientHeight;
18  if (self.innerHeight){ // all except Explorer 
19    bodyWidth = self.innerWidth; 
20    bodyHeight = self.innerHeight; 
21  } else if (document.documentElement && document.documentElement.clientHeight) {
22    // Explorer 6 Strict Mode 		 
23    bodyWidth = document.documentElement.clientWidth; 
24    bodyHeight = document.documentElement.clientHeight; 
25  } else if (document.body) {// other Explorers 		 
26    bodyWidth = document.body.clientWidth; 
27    bodyHeight = document.body.clientHeight; 
28  }
29  return [bodyWidth,bodyHeight];
30}
31function repositionMaximizedComp(comp) {
32  comp.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
33  comp.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
34  var brSize = getBrowserSize();
35  var bodyWidth = brSize[0];
36  var bodyHeight = brSize[1];
37  comp.style.width = bodyWidth + 'px';
38  comp.style.height = bodyHeight + 'px';
39}
40function repositionComp(comp,x,y) {
41  comp.style.top = Math.max(y+document.body.scrollTop,y+document.documentElement.scrollTop) + 'px';
42  comp.style.left = Math.max(x+document.body.scrollLeft,x+document.documentElement.scrollLeft) + 'px';
43}
44function ea_addEvent(whichObject,eventType,functionName,suffix) { 
45  if(!suffix)suffix = '';
46  if(whichObject.attachEvent){ 
47    whichObject['e'+eventType+functionName+suffix] = functionName; 
48    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
49    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
50  } else {
51    whichObject.addEventListener(eventType,functionName,false);
52  }
53}
54function getObj(n,d) {
55  var p,i,x;
56  if(!d) d=document;
57  if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
58  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
59  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=getObj(n,d.layers[i].document);
60  if(!x && d.getElementById) x=d.getElementById(n);
61  return x;
62}
63function getStyleObj(elem,parent) {
64  if (document.layers) {
65    if (parent) {
66      return "document."+parent+".document."+elem;
67    } else {
68      return "document."+elem + ".style";
69    }
70  } else if (document.all) {
71    return "document.all['"+elem+ "'].style";
72  } else if (document.getElementById) {
73    return "document.getElementById('"+elem+"').style";
74  } else {
75    return null;
76  }
77}
78function getObject(id) {
79  return eval(getObj(id));
80}
81function getStyleObject(id) {
82  if (getObject(id)!=null) {
83    return eval(getStyleObj(id));
84  } else {
85    return null;
86  }
87}
88function setObjectClass(id,className) {
89  var object=getObject(id);
90  if (object!=null) {
91    object.className=className;
92  }
93}
94function hideCompById(id) {
95  var style=getStyleObject(id);
96  if (style!=null) {
97    style.display="none";
98  }
99}
100function showCompById(id,withStyle) {
101  var style=getStyleObject(id);
102  if (withStyle==null) withStyle="block";
103  if (style!=null) {
104    style.display=withStyle;
105	}
106}
107function swapDisplay(id){
108  if (getStyleObject(id).display=='block' || getStyleObject(id).display==''){
109    hideCompById(id);
110  } else {
111    showCompById(id,'');
112  }
113}
114function msie() {
115  return navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
116}
117function msie6() {
118  return navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1;
119}
120function encodeFormFields(form) {
121  var s="";
122  var elements=form.elements;
123  for (var i=0;i<elements.length;i++) {
124    var e=elements[i];
125    if (i!=0) {
126      s+="&";
127    }
128    if (e.name != null && e.value != null) {
129      s+=e.name+"="+escape(e.value);
130    }
131  }
132  return s;
133}
134// http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp
135function getStylePropertyValue(el, propertyName) {
136  if (!document.getElementById) {
137    return null;
138  } else {
139    var value = el.style[toCamelCase(propertyName)];
140    if (!value) {
141      if (document.defaultView) {
142        value = document.defaultView.getComputedStyle(el, "").getPropertyValue(propertyName);
143      } else if (el.currentStyle) {
144        value = el.currentStyle[toCamelCase(propertyName)];
145      }
146    }
147    return value;
148  }
149}
150function hasBarFrame01() {
151  return parent && parent.barFrame ? 1 : 0;
152}
153// http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp
154function toCamelCase( sInput ) {
155  var oStringList = sInput.split('-');
156  if (oStringList.length == 1) {
157    return oStringList[0];
158  }
159  var ret = sInput.indexOf("-") == 0 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
160  for (var i = 1, len = oStringList.length; i < len; i++) {
161    var s = oStringList[i];
162    ret += s.charAt(0).toUpperCase() + s.substring(1)
163  }
164  return ret;
165}
166function eventGetTarget(e) {
167	var targ;
168	if (e.target) targ = e.target;
169	else if (e.srcElement) targ = e.srcElement;
170	if (targ.nodeType == 3) // defeat Safari bug
171		targ = targ.parentNode;
172  return targ;
173}
174// restituisce la posizione relativa al target dell'evento
175function eventRelativeXY(e,comp) {
176  var mouseXY=eventClientXY(e);
177  if (comp==null) {
178    comp=eventGetTarget(e);
179  }
180  var x=mouseXY.x - absoluteOffsetLeft(comp);
181  var y=mouseXY.y - comp.offsetTop;
182  var xperc=Math.round(x*100/comp.clientWidth);
183  var yperc=Math.round(y*100/comp.clientHeight);
184  return new Object({x:x,y:y,xperc:xperc,yperc:yperc});
185}
186function absoluteOffsetLeft(comp) {
187  return comp==null ? 0 : comp.offsetLeft + absoluteOffsetLeft(comp.offsetParent);
188}
189function eventClientXY(e) {
190  var x,y;
191  if (document.all) { // grab the x-y pos.s if browser is IE
192    x = event.clientX+document.body.scrollLeft;
193    y = event.clientY+document.body.scrollTop;
194  } else {  // grab the x-y pos.s if browser is NS
195    x = e.pageX;
196    y = e.pageY;
197  }  
198  // catch possible negative values in NS4
199  if (x < 0){x = 0}
200  if (y < 0){y = 0}
201  return new Object({x:x,y:y});
202}
203function iwFlashGoto(flashId,componentId,label) {
204  var flash=getObject(flashId);
205  if (flash!=null && flash.TGotoLabel) {
206    try {
207      flash.TGotoLabel(componentId+".jsActions",label);
208    } catch (e) {
209      // ignore
210    }
211  }
212}
213function iwFlashSetVariable(flashId,varPath,valueString) {
214  var flash=getObject(flashId);
215  if (flash!=null && flash.SetVariable) {
216    try {
217      flash.SetVariable(varPath,""+valueString);
218    } catch (e) {
219      // ignore
220    }
221  }
222}
223var iwGo_interval=null;
224function iwGo_schedule(url,target,whenMillis) {
225  iwGo_interval=window.setInterval("iwGo_exec('"+url+"','"+target+"')",whenMillis);
226}
227function iwGo_cancel() {
228  if (iwGo_interval!=null) {
229    window.clearInterval(iwGo_interval);
230  }
231}
232function iwGo_exec(url,target) {
233  iwGo_cancel();
234  var tw=toTargetWindow(target);
235  if (tw!=null) {
236    tw.location=url;
237  } else {
238    window.open(url,target);
239  }
240}
241function toTargetWindow(t) {
242  var res=null;
243  if (t==null || t=='' || t=='_self') {
244    res=self;
245  } else if (t=='_top') {
246    res=top;
247  } else if (t=='_parent') {
248    res=parent;
249  } else if (t=='_blank') {
250    res=null;
251  } else {
252    res=window.frames[t];
253  }
254  return res;
255}
256
257function iwOpenZoomPopup(theURL, winName) {
258  var w = screen.width - 40;
259  var h = screen.height - 100;
260  var features = 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width='+w+',height='+h+',screenX=15,screenY=20,left=15,top=20';
261  window.open(theURL+'&width='+(w-100)+'&height='+(h-140),winName,features);
262}
263
264function iwGenerateClick(dest) {
265  if (document.createEvent) {
266    var evObj = document.createEvent('MouseEvents');
267    evObj.initEvent('click', true, true);
268    dest.dispatchEvent(evObj);
269  } else if (document.createEventObject) {
270    dest.fireEvent('onclick');
271  } else {
272    alert("Sorry: Unknown browser -- Unable to propagate click -- please contact support");
273  }
274}

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.