PageSourceSearch

https://hbalansing.com/js/main.js?v=19

js hbalansing.com collected 2026-10-07 19:41:45 UTC 16,427 bytes, 529 lines download raw bytes

1var BackEndSite = '';
2var SiteTeam = '';
3
4var TemplateData = {
5  preview: '',
6  pages: [],
7  current_page: "home",
8  directory_page: false,
9  full_directory_route: '',
10  BackEndSite: BackEndSite,
11  contractor_data: {},
12  template: {},
13  formdata: [],
14  events: [],
15  event: {},
16  current_page_contents: { html: "" },
17  search: { search_string: "", categories: [] },
18  ads: { header: [], square: [], footer: [] },
19  hba: "",
20  originalMembers: [],
21  activeMembers: [],
22  builderMembers: [],
23  allMembers: [],
24  categories: [],
25  catMembers: [],
26  alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
27  searchQuery: "",
28  catToShow: "",
29  paginate: ["filteredMembers"],
30  view: builders,
31  gallery_index: null,
32  member_contact: {name: '', fromEmail: '', subject: '', message: ''}
33};
34
35var current_page_contents = { html: "" };
36var home_search_text = null;
37var cat_search = null;
38var builders = false;
39var PreviewTeam = "";
40var ads = { header: [], square: [], footer: [] };
41var SetTeam = "";
42function vue_int() {
43  route = TemplateData.current_page.split("/");
44  var is_home = false;
45  if (typeof route[1] !== "undefined") {
46    if (
47      typeof TemplateData.pages[route[0]].sub_pages[route[1]] === "undefined"
48    ) {
49      is_home = true;
50    }
51  } else {
52    if (typeof TemplateData.pages[route[0]] === "undefined") {
53      is_home = true;
54    }
55  }
56  if (is_home) {
57    TemplateData.current_page = "home";
58  }
59
60  $.each(TemplateData.template.components, function (index, value) {
61
62    var s_methods = value.methods;
63    if (!s_methods) {
64      s_methods = {};
65    }
66    var o_methods = eval("(" + s_methods + ")");
67
68    var s_computed = value.computed;
69    if (!s_computed) {
70      s_computed = {};
71    }
72    var o_computed = eval("(" + s_computed + ")");
73
74    var s_watch = value.watch;
75    if (!s_watch) {
76      s_watch = {};
77    }
78    var o_watch = eval("(" + s_watch + ")");
79    console.log(value.name);
80
81    Vue.component(value.name, {
82      props: {
83        setting: {
84          type: String,
85          default: "",
86        },
87        otherProps: Object,
88      },
89
90      template: value.template,
91      mounted: function () {
92        if (typeof this.component_init == "function") {
93          this.component_init();
94        }
95      },
96      data: function () {
97        return TemplateData;
98      },
99      watch: o_watch,
100      updated: function () {
101        this.$nextTick(function () {
102          if (typeof this.component_update == "function") {
103            this.component_update();
104          }
105        });
106      },
107      methods: o_methods,
108      computed: o_computed,
109    });
110  });
111
112  $.each(TemplateData.pages, function (index, value) {
113    console.log("page-component-" + index);
114    Vue.component("page-component-" + index, {
115      template: "<div>" + value.page_info + "</div>",
116      data: function () {
117        return TemplateData;
118      }
119    });
120    if (value.sub_pages) {
121      $.each(value.sub_pages, function (index2, value2) {
122        console.log("page-component-" + index2);
123        Vue.component("page-component-" + index2, {
124          template: "<div>" + value2.page_info + "</div>",
125          data: function () {
126            return TemplateData;
127          }
128        });
129
130      })
131    }
132  });
133
134  const main_app = new Vue({
135    data: function () {
136      return TemplateData;
137    },
138    watch: {
139      current_page: function () {
140        this.$nextTick(function () {
141          console.log("update colors");
142          this.update_colors();
143          this.responsive_update();
144        });
145      }
146    },
147    created: function () {
148      //dustin's test call for component
149    },
150    mounted: function () {
151      this.$nextTick(function () {
152        this.responsive_update();
153      });
154      this.update_colors();
155    },
156    computed: {
157      getbody: function () {
158        if (TemplateData.pages.about_us_association_info.settings.background_color === "") {
159          return "width:100%;background-color:#ffffff";
160        } else {
161          return (
162            "width:100%;background-color:" +
163            TemplateData.pages.about_us_association_info.settings.background_color +
164            ";"
165          );
166        }
167      }
168    },
169    methods: {
170      update_colors: function () {
171        if (TemplateData.pages.about_us_association_info.settings.header_color !== "") {
172          $(".home-block-head").css("background", "none");
173          $(".home-block-head").css(
174            "background-color",
175            TemplateData.pages.about_us_association_info.settings.header_color
176          );
177        }
178        if (TemplateData.pages.about_us_association_info.settings.button_color !== "") {
179          $(".btn-primary").css(
180            "background-color",
181            TemplateData.pages.about_us_association_info.settings.button_color
182          );
183          $(".btn-primary").css(
184            "border-color",
185            TemplateData.pages.about_us_association_info.settings.button_color
186          );
187        }
188      },
189      responsive_update: function () {
190
191        if (!sessionStorage.getItem('lcbaPopupShown')) {
192          // Show the modal on page load if not already shown in the session
193          $('#lcbaPopup').modal({ backdrop: 'static', keyboard: false }).show();
194          sessionStorage.setItem('lcbaPopupShown', 'true');
195        }
196      
197         // Handle form submission
198        $('#lcbaSignupForm').on('submit', function(event) {
199          event.preventDefault();
200          
201          // Check if opt-in is checked
202          if (!$('#optIn').is(':checked')) {
203            alert('You must agree to receive promotional messages to sign up.');
204            return;
205          }
206          
207          // Disable the submit button and change text to indicate submission is in progress
208          var submitButton = $('button[type="submit"]');
209          submitButton.prop('disabled', true).text('Submitting...');
210          
211          // Prepare form data using FormData object
212          var formData = new FormData();
213          var name = $('#name').val().trim();
214          var companyName = $('#companyName').val().trim();
215          var cellPhone = $('#cellPhone').val().replace(/\D/g, ''); // Remove non-numeric characters from phone number
216          var [firstName, ...lastNameParts] = name.split(' ');
217          var lastName = lastNameParts.join(' ');
218
219          formData.append('first_name', firstName);
220          formData.append('last_name', lastName);
221          formData.append('company_name', companyName);
222          formData.append('cell_phone', cellPhone);
223
224          // Post form data to the specified URL using jQuery Ajax
225          $.ajax({
226            url: 'https://formfling.com/s/KLm807Hz7BXhB8S08uuF-iNsLFVAqnwRyYFLOMcB6-hye2rq',
227            type: 'POST',
228            data: formData,
229            contentType: false,
230            processData: false,
231            success: function(response) {
232              console.log(response);
233              $('#lcbaSignupForm').append('<div class="success-message text-success mt-3">Form submitted successfully!</div>');
234              setTimeout(function() {
235                $('#lcbaPopup').modal('hide');
236              }, 5000);
237            },
238            error: function(error) {
239              alert('There was an error submitting the form. Please try again.');
240              console.log(error);
241            },
242            complete: function() {
243              // Re-enable the submit button and reset text after submission completes
244              submitButton.prop('disabled', false).text('Sign Up');
245            }
246          });
247        });
248
249        $(window)
250          .resize(function () {
251            var page_width = $(".page-content")
252              .find(".col")
253              .width();
254            $(".page-content")
255              .find("img")
256              .each(function () {
257                var iframe_width = $(this).attr("width");
258                var iframe_height = $(this).attr("height");
259                console.log(iframe_width);
260                console.log(page_width);
261                if (iframe_width > page_width) {
262                  var newwidth = page_width - 20;
263                  $(this).width(newwidth);
264                  var ratio = newwidth / iframe_width;
265                  $(this).css("height", ratio * iframe_height);
266                } else {
267                  $(this).width(iframe_width);
268                  $(this).css("height", iframe_height);
269                }
270              });
271            $(".page-content")
272              .find("iframe")
273              .each(function () {
274                var iframe_width = $(this).attr("width");
275                var iframe_height = $(this).attr("height");
276                console.log(iframe_width);
277                console.log(page_width);
278                if (iframe_width > page_width) {
279                  var newwidth = page_width - 20;
280                  $(this).width(newwidth);
281                  var ratio = newwidth / iframe_width;
282                  $(this).css("height", ratio * iframe_height);
283                } else {
284                  $(this).width(iframe_width);
285                  $(this).css("height", iframe_height);
286                }
287              });
288          })
289          .resize();
290      }
291    }
292  }).$mount("#ub_app");
293  $("#ub_app").fadeIn('slow', function () {
294    if (self !== top) {
295      var contents = $('#ub_app').html();
296      var data = { "page_name": TemplateData.current_page, "contents": contents };
297      window.parent.write_page(data);
298    }
299  });
300};
301
302$(document).ready(function () {
303
304  $('#search_contents').remove();
305  var domain = document.domain;
306  if (!BackEndSite) {
307    BackEndSite = location.protocol + '//' + domain + '/';
308    TemplateData.preview = '/preview';
309  }
310  console.log(location.protocol);
311
312  var route = window.location.hash;
313  if (!route) {
314    route = "home";
315  } else {
316    route = window.location.hash.split("#/")[1];
317  }
318
319  console.log(route);
320
321  TemplateData.current_page = route;
322
323  PreviewTeam = getParameterByName("team");
324
325  if (PreviewTeam) {
326    var team = PreviewTeam;
327  } else {
328    var team = SiteTeam;
329  }
330
331  SetTeam = team;
332
333  var path = BackEndSite + "api/templates/" + team;
334  var senddata = {};
335  ajax_call(path, "GET", senddata, function (data) {
336    TemplateData.pages = data.pages;
337    TemplateData.hba = TemplateData.pages.about_us_association_info.settings.mbrvault_id;
338    console.log(TemplateData.pages);
339    TemplateData.template = data.template;
340    //console.log(TemplateData.pages.about_us);
341    $(document).attr("title", TemplateData.pages.about_us_association_info.settings.site_title);
342    if (
343      TemplateData.pages.about_us_association_info.settings.google_tracking_id &&
344      typeof ga === 'function'
345    ) {
346      ga(
347        "create",
348        TemplateData.pages.about_us_association_info.settings.google_tracking_id,
349        "auto"
350      );
351      ga("send", "pageview");
352    }
353    route_check = route.split('/');
354    var route_page_tag = route;
355    if (route_check[0] == TemplateData.pages.about_us_association_info.directory_page && route_check.length == 3) {
356      console.log('this is the directory page');
357      route = route_check[0];
358      TemplateData.current_page = 'directory_contractor';
359      TemplateData.directory_page = true;
360      TemplateData.full_directory_route = route_check;
361    } else {
362      TemplateData.directory_page = false;
363      if (typeof route_check[1] !== "undefined") {
364        console.log("route 2");
365        console.log(route_check[1]);
366        route_page_tag = TemplateData.pages[route_check[0]].sub_pages[route_check[1]].page_display_name;
367      } else {
368        console.log('test');
369        console.log(TemplateData.pages);
370        var newRoute = route_check[0];
371        if (!newRoute) {
372          newRoute = 'home';
373        }
374        console.log(newRoute);
375        console.log(TemplateData.pages[newRoute]);
376        route_page_tag = TemplateData.pages[newRoute].page_display_name;
377      }
378    }
379
380    console.log('route_page_tag');
381    console.log(route_page_tag);
382
383    var path = BackEndSite + "api/getads/" + team + "/";
384    var senddata = { page_tags: route, route_page_tags: route_page_tag };
385    ajax_call(path, "GET", senddata, function (data) {
386      TemplateData.ads.header = data.header;
387      TemplateData.ads.square = data.square;
388      if (TemplateData.ads.square.length == 0) {
389        $(".main-row").removeClass("ad-adjust");
390      } else {
391        $(".main-row").addClass("ad-adjust");
392        $(".ad-block").fadeIn();
393      }
394      TemplateData.ads.footer = data.footer;
395    });
396
397    vue_int();
398  });
399  $(".btn-gui-control").remove();
400  window.setInterval(rotate_ads, 7000);
401});
402
403var current_square = 0;
404var current_header = 0;
405var current_footer = 0;
406
407function rotate_ads() {
408  //rotate square ads:
409  $(".square_ad").addClass("square_hide");
410  var i = 0;
411  while (i < 3) {
412    if ($("#square_" + current_square).length) {
413      $("#square_" + current_square).removeClass("square_hide");
414    } else {
415      current_square = 0;
416      $("#square_" + current_square).removeClass("square_hide");
417    }
418    i++;
419    current_square++;
420  }
421
422  current_header++;
423  $(".header_ad").addClass("header_hide");
424  if ($("#header_" + current_header).length) {
425    $("#header_" + current_header).removeClass("header_hide");
426  } else {
427    current_header = 0;
428    $("#header_" + current_header).removeClass("header_hide");
429  }
430
431  current_footer++;
432  $(".footer_ad").addClass("footer_hide");
433  if ($("#footer_" + current_footer).length) {
434    $("#footer_" + current_footer).removeClass("footer_hide");
435  } else {
436    current_footer = 0;
437    $("#footer_" + current_footer).removeClass("footer_hide");
438  }
439}
440
441function ajax_call(path, type, data, functionReturn) {
442  $.ajax({
443    type: type,
444    url: path,
445    data: data,
446    dataType: "json",
447    success: function (data) {
448      if (functionReturn) {
449        functionReturn(data);
450      }
451    },
452    error: function (xhr, textStatus, errorThrown) {
453      console.log(xhr);
454      console.log(textStatus);
455      console.log(errorThrown);
456    }
457  });
458}
459
460$(window).bind("hashchange", function () {
461  $(".navbar-collapse").removeClass("in");
462  $(".ad-block").hide();
463  $(".fade_page").fadeOut(function () {
464    var route = window.location.hash;
465    console.log(route);
466    if (!route) {
467      route = "home";
468    } else {
469      route = window.location.hash.split("#/")[1];
470      if (!route) {
471        route = "home";
472      }
473    }
474
475    var orginroute = route;
476
477    route = route.split("/");
478    console.log("the route:");
479    var route_page_tag = orginroute;
480    if (route[0] == TemplateData.pages.about_us_association_info.directory_page && route.length == 3) {
481      console.log('this is the directory page');
482      TemplateData.full_directory_route = route;
483      route = route_check[0];
484      TemplateData.current_page = 'directory_contractor';
485      TemplateData.directory_page = true;
486    } else {
487      TemplateData.directory_page = false;
488      if (typeof route[1] !== "undefined") {
489        console.log("route 2");
490        console.log(route[1]);
491        TemplateData.current_page = orginroute;
492        TemplateData.current_page_contents.html = TemplateData.pages[route[0]].sub_pages[route[1]].page_info;
493        route_page_tag = TemplateData.pages[route[0]].sub_pages[route[1]].page_display_name;
494      } else {
495        TemplateData.current_page = route[0];
496        TemplateData.current_page_contents.html = TemplateData.pages[route[0]].page_info;
497        route_page_tag = TemplateData.pages[route[0]].page_display_name;
498      }
499    }
500
501    var path = BackEndSite + "api/getads/" + SetTeam + "/";
502    var senddata = { page_tags: orginroute, route_page_tags: route_page_tag };
503    ajax_call(path, "GET", senddata, function (data) {
504      TemplateData.ads.header = data.header;
505      TemplateData.ads.square = data.square;
506      TemplateData.ads.footer = data.footer;
507      if (TemplateData.ads.square.length == 0) {
508        $(".main-row").removeClass("ad-adjust");
509      } else {
510        $(".main-row").addClass("ad-adjust");
511        $(".ad-block").fadeIn();
512      }
513    });
514    $(".fade_page").fadeIn();
515  });
516  $(".btn-gui-control").remove();
517});
518
519function getParameterByName(name, url) {
520  if (!url) {
521    url = window.location.href;
522  }
523  name = name.replace(/[\[\]]/g, "\\$&");
524  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
525    results = regex.exec(url);
526  if (!results) return null;
527  if (!results[2]) return "";
528  return decodeURIComponent(results[2].replace(/\+/g, " "));
529}

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.