PageSourceSearch

https://meteo.ro/assets/js/app.js

js meteo.ro collected 2026-10-02 13:40:55 UTC 15,668 bytes, 453 lines download raw bytes

1/*---------------------------------------------"
2// Template Name: WeatherForecast
3// Description:  WeatherForecast Html Template
4// Version: 1.0.0
5
6--------------------------------------------*/
7(function (window, document, $, undefined) {
8  "use strict";
9
10  var MyScroll = "";
11  var Init = {
12    i: function (e) {
13      Init.s();
14      Init.methods();
15    },
16    s: function (e) {
17      (this._window = $(window)),
18        (this._document = $(document)),
19        (this._body = $("body")),
20        (this._html = $("html"));
21    },
22    methods: function (e) {
23      Init.w();
24      Init.preloader();
25      Init.BackToTop();
26      Init.cusBtn();
27      Init.searchToggle();
28      Init.uiHeader();
29      Init.slick();
30      Init.countdownInit(".countdown", "2026/04/21");
31      Init.chart();
32      Init.toggles();
33      Init.contactForm();
34      Init.magnifying();
35    },
36
37    w: function (e) {
38      this._window.on("load", Init.l).on("scroll", Init.res);
39    },
40
41    // =================
42    // Preloader
43    // =================
44    preloader: function () {
45      setTimeout(function () {
46        $("#preloader_auto").hide("slow");
47      }, 0);
48    },
49
50    // =======================
51    //  Button Style
52    // =======================
53    cusBtn: function () {
54      $(".cus-btn")
55        .on("mouseenter", function (e) {
56          var parentOffset = $(this).offset(),
57            relX = e.pageX - parentOffset.left,
58            relY = e.pageY - parentOffset.top;
59          $(this).find("span").css({ top: relY, left: relX });
60        })
61        .on("mouseout", function (e) {
62          var parentOffset = $(this).offset(),
63            relX = e.pageX - parentOffset.left,
64            relY = e.pageY - parentOffset.top;
65          $(this).find("span").css({ top: relY, left: relX });
66        });
67    },
68
69    // =================
70    // Bak to top
71    // =================
72    BackToTop: function () {
73      let scrollTop = $(".scroll-top path");
74      if (scrollTop.length) {
75        var e = document.querySelector(".scroll-top path"),
76          t = e.getTotalLength();
77        (e.style.transition = e.style.WebkitTransition = "none"),
78          (e.style.strokeDasharray = t + " " + t),
79          (e.style.strokeDashoffset = t),
80          e.getBoundingClientRect(),
81          (e.style.transition = e.style.WebkitTransition =
82            "stroke-dashoffset 10ms linear");
83        var o = function () {
84          var o = $(window).scrollTop(),
85            r = $(document).height() - $(window).height(),
86            i = t - (o * t) / r;
87          e.style.strokeDashoffset = i;
88        };
89        o(), $(window).scroll(o);
90        var back = $(".scroll-top"),
91          body = $("body, html");
92        $(window).on("scroll", function () {
93          if ($(window).scrollTop() > $(window).height()) {
94            back.addClass("scroll-top--active");
95          } else {
96            back.removeClass("scroll-top--active");
97          }
98        });
99      }
100    },
101
102    // =======================
103    //  UI Header
104    // =======================
105    uiHeader: function () {
106      function dynamicCurrentMenuClass(selector) {
107        let FileName = window.location.href.split("/").reverse()[0];
108
109        selector.find("li").each(function () {
110          let anchor = $(this).find("a");
111          if ($(anchor).attr("href") == FileName) {
112            $(this).addClass("current");
113          }
114        });
115        selector.children("li").each(function () {
116          if ($(this).find(".current").length) {
117            $(this).addClass("current");
118          }
119        });
120        if ("" == FileName) {
121          selector.find("li").eq(0).addClass("current");
122        }
123      }
124
125      if ($(".main-menu__list").length) {
126        let mainNavUL = $(".main-menu__list");
127        dynamicCurrentMenuClass(mainNavUL);
128      }
129
130      if ($(".main-menu__nav").length && $(".sidebar-nav__container").length) {
131        let navContent = document.querySelector(".main-menu__nav").innerHTML;
132        let mobileNavContainer = document.querySelector(".sidebar-nav__container");
133        mobileNavContainer.innerHTML = navContent;
134      }
135      if ($(".sticky-header__content").length) {
136        let navContent = document.querySelector(".main-menu").innerHTML;
137        let mobileNavContainer = document.querySelector(".sticky-header__content");
138        mobileNavContainer.innerHTML = navContent;
139      }
140
141      if ($(".sidebar-nav__container .main-menu__list").length) {
142        let dropdownAnchor = $(
143          ".sidebar-nav__container .main-menu__list .dropdown > a"
144        );
145        dropdownAnchor.each(function () {
146          let self = $(this);
147          let toggleBtn = document.createElement("BUTTON");
148          toggleBtn.setAttribute("aria-label", "dropdown toggler");
149          toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>";
150          self.append(function () {
151            return toggleBtn;
152          });
153          self.find("button").on("click", function (e) {
154            e.preventDefault();
155            let self = $(this);
156            self.toggleClass("expanded");
157            self.parent().toggleClass("expanded");
158            self.parent().parent().children("ul").slideToggle();
159          });
160        });
161      }
162
163      if ($(".sidebar-nav__toggler").length) {
164        $(".sidebar-nav__toggler").on("click", function (e) {
165          e.preventDefault();
166          $(".sidebar-nav__wrapper").toggleClass("expanded");
167          $("body").toggleClass("locked");
168        });
169      }
170
171      $(window).on("scroll", function () {
172        if ($(".stricked-menu").length) {
173          var headerScrollPos = 130;
174          var stricky = $(".stricked-menu");
175          if ($(window).scrollTop() > headerScrollPos) {
176            stricky.addClass("stricky-fixed");
177          } else if ($(this).scrollTop() <= headerScrollPos) {
178            stricky.removeClass("stricky-fixed");
179          }
180        }
181      });
182    },
183
184    // =======================
185    //  Contact Form
186    // =======================
187    contactForm: function () {
188      $(".contact-form").on("submit", function (e) {
189        e.preventDefault();
190        if ($(".contact-form")) {
191          var _self = $(this);
192          _self
193            .closest("div")
194            .find('button[type="submit"]')
195            .attr("disabled", "disabled");
196          var data = $(this).serialize();
197          $.ajax({
198            url: "./assets/mail/contact.php",
199            type: "post",
200            dataType: "json",
201            data: data,
202            success: function (data) {
203              $(".contact-form").trigger("reset");
204              _self.find('button[type="submit"]').removeAttr("disabled");
205              if (data.success) {
206                document.getElementById("message").innerHTML =
207                  "<h5 class='color-primary'>Email Sent Successfully</h5>";
208              } else {
209                document.getElementById("message").innerHTML =
210                  "<h5 class='text-danger'>There is an error</h5>";
211              }
212              $("#message").show("slow");
213              $("#message").slideDown("slow");
214              setTimeout(function () {
215                $("#message").slideUp("hide");
216                $("#message").hide("slow");
217              }, 3000);
218            },
219          });
220        } else {
221          return false;
222        }
223      });
224    },
225
226    // =======================
227    //  Slick Slider
228    // =======================
229    slick: function () {
230      if ($(".weekly-forecast-carousel").length) {
231        $('.weekly-forecast-carousel').slick({
232          slidesToShow: 3,
233          slidesToScroll: 1,
234          infinite: true,
235          autoplay: true,
236          dots: false,
237          arrows: true,
238          lazyLoad: 'progressive',
239          autoplaySpeed: 4000,
240          speed: 2000,
241          responsive: [
242            {
243              breakpoint: 1399,
244              settings: {
245                slidesToShow: 3,
246              },
247            },
248            {
249              breakpoint: 991,
250              settings: {
251                slidesToShow: 3,
252              },
253            },
254            {
255              breakpoint: 575,
256              settings: {
257                slidesToShow: 2,
258              },
259            },
260          ],
261        });
262      }
263    },
264
265    // =======================
266    //  Search Function
267    // =======================
268    searchToggle: function () {
269      if ($(".search-toggler").length) {
270        $(".search-toggler").on("click", function (e) {
271          e.preventDefault();
272          $(".search-popup").toggleClass("active");
273          $(".sidebar-nav__wrapper").removeClass("expanded");
274          $("body").toggleClass("locked");
275        });
276      }
277    },
278    // =======================
279    //  Coming Soon Countdown
280    // =======================
281    countdownInit: function (countdownSelector, countdownTime) {
282      var eventCounter = $(countdownSelector);
283      if (eventCounter.length) {
284        eventCounter.countdown(countdownTime, function (e) {
285          $(this).html(
286            e.strftime(
287              '<li><h2>%D</h2><h6>Days</h6></li>\
288              <li><h2>%H</h2><h6>Hrs</h6></li>\
289              <li><h2>%M</h2><h6>Min</h6></li>\
290              <li><h2>%S</h2><h6>Sec</h6></li>'
291            )
292          );
293        });
294      }
295    },
296    // =======================
297    //  Mini Cart
298    // =======================
299    chart: function () {
300      if ($("#chartContainer").length) {
301
302        var allDataPoints = [
303          { label: "02 am", y: [15, 26], name: "rainy" },
304          { label: "03 am", y: [15, 27], name: "rainy" },
305          { label: "04 am", y: [13, 27], name: "sunny" },
306          { label: "05 am", y: [14, 27], name: "sunny" },
307          { label: "06 am", y: [15, 26], name: "cloudy" },
308          { label: "07 am", y: [17, 26], name: "sunny" },
309          { label: "08 am", y: [16, 27], name: "rainy" },
310          { label: "09 am", y: [15, 26], name: "cloudy" },
311          { label: "10 am", y: [17, 26], name: "sunny" },
312          { label: "11 am", y: [16, 27], name: "rainy" },
313          { label: "12 pm", y: [13, 27], name: "sunny" },
314          { label: "01 pm", y: [14, 27], name: "sunny" },
315          { label: "02 pm", y: [15, 26], name: "cloudy" }
316        ];
317  
318        var mediumDataPoints = allDataPoints.slice(0, 10); // First 10 data points for medium screens
319        var smallDataPoints = allDataPoints.slice(0, 7); // First 7 data points for small screens
320  
321        var chart = new CanvasJS.Chart("chartContainer", {
322          theme: "light2",
323          axisY: {
324            suffix: " °C",
325            maximum: 40,
326            gridThickness: 0
327          },
328          toolTip: {
329            shared: true,
330            content: "{name} </br> <strong>Temperature: </strong> </br> Min: {y[0]} °C, Max: {y[1]} °C"
331          },
332          data: [{
333            type: "rangeSplineArea",
334            fillOpacity: 0.1,
335            color: "#91AAB1",
336            indexLabelFormatter: formatter,
337            dataPoints: getDataPoints()
338          }]
339        });
340        chart.render();
341  
342        var images = [];
343  
344        addImages(chart);
345  
346        function getDataPoints() {
347          if (window.innerWidth <= 575) {
348            return smallDataPoints;
349          } else if (window.innerWidth <= 992) {
350            return mediumDataPoints;
351          } else {
352            return allDataPoints;
353          }
354        }
355  
356        function addImages(chart) {
357          for (var i = 0; i < chart.data[0].dataPoints.length; i++) {
358            var dpsName = chart.data[0].dataPoints[i].name;
359            if (dpsName == "cloudy") {
360              images.push($("<img>").attr("src", "https://canvasjs.com/wp-content/uploads/images/gallery/gallery-overview/cloudy.png"));
361            } else if (dpsName == "rainy") {
362              images.push($("<img>").attr("src", "https://canvasjs.com/wp-content/uploads/images/gallery/gallery-overview/rainy.png"));
363            } else if (dpsName == "sunny") {
364              images.push($("<img>").attr("src", "https://canvasjs.com/wp-content/uploads/images/gallery/gallery-overview/sunny.png"));
365            }
366  
367            images[i].attr("class", dpsName).appendTo($("#chartContainer>.canvasjs-chart-container"));
368            positionImage(images[i], i);
369          }
370        }
371  
372        function positionImage(image, index) {
373          var imageCenter = chart.axisX[0].convertValueToPixel(chart.data[0].dataPoints[index].x);
374          var imageTop = chart.axisY[0].convertValueToPixel(chart.axisY[0].maximum);
375  
376          var imageSize = window.innerWidth <= 575 ? "25px" : "40px";
377          var imageLeftOffset = window.innerWidth <= 575 ? 12.5 : 20;
378  
379          image.width(imageSize)
380            .css({
381              "left": imageCenter - imageLeftOffset + "px",
382              "position": "absolute",
383              "top": imageTop + "px"
384            });
385        }
386  
387        $(window).resize(function () {
388          var cloudyCounter = 0, rainyCounter = 0, sunnyCounter = 0;
389          var imageCenter = 0;
390          for (var i = 0; i < chart.data[0].dataPoints.length; i++) {
391            imageCenter = chart.axisX[0].convertValueToPixel(chart.data[0].dataPoints[i].x) - 20;
392            if (chart.data[0].dataPoints[i].name == "cloudy") {
393              $(".cloudy").eq(cloudyCounter++).css({ "left": imageCenter });
394            } else if (chart.data[0].dataPoints[i].name == "rainy") {
395              $(".rainy").eq(rainyCounter++).css({ "left": imageCenter });
396            } else if (chart.data[0].dataPoints[i].name == "sunny") {
397              $(".sunny").eq(sunnyCounter++).css({ "left": imageCenter });
398            }
399          }
400          updateChartData();
401        });
402  
403        function updateChartData() {
404          chart.options.data[0].dataPoints = getDataPoints();
405          chart.render();
406          $(".cloudy, .rainy, .sunny").remove();
407          images = [];
408          addImages(chart);
409        }
410  
411        function formatter(e) {
412          if (e.index === 0 && e.dataPoint.x === 0) {
413            return " Min " + e.dataPoint.y[e.index] + "°";
414          } else if (e.index == 1 && e.dataPoint.x === 0) {
415            return " Max " + e.dataPoint.y[e.index] + "°";
416          } else {
417            return e.dataPoint.y[e.index] + "°";
418          }
419        }
420      }
421    },
422    // =======================
423    //  Toggles
424    // =======================
425    toggles: function () {
426      if ($('.sidebar-widget').length) {
427        $(".widget-title-row").on("click", function (e) {
428          $(this).find('i').toggleClass('fa-horizontal-rule fa-plus', 'slow');
429          // $(this).find('i').toggleClass('fa-light fa-regular', 'slow');
430          $(this).parents('.sidebar-widget').find('.widget-content-block').animate({ height: 'toggle' }, 'slow');
431        })
432      }
433    },
434
435    // =======================
436    // Magnifying Popup
437    // =======================
438    magnifying: function () {
439      if ($('.video-popup').length) {
440        $('.video-popup').magnificPopup({
441          disableOn: 700,
442          type: 'iframe',
443          mainClass: 'mfp-fade',
444          removalDelay: 160,
445          preloader: false,
446          fixedContentPos: false
447        });
448      }
449    }
450  };
451
452  Init.i();
453})(window, document, 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.