PageSourceSearch

https://an.edu/wp-content/cache/wpfc-minified/mk5g48u1/2lckn.js

js an.edu collected 2026-09-24 12:02:11 UTC 4,360 bytes, 166 lines download raw bytes

1jQuery(function ($){
2var i18n=(tc_csca_auto_ajax&&tc_csca_auto_ajax.i18n) ? tc_csca_auto_ajax.i18n:{};
3var cache={ states: {}, cities: {}};
4function t(key, fallback){
5return i18n[key]||fallback;
6}
7function isEmptyId(id){
8return !id||id==="0"||id===0||id==="0001";
9}
10function emptyLabel($el, key, fallback){
11return $el.attr("data-placeholder")||t(key, fallback);
12}
13function optionHtml(value, dataId, label){
14return "<option value='" + value + "' data-id='" + dataId + "'>" + label + "</option>";
15}
16function setLoading($el){
17$el.prop("disabled", true).attr("aria-busy", "true");
18$el.html(optionHtml("0001", "0001", t("loading", "Loading...")));
19}
20function setEmpty($el, label, disable){
21$el.attr("aria-busy", "false");
22$el.html(optionHtml("0", "0", label));
23$el.prop("disabled", !!disable);
24}
25function fillOptions($el, rows, emptyLbl){
26$el.attr("aria-busy", "false").prop("disabled", false);
27$el.html(optionHtml("0", "0", emptyLbl));
28if(!rows||!rows.length){
29return false;
30}
31for (var i=0; i < rows.length; i++){
32$el.append(optionHtml(rows[i].name, rows[i].id, rows[i].name));
33}
34return true;
35}
36function findPaired($el, typeClass){
37var $form=$el.closest("form");
38var group=$el.attr("data-tc-group");
39if(group){
40var $byGroup=$form.find("select." + typeClass + '[data-tc-group="' + group + '"]');
41if($byGroup.length){
42return $byGroup.first();
43}}
44var fromClass=$el.hasClass("country_auto")
45? "country_auto"
46: $el.hasClass("state_auto")
47? "state_auto"
48: "city_auto";
49var $fromAll=$form.find("select." + fromClass);
50var idx=$fromAll.index($el);
51var $targets=$form.find("select." + typeClass);
52if(idx >=0&&$targets.eq(idx).length){
53return $targets.eq(idx);
54}
55return $targets.first();
56}
57function fetchStates(cnt, done){
58if(cache.states[cnt]){
59done(cache.states[cnt]);
60return;
61}
62$.ajax({
63url: tc_csca_auto_ajax.ajax_url,
64type: "post",
65dataType: "json",
66data: {
67action: "tc_csca_get_states",
68nonce_ajax: tc_csca_auto_ajax.nonce,
69cnt: cnt
70}})
71.done(function (response){
72var rows=response&&response.length ? response:[];
73cache.states[cnt]=rows;
74done(rows);
75})
76.fail(function (){
77done(null);
78});
79}
80function fetchCities(sid, done){
81if(cache.cities[sid]){
82done(cache.cities[sid]);
83return;
84}
85$.ajax({
86url: tc_csca_auto_ajax.ajax_url,
87type: "post",
88dataType: "json",
89data: {
90action: "tc_csca_get_cities",
91nonce_ajax: tc_csca_auto_ajax.nonce,
92sid: sid
93}})
94.done(function (response){
95var rows=response&&response.length ? response:[];
96cache.cities[sid]=rows;
97done(rows);
98})
99.fail(function (){
100done(null);
101});
102}
103$(document).on("change", "select.country_auto", function (){
104var $country=$(this);
105var $state=findPaired($country, "state_auto");
106var $city=findPaired($country, "city_auto");
107if(!$state.length){
108return;
109}
110var cnt=$country.children("option:selected").attr("data-id");
111var stateLbl=emptyLabel($state, "select_state", "Select State");
112var cityLbl=$city.length ? emptyLabel($city, "select_city", "Select City"):"";
113if($city.length){
114setEmpty($city, cityLbl, true);
115}
116if(isEmptyId(cnt)){
117setEmpty($state, stateLbl, true);
118return;
119}
120setLoading($state);
121fetchStates(cnt, function (rows){
122if(rows===null){
123setEmpty($state, t("state_not_found", "State list not found"), false);
124return;
125}
126if(!fillOptions($state, rows, stateLbl)){
127setEmpty($state, t("state_not_found", "State list not found"), false);
128}});
129});
130$(document).on("change", "select.state_auto", function (){
131var $state=$(this);
132var $city=findPaired($state, "city_auto");
133if(!$city.length){
134return;
135}
136var sid=$state.children("option:selected").attr("data-id");
137var cityLbl=emptyLabel($city, "select_city", "Select City");
138if(isEmptyId(sid)){
139setEmpty($city, cityLbl, true);
140return;
141}
142setLoading($city);
143fetchCities(sid, function (rows){
144if(rows===null){
145setEmpty($city, t("city_not_found", "City list not found"), false);
146return;
147}
148if(!fillOptions($city, rows, cityLbl)){
149setEmpty($city, t("city_not_found", "City list not found"), false);
150}});
151});
152$("select.state_auto, select.city_auto").each(function (){
153var $el=$(this);
154if(isEmptyId($el.children("option:selected").attr("data-id"))){
155$el.prop("disabled", true);
156}});
157function reenableDependent(form){
158$(form).find("select.state_auto, select.city_auto").prop("disabled", false);
159}
160$(document).on("submit", "form.wpcf7-form", function (){
161reenableDependent(this);
162});
163$(document).on("wpcf7beforesubmit", "form.wpcf7-form", function (){
164reenableDependent(this);
165});
166});

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.