PageSourceSearch

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

js optimist.org collected 2026-09-24 09:01:12 UTC 3,992 bytes, 216 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 KT_focusedEl=null;
10KT_validateSingle=function(_979,_97a){
11var _97b=_979.charCodeAt(0);
12switch(_97a){
13case "9":
14if(_97b<58&&_97b>47){
15return true;
16}
17break;
18case "A":
19if((_97b<91&&_97b>64)||(_97b<123&&_97b>96)){
20return true;
21}
22break;
23case "X":
24if((_97b<91&&_97b>64)||(_97b<123&&_97b>96)||(_97b<58&&_97b>47)){
25return true;
26}
27break;
28case "?":
29return true;
30break;
31default:
32return true;
33break;
34}
35};
36KT_maskDefaultValue=function(_97c){
37switch(_97c){
38case "9":
39return "0";
40break;
41case "A":
42return "a";
43break;
44case "X":
45return "0";
46break;
47case "?":
48return "0";
49break;
50default:
51return "0";
52break;
53}
54};
55KT_isSpecialChar=function(_97d){
56if(_97d=="9"||_97d=="A"||_97d=="X"||_97d=="?"){
57return true;
58}else{
59return false;
60}
61};
62mask_onValueChanged=function(){
63if((typeof window.getSelection=="undefined"&&typeof document.selection=="undefined")){
64return;
65}
66if(KT_focusedEl==null||KT_focusedEl.mask==null||KT_focusedEl.mask==""){
67return;
68}
69var mask=KT_focusedEl.mask;
70var val=KT_focusedEl.value;
71var i=0;
72var _981=false;
73if(val==KT_focusedEl.oldText){
74return;
75}
76if(val.length>mask.length){
77val=val.substr(0,mask.length);
78_981=true;
79}
80for(;i<mask.length;i++){
81if(val.charCodeAt(i).toString()!="NaN"){
82if(KT_isSpecialChar(mask.charAt(i))){
83if(KT_validateSingle(val.charAt(i),mask.charAt(i))){
84continue;
85}else{
86val=KT_focusedEl.oldText;
87i=mask.length;
88break;
89}
90}else{
91if(val.charAt(i)!=mask.charAt(i)){
92if(i==val.length-1){
93var _982=val.substr(val.length-1,val.length);
94val=val.substr(0,val.length-1)+mask.charAt(i)+_982;
95_981=true;
96continue;
97}else{
98val=KT_focusedEl.oldText;
99i=mask.length;
100}
101break;
102}
103}
104}else{
105if(val.length<KT_focusedEl.oldText.length){
106break;
107}
108for(;i<mask.length;i++){
109if(!KT_isSpecialChar(mask.charAt(i))){
110val+=mask.charAt(i);
111_981=true;
112}else{
113break;
114}
115}
116break;
117}
118}
119if(val.length>mask.length){
120val=val.substr(0,mask.length);
121_981=true;
122}
123if(KT_focusedEl.value!=val){
124KT_focusedEl.value=val;
125}
126KT_focusedEl.oldText=val;
127if(_981){
128}
129};
130mask_parseFirstTime=function(_983,mask){
131var _985="";
132var _986="";
133cond=1;
134imask=0;
135ival=0;
136cnt=0;
137while(cond==1){
138cond=1;
139if(!KT_isSpecialChar(mask.charAt(imask))){
140if(_983.charCodeAt(ival).toString()!="NaN"){
141if(mask.charAt(imask)==_983.charAt(ival)){
142imask++;
143ival++;
144}else{
145_983=_983.substr(0,ival)+mask.charAt(imask)+_983.substr(ival,_983.length);
146imask=0;
147ival=0;
148cond=1;
149}
150}else{
151_983+=KT_maskDefaultValue(mask.charAt(imask));
152}
153}else{
154imask++;
155ival++;
156}
157if(imask>=mask.length||ival>=_983.length){
158cond=0;
159}
160}
161for(i=0;i<mask.length;i++){
162if(KT_isSpecialChar(mask.charAt(i))){
163_985+=mask.charAt(i);
164if(_983.charCodeAt(i).toString()!="NaN"){
165_986+=_983.charAt(i);
166}else{
167_986+=KT_maskDefaultValue(mask.charAt(i));
168}
169}
170}
171oldvalue=_983;
172_983=_986;
173var _987="";
174for(i=0;i<_985.length;i++){
175if(!KT_validateSingle(_983.charAt(i),_985.charAt(i))){
176_987+=KT_maskDefaultValue(_985.charAt(i));
177}else{
178_987+=_983.charAt(i);
179}
180}
181var _988="";
182var j=0;
183for(i=0;i<mask.length;i++){
184if(KT_isSpecialChar(mask.charAt(i))){
185_988+=_987.charAt(j++);
186}else{
187_988+=mask.charAt(i);
188}
189}
190return _988;
191};
192mask_onSetFocus=function(obj,mask){
193if((typeof window.getSelection=="undefined"&&typeof document.selection=="undefined")){
194return;
195}
196if(typeof obj.mask=="undefined"){
197ret="";
198if(obj.value!=""){
199ret=mask_parseFirstTime(obj.value,mask);
200}
201obj.value=ret;
202obj.mask=mask;
203}
204KT_focusedEl=obj;
205if(typeof KT_focusedEl.oldText=="undefined"){
206KT_focusedEl.oldText=obj.value;
207mask_onValueChanged();
208}
209};
210mask_onKillFocus=function(){
211if((typeof window.getSelection=="undefined"&&typeof document.selection=="undefined")){
212return;
213}
214mask_onValueChanged();
215KT_focusedEl=null;
216};

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.