PageSourceSearch

https://optimist.org/cf_scripts/scripts/cfform.js

js optimist.org collected 2026-09-24 09:01:11 UTC 11,048 bytes, 598 lines download raw bytes

1/*ADOBE SYSTEMS INCORPORATED
2Copyright 2012 Adobe Systems Incorporated
3All Rights Reserved.
4
5NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
6terms of the Adobe license agreement accompanying it.  If you have received this file from a
7source other than Adobe, then your use, modification, or distribution of it requires the prior
8written permission of Adobe.*/
9var _CF_error_messages=new Array();
10var _CF_error_fields=new Object();
11var _CF_FirstErrorField=null;
12var _CF_submit_status=new Array();
13_CF_signalLoad=function(){
14_CF_loaded=1;
15};
16_CF_onError=function(_928,_929,_92a,_92b){
17if(_CF_error_fields[_929]==null){
18if(_CF_FirstErrorField==null){
19_CF_FirstErrorField=_929;
20}
21_CF_error_exists=true;
22_CF_error_fields[_929]=_92b;
23_CF_error_messages[_CF_error_messages.length]=_92b;
24}
25};
26_CF_onErrorAlert=function(_92c){
27var _92d="";
28for(var i=0;i<_92c.length;i++){
29_92d+=_92c[i]+"\n";
30}
31alert(_92d);
32return false;
33};
34updateHiddenValue=function(val,form,name){
35if(form==null||form==""){
36form=0;
37}
38if(document.forms[form]==null||document.forms[form][name]==null){
39return;
40}
41document.forms[form][name].value=val;
42};
43_CF_hasValue=function(obj,_933,_934){
44if(_933=="TEXT"||_933=="FILE"||_933=="PASSWORD"||_933=="CFTEXTAREA"||_933=="TEXTAREA"||_933=="CFTEXTINPUT"||_933=="DATEFIELD"){
45if(obj.value.length==0){
46return false;
47}else{
48if(_934){
49str=obj.value.replace(/^\s+/,"").replace(/\s+$/,"");
50if(str.length==0){
51return false;
52}
53}
54}
55return true;
56}else{
57if(_933=="SELECT"){
58for(i=0;i<obj.length;i++){
59if(obj.options[i].selected&&obj.options[i].value.length>0){
60return true;
61}
62}
63return false;
64}else{
65if(_933=="SINGLE_VALUE_RADIO"||_933=="SINGLE_VALUE_CHECKBOX"){
66if(obj.checked){
67return true;
68}else{
69return false;
70}
71}else{
72if(_933=="RADIO"||_933=="CHECKBOX"){
73if(obj.length==undefined&&obj.checked){
74return true;
75}else{
76for(i=0;i<obj.length;i++){
77if(obj[i].checked){
78return true;
79}
80}
81}
82return false;
83}else{
84if(_933=="CFTREE"){
85if(obj["value"].length>0){
86return true;
87}else{
88return false;
89}
90}else{
91if(_933=="RICHTEXT"){
92var _935=FCKeditorAPI.GetInstance(obj.id);
93var val=_935.GetXHTML();
94if(val.length==0){
95return false;
96}else{
97if(_934){
98str=val.replace(/^\s+/,"").replace(/\s+$/,"");
99if(str.length==0){
100return false;
101}
102}
103return true;
104}
105}else{
106return true;
107}
108}
109}
110}
111}
112}
113};
114_CF_checkdate=function(_937,_938){
115_937=_937.replace(/^\s+/,"").replace(/\s+$/,"");
116_937=_937=_937.replace(/{d \'/,"").replace(/'}/,"");
117if(_938){
118if(_937.length==0){
119return false;
120}
121}else{
122if(_937.length==0){
123return true;
124}
125}
126if(_937.length==0){
127return true;
128}
129isplit=_937.indexOf("/");
130splitchr="/";
131if(isplit==-1){
132isplit=_937.indexOf(".");
133splitchr=".";
134}
135if(isplit==-1){
136isplit=_937.indexOf("-");
137splitchr="-";
138}
139if(isplit==-1||isplit==_937.length){
140return false;
141}
142var _939=_937.substring(0,isplit);
143if(_939.length==4){
144sYear=_937.substring(0,isplit);
145isplit=_937.indexOf(splitchr,isplit+1);
146if(isplit==-1||(isplit+1)==_937.length){
147return false;
148}
149sMonth=_937.substring((sYear.length+1),isplit);
150sDay=_937.substring(isplit+1);
151}else{
152sMonth=_937.substring(0,isplit);
153isplit=_937.indexOf(splitchr,isplit+1);
154if(isplit==-1||(isplit+1)==_937.length){
155return false;
156}
157sDay=_937.substring((sMonth.length+1),isplit);
158sYear=_937.substring(isplit+1);
159}
160if((sDay.length==0)||(sMonth.length==0)||(sYear.length==0)){
161return false;
162}
163if(!_CF_checkinteger(sMonth)){
164return false;
165}else{
166if(!_CF_checkrange(sMonth,1,12)){
167return false;
168}else{
169if(!_CF_checkinteger(sYear)){
170return false;
171}else{
172if(sYear.length!=1&&sYear.length!=2&&sYear.length!=4){
173return false;
174}else{
175if(!_CF_checkrange(sYear,0,9999)){
176return false;
177}else{
178if(!_CF_checkinteger(sDay)){
179return false;
180}else{
181if(!_CF_checkday(sYear,sMonth,sDay)){
182return false;
183}else{
184return true;
185}
186}
187}
188}
189}
190}
191}
192};
193_CF_checkeurodate=function(_93a,_93b){
194_93a=_93a.replace(/^\s+/,"").replace(/\s+$/,"");
195_93a=_93a=_93a.replace(/{d \'/,"").replace(/'}/,"");
196if(_93b){
197if(_93a.length==0){
198return false;
199}
200}else{
201if(_93a.length==0){
202return true;
203}
204}
205isplit=_93a.indexOf("/");
206splitchr="/";
207if(isplit==-1){
208isplit=_93a.indexOf(".");
209splitchr=".";
210}
211if(isplit==-1){
212isplit=_93a.indexOf("-");
213splitchr="-";
214}
215if(isplit==-1||isplit==_93a.length){
216return false;
217}
218var _93c=_93a.substring(0,isplit);
219if(_93c.length==4){
220sYear=_93a.substring(0,isplit);
221isplit=_93a.indexOf(splitchr,isplit+1);
222if(isplit==-1||(isplit+1)==_93a.length){
223return false;
224}
225sMonth=_93a.substring((sYear.length+1),isplit);
226sDay=_93a.substring(isplit+1);
227}else{
228sDay=_93a.substring(0,isplit);
229isplit=_93a.indexOf(splitchr,isplit+1);
230if(isplit==-1||(isplit+1)==_93a.length){
231return false;
232}
233sMonth=_93a.substring((sDay.length+1),isplit);
234sYear=_93a.substring(isplit+1);
235}
236if(!_CF_checkinteger(sMonth)){
237return false;
238}else{
239if(!_CF_checkrange(sMonth,1,12)){
240return false;
241}else{
242if(!_CF_checkinteger(sYear)){
243return false;
244}else{
245if(!_CF_checkrange(sYear,0,null)){
246return false;
247}else{
248if(!_CF_checkinteger(sDay)){
249return false;
250}else{
251if(!_CF_checkday(sYear,sMonth,sDay)){
252return false;
253}else{
254return true;
255}
256}
257}
258}
259}
260}
261};
262_CF_checkday=function(_93d,_93e,_93f){
263maxDay=31;
264if(_93e==4||_93e==6||_93e==9||_93e==11){
265maxDay=30;
266}else{
267if(_93e==2){
268if(_93d%4>0){
269maxDay=28;
270}else{
271if(_93d%100==0&&_93d%400>0){
272maxDay=28;
273}else{
274maxDay=29;
275}
276}
277}
278}
279return _CF_checkrange(_93f,1,maxDay);
280};
281_CF_checkinteger=function(_940,_941){
282_940=_940.replace(/^\s+/,"").replace(/\s+$/,"");
283_940=_940.replace(/[$£¥€,~+]?/g,"");
284if(_941){
285if(_940.length==0){
286return false;
287}
288}else{
289if(_940.length==0){
290return true;
291}
292}
293var _942=".";
294var _943=_940.indexOf(_942);
295if(_943==-1){
296return _CF_checknumber(_940);
297}else{
298return false;
299}
300};
301_CF_numberrange=function(_944,_945,_946,_947){
302if(_947){
303if(_944.length==0){
304return false;
305}
306}else{
307if(_944.length==0){
308return true;
309}
310}
311if(_945!=null){
312if(_944<_945){
313return false;
314}
315}
316if(_946!=null){
317if(_944>_946){
318return false;
319}
320}
321return true;
322};
323_CF_checknumber=function(_948,_949){
324var _94a=" .+-0123456789";
325var _94b=" .0123456789";
326var _94c;
327var _94d=false;
328var _94e=false;
329var _94f=false;
330_948=_948.replace(/^\s+/,"").replace(/\s+$/,"");
331_948=_948.replace(/[$£¥€,~+]?/g,"");
332if(_949){
333if(_948.length==0){
334return false;
335}
336}else{
337if(_948.length==0){
338return true;
339}
340}
341_94c=_94a.indexOf(_948.charAt(0));
342if(_94c==1){
343_94d=true;
344}else{
345if(_94c<1){
346return false;
347}
348}
349for(var i=1;i<_948.length;i++){
350_94c=_94b.indexOf(_948.charAt(i));
351if(_94c<0){
352return false;
353}else{
354if(_94c==1){
355if(_94d){
356return false;
357}else{
358_94d=true;
359}
360}else{
361if(_94c==0){
362if(_94d||_94f){
363_94e=true;
364}
365}else{
366if(_94e){
367return false;
368}else{
369_94f=true;
370}
371}
372}
373}
374}
375return true;
376};
377_CF_checkrange=function(_951,_952,_953,_954){
378_951=_951.replace(/^\s+/,"").replace(/\s+$/,"");
379if(_954){
380if(_951.length==0){
381return false;
382}
383}else{
384if(_951.length==0){
385return true;
386}
387}
388if(!_CF_checknumber(_951)){
389return false;
390}else{
391return (_CF_numberrange((eval(_951)),_952,_953));
392}
393return true;
394};
395_CF_checktime=function(_955,_956){
396_955=_955.replace(/^\s+/,"").replace(/\s+$/,"");
397_955=_955.replace(/\s+:\s+/,":");
398_955=_955=_955.replace(/{t \'/,"").replace(/'}/,"");
399if(_956){
400if(_955.length==0){
401return false;
402}
403}else{
404if(_955.length==0){
405return true;
406}
407}
408var _957=_CF_checkregex(_955,/^((([0-1]?\d)|(2[0-3])):[0-5]?\d)?(:[0-5]?\d)? ?([AP]M|[AP]m|[ap]m|[ap]M)?$/,_956);
409return _957;
410};
411_CF_checkphone=function(_958,_959){
412_958=_958.replace(/^\s+/,"").replace(/\s+$/,"");
413if(_959){
414if(_958.length==0){
415return false;
416}
417}else{
418if(_958.length==0){
419return true;
420}
421}
422if(_958.length==0){
423return true;
424}
425return _CF_checkregex(_958,/^(((1))?[ ,\-,\.]?([\\(]?([1-9][0-9]{2})[\\)]?))?[ ,\-,\.]?([^0-1]){1}([0-9]){2}[ ,\-,\.]?([0-9]){4}(( )((x){0,1}([0-9]){1,5}){0,1})?$/,_959);
426};
427_CF_checkzip=function(_95a,_95b){
428_95a=_95a.replace(/^\s+/,"").replace(/\s+$/,"");
429if(_95b){
430if(_95a.length==0){
431return false;
432}
433}else{
434if(_95a.length==0){
435return true;
436}
437}
438return _CF_checkregex(_95a,/^([0-9]){5,5}$|(([0-9]){5,5}(-| ){1}([0-9]){4,4}$)/,_95b);
439};
440_CF_checkcreditcard=function(_95c,_95d){
441_95c=_95c.replace(/^\s+/,"").replace(/\s+$/,"");
442if(_95d){
443if(_95c.length==0){
444return false;
445}
446}else{
447if(_95c.length==0){
448return true;
449}
450}
451if(_95c.length==0){
452return true;
453}
454var _95e=" -";
455var _95f="";
456var _960;
457for(var i=0;i<_95c.length;i++){
458_960=_95e.indexOf(_95c.charAt(i));
459if(_960<0){
460_95f+=_95c.substring(i,(i+1));
461}
462}
463if(_95f.length<13||_95f.length>19){
464return false;
465}
466if(_95f.charAt(0)=="+"){
467return false;
468}
469if(!_CF_checkinteger(_95f)){
470return false;
471}
472var _962=_95f.length%2==1?false:true;
473var _963=0;
474var _964;
475for(var i=0;i<_95f.length;i++){
476_964=eval(_95f.charAt(i));
477if(_962){
478_964*=2;
479_963+=(_964%10);
480if((_964/10)>=1){
481_963++;
482}
483_962=false;
484}else{
485_963+=_964;
486_962=true;
487}
488}
489return (_963%10)==0?true:false;
490};
491_CF_checkssn=function(_965,_966){
492_965=_965.replace(/^\s+/,"").replace(/\s+$/,"");
493if(_966){
494if(_965.length==0){
495return false;
496}
497}else{
498if(_965.length==0){
499return true;
500}
501}
502return _CF_checkregex(_965,/^[0-9]{3}(-| )[0-9]{2}(-| )[0-9]{4}$/,_966);
503};
504_CF_checkEmail=function(_967,_968){
505_967=_967.replace(/^\s+/,"").replace(/\s+$/,"");
506if(_968){
507if(_967.length==0){
508return false;
509}
510}else{
511if(_967.length==0){
512return true;
513}
514}
515return _CF_checkregex(_967,/^[a-zA-Z_0-9-'\+~]+(\.[a-zA-Z_0-9-'\+~]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]*$/,_968);
516};
517_CF_checkURL=function(_969,_96a){
518_969=_969.replace(/^\s+/,"").replace(/\s+$/,"");
519if(_96a){
520if(_969.length==0){
521return false;
522}
523}else{
524if(_969.length==0){
525return true;
526}
527}
528return _CF_checkregex(_969.toLowerCase(),/^((http|https|ftp|file)\:\/\/([a-zA-Z0-0]*:[a-zA-Z0-0]*(@))?[a-zA-Z0-9-\.]+(\.[a-zA-Z]{2,3})?(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9-\._\?\,\'\/\+&amp;%\$#\=~])*)|((mailto)\:[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]*)|((news)\:[a-zA-Z0-9\.]*)$/,_96a);
529};
530_CF_checkUUID=function(_96b,_96c){
531_96b=_96b.replace(/^\s+/,"").replace(/\s+$/,"");
532if(_96c){
533if(_96b.length==0){
534return false;
535}
536}else{
537if(_96b.length==0){
538return true;
539}
540}
541return _CF_checkregex(_96b,/[A-Fa-f0-9]{8,8}-[A-Fa-f0-9]{4,4}-[A-Fa-f0-9]{4,4}-[A-Fa-f0-9]{16,16}/,_96c);
542};
543_CF_checkGUID=function(_96d,_96e){
544_96d=_96d.replace(/^\s+/,"").replace(/\s+$/,"");
545if(_96e){
546if(_96d.length==0){
547return false;
548}
549}else{
550if(_96d.length==0){
551return true;
552}
553}
554return _CF_checkregex(_96d,/[A-Fa-f0-9]{8,8}-[A-Fa-f0-9]{4,4}-[A-Fa-f0-9]{4,4}-[A-Fa-f0-9]{4,4}-[A-Fa-f0-9]{12,12}/,_96e);
555};
556_CF_checkBoolean=function(_96f,_970){
557_96f=_96f.replace(/^\s+/,"").replace(/\s+$/,"");
558if(_970){
559if(_96f.length==0){
560return false;
561}
562}else{
563if(_96f.length==0){
564return true;
565}
566}
567if(_96f.toUpperCase()=="TRUE"||_96f.toUpperCase()=="YES"||(_CF_checknumber(_96f)&&_96f!="0")){
568return true;
569}else{
570if(_96f.toUpperCase()=="FALSE"||_96f.toUpperCase()=="NO"||_96f=="0"){
571return true;
572}else{
573return false;
574}
575}
576};
577_CF_setFormParam=function(_971,_972,_973){
578var _974="document['"+_971+"']['"+_972+"']";
579var obj=eval(_974);
580if(obj==undefined){
581return false;
582}else{
583obj.value=_973;
584return true;
585}
586};
587_CF_checkregex=function(_976,_977,_978){
588if(_978){
589if(_976.length==0){
590return false;
591}
592}else{
593if(_976.length==0){
594return true;
595}
596}
597return _977.test(_976);
598};

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.