PageSourceSearch

https://dimmitcounty.org/_assets_/js/scripts.js

js dimmitcounty.org collected 2026-09-25 05:11:46 UTC 15,956 bytes, 535 lines download raw bytes

1/*-----------------------------------------------------------------------------------
2
3	Theme Name: Dimmit, TX
4	Front-end developer: Omar Baig
5	Author Design: Jade Wang
6	Author URI: http://www.revize.com/
7	Date: 1/18/2021
8
9-----------------------------------------------------------------------------------*/
10
11(function ($) {
12  "use strict";
13
14  var $window = $(window),
15    $body = $("body");
16
17  /*!
18   * IE10 viewport hack for Surface/desktop Windows 8 bug
19   * Copyright 2014-2015 Twitter, Inc.
20   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
21   */
22
23  // See the Getting Started docs for more information:
24  // http://getbootstrap.com/getting-started/#support-ie10-width
25  if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
26    var msViewportStyle = document.createElement("style");
27    msViewportStyle.appendChild(
28      document.createTextNode("@-ms-viewport{width:auto!important}")
29    );
30    document.querySelector("head").appendChild(msViewportStyle);
31  }
32
33  /*
34   * E-Notify Auto submit
35   */
36  $.urlParam = function (n) {
37    var e = new RegExp("[?&]" + n + "=([^]*)").exec(window.location.href);
38    return null == e ? null : e[1] || 0;
39  };
40  var $enotify = $('iframe[src*="/revize/plugins/notify/notify.jsp"]');
41  if ($enotify.length > 0) {
42    var emailStr = $.urlParam("email");
43    if (emailStr != null) {
44      $enotify.attr("src", $enotify.attr("src") + "&email=" + emailStr);
45    }
46  }
47
48  // RZ Class
49  if (typeof RZ !== "undefined") {
50    if (RZ.login) {
51      $body.addClass("user-logged-in");
52    } else {
53      $body.addClass("user-not-logged-in");
54    }
55  }
56
57  // Search Toggle
58  $("#search-toggle").on("click", function (e) {
59    $("#search").stop().slideToggle(200);
60    $(this).toggleClass("fa-search fa-close");
61  });
62
63  // Search Toggle
64  $("#search-toggle-desktop").on("click", function (e) {
65    $("#search").stop().slideToggle(200);
66  });
67
68  // Navigation Toggle
69  $("#nav-toggle").on("click", function () {
70    $("#nav").stop().slideToggle();
71    $(this).toggleClass("active");
72  });
73
74  // Menu Arrows and Toggles
75  $("#nav >li>ul,#flyout >li>ul").addClass("first-level");
76  $("#nav  li ul ul").addClass("second-level");
77  $("#nav>li:has(ul)").each(function () {
78    $(
79      '<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="dropdown-toggle-' +
80        $(this).index() +
81        '" aria-label="Show Dropdown for ' +
82        $(this).find("a:first").text() +
83        '"></a>'
84    ).insertAfter($(this).find("a:first"));
85    $(this)
86      .find("ul:first")
87      .attr("aria-labelledby", "dropdown-toggle-" + $(this).index());
88  });
89  $("#nav li ul>li:has(ul)").each(function (index) {
90    $(
91      '<a href="#" class="fa fa-angle-down toggle2" tabindex="0" aria-haspopup="true" aria-expanded="false" id="sub-dropdown-toggle-' +
92        index +
93        '" aria-label="Show Dropdown for ' +
94        $(this).find("a:first").text() +
95        '"></a>'
96    ).insertAfter($(this).find("a:first"));
97    $(this)
98      .find("ul:first")
99      .attr("aria-labelledby", "sub-dropdown-toggle-" + index);
100  });
101  $("#flyout >li:has(ul)").each(function () {
102    $(
103      '<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="flyout-dropdown-toggle-' +
104        $(this).index() +
105        '" aria-label="Show Flyout for ' +
106        $(this).find("a:first").text() +
107        '"></a>'
108    ).insertAfter($(this).find("a:first"));
109    $(this)
110      .find("ul:first")
111      .attr("aria-labelledby", "flyout-dropdown-toggle-" + $(this).index());
112  });
113
114  function addNavClass() {
115    if ($window.width() < 992) {
116      // Insert needed for mobile
117    } else {
118      // Insert needed for desktop
119      $("#nav ul, #flyout ul").css("display", "");
120    }
121  }
122  addNavClass();
123  $window.resize(addNavClass);
124
125  $(".toggle").on("click keydown", function (e) {
126    if (e.keyCode === 13 || e.type === "click") {
127      e.preventDefault();
128      var $parent = $(this).parent();
129      var $parentLi = $parent.parent();
130      $parent.toggleClass("opened");
131      if (
132        $parent.addClass("active") &&
133        $(this).next(".first-level").is(":visible")
134      ) {
135        $(this).next(".first-level").slideUp();
136        $parent.removeClass("active");
137        $(this).attr({ "aria-expanded": "false" });
138      } else {
139        $(this).attr({ "aria-expanded": "true" });
140        $(".first-level").slideUp("slow");
141        $parent.addClass("active");
142        $(this).next(".first-level").slideToggle();
143      }
144    }
145  });
146  $(".toggle2").on("click keydown", function (e) {
147    if (e.keyCode === 13 || e.type === "click") {
148      e.preventDefault();
149      var $parent = $(this).parent();
150      var $parentLi = $parent.parent();
151      $parent.toggleClass("opened2");
152      if (
153        $parent.addClass("active") &&
154        $(this).next(".second-level").is(":visible")
155      ) {
156        $(this).next(".second-level").slideUp();
157        $parent.removeClass("active");
158        $(this).attr({ "aria-expanded": "false" });
159      } else {
160        $(this).attr({ "aria-expanded": "true" });
161        $(".second-level").slideUp("slow");
162        $parent.addClass("active");
163        $(this).next(".second-level").slideToggle();
164      }
165    }
166  });
167
168  // Flyout
169  var flyout = $("#flyout"),
170    flyoutwrap = $("#flyout-wrap");
171
172  if (flyout.text().length) {
173    flyoutwrap.prepend(
174      '<div id="flyout-toggle"><i class="fa fa-bars"></i> Sub Menu</div>'
175    );
176  }
177
178  $("#flyout-toggle").on("click", function () {
179    flyout.slideToggle();
180    $(this).toggleClass("active");
181  });
182
183  $("#flyout ul").addClass("flyout-children");
184
185  var flyoutChildren = $(".flyout-children");
186
187  // Make sure all calendars have unique ids
188  $('iframe[name="calendar"]').each(function (index, calendar) {
189    calendar.id = "calendar-" + index;
190  });
191
192  // Start Frame Resizer
193  function resizeIframe(height, frameElement) {
194    if (frameElement) {
195      frameElement.height = "";
196      frameElement.height = height;
197    }
198    console.log(frameElement.id + " Height to: " + height);
199  }
200
201  var eventMethod = window.addEventListener
202    ? "addEventListener"
203    : "attachEvent";
204  var eventHandler = window[eventMethod];
205  var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
206  eventHandler(messageEvent, function (e) {
207    if (Array.isArray(e.data)) {
208      if (e.data[0] === "setCalHeight" || e.data[0] === "setNotifyHeight") {
209        resizeIframe(e.data[1], e.source.frameElement);
210      }
211    }
212  });
213  // End Frame Resizer
214
215  function fillSide() {
216    var whiteSpace = parseFloat($("#main .container").css("margin-right")) + 15;
217    $(".fillLeft").css("margin-left", -whiteSpace);
218    $(".fillLeft.withPadding").css("padding-left", whiteSpace);
219    $(".fillRight").css("margin-right", -whiteSpace);
220    $(".fillRight.withPadding").css("padding-right", whiteSpace);
221  }
222  fillSide();
223  $window.resize(fillSide);
224
225  var $translateButton = $("#translate-button, #translate-button-footer");
226  $translateButton.on("keydown click", function (e) {
227    if (e.keyCode === 13 || e.type === "click") {
228      $("#translation-links ul").stop().fadeToggle();
229      $translateButton.attr(
230        "aria-expanded",
231        !("true" === $translateButton.attr("aria-expanded"))
232      );
233    }
234  });
235
236  $("#translation-links ul,#footer #translation-links ul").on(
237    "mouseleave",
238    function () {
239      $(this).fadeOut();
240      $translateButton.attr("aria-expanded", false);
241    }
242  );
243
244  var translateURL =
245    "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
246
247  // Translate Script
248  $.getScript(translateURL);
249  $("#translation-links a").click(function () {
250    var lang = $(this).data("lang");
251    var $frame = $(".goog-te-menu-frame:first");
252    if (!$frame.size()) {
253      return false;
254    }
255    $frame
256      .contents()
257      .find(".goog-te-menu2-item span.text:contains(" + lang + ")")
258      .get(0)
259      .click();
260    return false;
261  });
262
263  // revizeWeather
264  if (typeof $.fn.revizeWeather !== "undefined") {
265    $.fn.revizeWeather({
266      zip: "78834",
267      city_name: "",
268      unit: "f",
269      success: function (weather) {
270        var date = new Date();
271        date =
272          date.getMonth() + 1 + "/" + date.getDate() + "/" + date.getFullYear();
273        var html =
274          '<i class="' +
275          weather.icon +
276          '"></i> <span class="forecast">' +
277          weather.temp +
278          "&deg; " +
279          "</span>";
280        html += weather.forecast;
281
282        $("#weather").html(html);
283      },
284      error: function (error) {
285        // better to just hide the secion if there is an error
286        $(".weather").hide();
287        console.log(error);
288      },
289    });
290  }
291
292  // bxSlider
293  if (typeof $.fn.bxSlider !== "undefined") {
294    $(".bxslider").bxSlider({
295      mode: "fade",
296      auto: $(".bxslider").children().length < 2 ? false : true,
297      pager: true,
298      pageType: "short",
299    });
300  }
301
302  //TNS Slider
303  if ($("#quicklinks").length) {
304    var qLinkCount = $(".quicklink").length,
305      qLinkCarousel = tns({
306        container: "#quicklinks",
307        responsive: {
308          1200: {
309            items: qLinkCount >= 5 ? 5 : qLinkCount,
310          },
311          991: {
312            items: qLinkCount >= 3 ? 3 : qLinkCount,
313          },
314          600: {
315            items: qLinkCount >= 2 ? 2 : qLinkCount,
316          },
317          0: {
318            items: qLinkCount >= 1 ? 1 : qLinkCount,
319          },
320        },
321        mouseDrag: true,
322        controlsText: [
323          '<img src="_assets_/images/qlink-prev.png">',
324          '<img src="_assets_/images/qlink-next.png">',
325        ],
326        nav: false,
327        gutter: 7,
328        loop: false,
329      });
330  }
331
332  if ($("#news").length) {
333    var newsLinkCount = $(".news").length,
334      newsLinkCarousel = tns({
335        container: "#news",
336        responsive: {
337          600: {
338            items: newsLinkCount >= 2 ? 2 : newsLinkCount,
339          },
340          0: {
341            items: newsLinkCount >= 1 ? 1 : newsLinkCount,
342          },
343        },
344        mouseDrag: true,
345        controlsText: [
346          '<img src="_assets_/images/qlink-prev.png">',
347          '<img src="_assets_/images/qlink-next.png">',
348        ],
349        nav: false,
350        gutter: 55,
351        loop: false,
352      });
353  }
354
355  // Skip to Content
356  $("#skip").click(function (e) {
357    e.preventDefault();
358    $("#main").attr("tabindex", "-1");
359    $("#main").focus();
360    $("#main").removeAttr("tabindex");
361  });
362
363  // Responsive Tables
364  $(".post table:not(.layout-table):not(.not-responsive)").wrap(
365    '<div class="table-responsive"></div>'
366  );
367  $(".layout-table").attr("role", "presentation");
368
369  // Keyboard Navigation: Nav, flyout
370  var isClick = false;
371  $("#nav li a, #flyout  li a, a, button, .toggle, .toggle2").on(
372    "focusin",
373    function (e) {
374      if (isClick === false) {
375        $(".focused").removeClass("focused");
376        $(e.currentTarget).parents("#nav li, #flyout li").addClass("focused");
377        $(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible")
378          .slideUp()
379          .parent()
380          .removeClass("opened opened2");
381      } else {
382        $(".focused").removeClass("focused");
383        isClick = false;
384      }
385    }
386  );
387
388  // prevent focused class changes on click - This way arrows wont pop when clicking nav links
389  $("#nav a,#flyout a").on("mousedown", function () {
390    isClick = true;
391  });
392
393  $window.ready(function () {
394    // matchHeight
395    if (typeof $.fn.matchHeight !== "undefined") {
396      $(".equal").matchHeight({
397        //defaults
398        byRow: true,
399        property: "height", // height or min-height
400        target: null,
401        remove: false,
402      });
403    }
404
405    // Animations http://www.oxygenna.com/tutorials/scroll-animations-using-waypoints-js-animate-css
406    function onScrollInit(items, trigger) {
407      items.each(function () {
408        var osElement = $(this),
409          osAnimationClass = osElement.data("os-animation"),
410          osAnimationDelay = osElement.data("os-animation-delay");
411
412        osElement.css({
413          "-moz-animation-delay": osAnimationDelay,
414          "animation-delay": osAnimationDelay,
415          "-webkit-animation-delay": osAnimationDelay,
416        });
417
418        var osTrigger = trigger ? trigger : osElement;
419
420        if (typeof $.fn.waypoint !== "undefined") {
421          osTrigger.waypoint(
422            function () {
423              osElement.addClass("animated").addClass(osAnimationClass);
424            },
425            {
426              triggerOnce: true,
427              offset: "100%",
428            }
429          );
430        }
431      });
432    }
433    onScrollInit($(".os-animation"));
434
435    //#Smooth Scrolling
436    $('a[href*=#]:not([href=#],[href*="#collapse"])').click(function () {
437      if (
438        location.pathname.replace(/^\//, "") ===
439          this.pathname.replace(/^\//, "") &&
440        location.hostname === this.hostname
441      ) {
442        var target = $(this.hash);
443        target = target.length
444          ? target
445          : $("[name=" + this.hash.slice(1) + "]");
446        if (target.length) {
447          $("html,body").animate(
448            {
449              scrollTop: target.offset().top,
450            },
451            1000
452          );
453          return false;
454        }
455      }
456    });
457
458    /*global jQuery */
459    /*!
460     * FlexVerticalCenter.js 1.0
461     *
462     * Copyright 2011, Paul Sprangers http://paulsprangers.com
463     * Released under the WTFPL license
464     * http://sam.zoy.org/wtfpl/
465     *
466     * Date: Fri Oct 28 19:12:00 2011 +0100
467     */
468    $.fn.flexVerticalCenter = function (options) {
469      var settings = $.extend(
470        {
471          cssAttribute: "margin-top", // the attribute to apply the calculated value to
472          verticalOffset: 0, // the number of pixels to offset the vertical alignment by
473          parentSelector: null, // a selector representing the parent to vertically center this element within
474          debounceTimeout: 25, // a default debounce timeout in milliseconds
475          deferTilWindowLoad: false, // if true, nothing will take effect until the $(window).load event
476        },
477        options || {}
478      );
479
480      return this.each(function () {
481        var $this = $(this); // store the object
482        var debounce;
483
484        // recalculate the distance to the top of the element to keep it centered
485        var resizer = function () {
486          var parentHeight =
487            settings.parentSelector &&
488            $this.parents(settings.parentSelector).length
489              ? $this.parents(settings.parentSelector).first().height()
490              : $this.parent().height();
491
492          $this.css(
493            settings.cssAttribute,
494            (parentHeight - $this.height()) / 2 +
495              parseInt(settings.verticalOffset)
496          );
497        };
498
499        // Call on resize. Opera debounces their resize by default.
500        $(window).resize(function () {
501          clearTimeout(debounce);
502          debounce = setTimeout(resizer, settings.debounceTimeout);
503        });
504
505        if (!settings.deferTilWindowLoad) {
506          // call it once, immediately.
507          resizer();
508        }
509
510        // Call again to set after window (frames, images, etc) loads.
511        $(window).load(function () {
512          resizer();
513        });
514      });
515    };
516    $(".v-align").flexVerticalCenter();
517
518    // Remove matchHeight on document center pages
519    if ($("#RZdocument_center").length) {
520      $(".aside,.entry").matchHeight({ remove: true });
521
522      if (window.matchMedia("(min-width: 992px)").matches) {
523        setInterval(function () {
524          if ($(".post").outerHeight() + 300 > $(".entry").outerHeight()) {
525            $(".aside").css("height", $(".entry").outerHeight() + "px");
526          }
527        }, 200);
528      }
529    }
530
531    if ($("#freeform #breadcrumbs")) {
532      $("#breadcrumbs ul li a").first().text("County of Dimmit Home");
533    }
534  }); // Ready
535})(jQuery);

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.