1var SITE = SITE || {}; 2 3SITE.getWeather = function (city) { 4 return jQuery.ajax({ 5 url: '/wp-json/endless/v1/weather/' + city, 6 type: 'GET', 7 dataType: 'json' 8 }); 9}; 10 11(function ($) { 12 $('.selectCity').on('click', function (e) { 13 e.preventDefault(); 14 15 var $this = $(this).children('input'); 16 var promise = SITE.getWeather($this.val()); 17 var $selectedCityText = $(this).find('div').text(); 18 19 promise.done(function (result) { 20 changeTextValuesToSelectedCityTextValues( 21 result, 22 $this.closest('.weatherPage').find('#left-area .weather .col-3'), 23 $selectedCityText, 24 ); 25 }); 26 }); 27 28 function changeTextValuesToSelectedCityTextValues(result, $container, $selectedCityText) { 29 var currentWeather = result['current']; 30 var weatherForecast = result['forecast']; 31 32 $('#left-area .weatherTitle .selectedCity').text($selectedCityText); 33 34 $container 35 .find('.actual .actualTemperature.icon') 36 .attr("src", currentWeather['icon']); 37 38 $container 39 .find('.actual .actualTemperature.max') 40 .text(addDegreeToTemerature(currentWeather['temperature'])); 41 42 $container 43 .find('.actual .actualTemperature.min') 44 .text(addDegreeToTemerature(currentWeather['temperature'])); 45 46 $container 47 .find('.actual .actualTemperature.rain') 48 .text(addMmToRain(currentWeather['rain'])); 49 50 $container 51 .find('.actual .actualTemperature.wind') 52 .text(addKmhToWind(currentWeather['wind'])); 53 54 for (i = 1; i <= weatherForecast.length; i++) { 55 var index = i - 1; 56 var $day = $('.day-' + i); 57 58 $day 59 .find('.actualTemperature.icon') 60 .attr("src", weatherForecast[index]['icon']); 61 62 $day 63 .find('.actualTemperature.max') 64 .text(addDegreeToTemerature(weatherForecast[index]['max'])); 65 66 $day 67 .find('.actualTemperature.min') 68 .text(addDegreeToTemerature(weatherForecast[index]['min'])); 69 70 $day 71 .find('.actualTemperature.rain') 72 .text(addMmToRain(weatherForecast[index]['rain'])); 73 74 $day 75 .find('.actualTemperature.wind') 76 .text(addKmhToWind(weatherForecast[index]['wind'])); 77 } 78 } 79 80 function addDegreeToTemerature(temperature) { 81 return String(temperature).concat('°C'); 82 } 83 84 function addMmToRain(temperature) { 85 return String(temperature).concat(' mm'); 86 } 87 88 function addKmhToWind(temperature) { 89 return String(temperature).concat(' km/h'); 90 } 91})(jQuery); 92 93(function (window, document, undefined) { 94 "use strict"; 95 var $ = window.jQuery, 96 console = window.console || { 97 log: function () { 98 } 99 }, 100 conf = {}, 101 fdbckForm = $("#fdbck-footer-form"), 102 fdbckSuggest = $("#fdbck-footer-suggestion"), 103 fdbckName = $("#fdbck-footer-name"), 104 fdbckMail = $("#fdbck-footer-mail"), 105 fdbckReveal = $("#fdbck-footer-form .show-on-click"), 106 fdbckSubmit = $("#fdbck-footer-submit "), 107 fdbckMsg = $("#fdbck-footer-msg"), 108 fdbckBottom = $("#fdbck-footer-bottom"); 109 110 function init() { 111 if (fdbckForm.length < 1) { 112 return; 113 } 114 initConfig(); 115 assignEventHandlers(); 116 fdbckMsg.hide(); 117 } 118 119 function initConfig() { 120 var footerConfig = $("#fdbck-footer-form script[type='application/json']"); 121 conf = $.parseJSON(footerConfig.html()); 122 } 123 124 function assignEventHandlers() { 125 fdbckSuggest.bind("focus", revealForm); 126 fdbckSubmit.bind("click", submitForm); 127 } 128 129 function revealForm() { 130 if (!fdbckSuggest.hasClass("expanded")) { 131 fdbckMsg.hide(); 132 fdbckSuggest.addClass("expanded"); 133 fdbckReveal.show("fast", function () { 134 $('html, body').animate({ 135 scrollTop: fdbckBottom.offset().top 136 }, 500); 137 }); 138 } 139 } 140 141 function hideForm() { 142 fdbckSuggest.removeClass("expanded"); 143 fdbckReveal.hide(); 144 resetForm(); 145 } 146 147 function resetForm() { 148 fdbckSuggest.val(""); 149 fdbckName.val(""); 150 fdbckMail.val(""); 151 } 152
153 function submitForm() { 154 var messages = new Array(); 155 var valid = true; 156 fdbckMsg.hide(); 157 if (0 === $.trim(fdbckSuggest.val()).length) { 158 valid = false; 159 messages.push(conf.localization.errors.suggestionEmpty); 160 } 161 if (0 === $.trim(fdbckName.val()).length) { 162 valid = false; 163 messages.push(conf.localization.errors.nameEmpty); 164 } 165 if (0 === $.trim(fdbckMail.val()).length) { 166 valid = false; 167 messages.push(conf.localization.errors.mailEmpty); 168 } 169 if (!valid) { 170 msg("error", messages); 171 return; 172 } 173 var data = { 174 'action': 'feedback_footer_email', 175 'ffname': fdbckName.val(), 176 'ffmailaddress': fdbckMail.val(), 177 'feedback-reason': fdbckSuggest.val(), 178 }; 179 $.ajax({ 180 url: "/ajax-call.php", 181 type: "post", 182 data: data 183 }).then(function (response) { 184 messages.push(response); 185 msg("success", messages); 186 hideForm(); 187 }, function () { 188 messages.push(conf.localization.errors.general); 189 msg("error", messages); 190 }); 191 } 192 193 function msg(type, messages) { 194 fdbckMsg.html(""); 195 if (type === "error") { 196 fdbckMsg.addClass("error"); 197 } else { 198 fdbckMsg.removeClass("error"); 199 } 200 for (var m = 0; m < messages.length; m++) { 201 if (m > 0) { 202 fdbckMsg.html(fdbckMsg.html() + "<br />" + messages[m]); 203 } else { 204 fdbckMsg.html(fdbckMsg.html() + messages[m]); 205 } 206 } 207 fdbckMsg.show(); 208 } 209 210 $(document).ready(function () { 211 init(); 212 }); 213 } 214)(window, document); 215 216// Header Scroll Height Change 217var headerScrollHeightChange = function () { 218 var headerElement = document.querySelector('#main-header'); 219 220 document.addEventListener('scroll', e => { 221 var bodyScrollPosY = window.pageYOffset || document.body.scrollTop; 222 223 if (bodyScrollPosY === 0) { 224 headerElement.classList.add('stuck'); 225 } else { 226 headerElement.classList.remove('stuck'); 227 } 228 }); 229}; 230 231headerScrollHeightChange(); 232 233(function ($) { 234 $('.fbShareButton').on('click', function (e) { 235 e.preventDefault(); 236 var $this = $(this); 237 var leftPosition = (window.screen.width / 2); 238 var topPosition = (window.screen.height / 2) - ((450 / 2) + 400); 239 var windowFeatures = "status=no,height=" + 450 + ",width=" + 550 + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no"; 240 window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent($this.data('href')) + '&t=' + encodeURIComponent($this.data('shareTitle')), 'sharer', windowFeatures); 241 }); 242 243 (function(d, s, id) { 244 var js, fjs = d.getElementsByTagName(s)[0]; 245 if (d.getElementById(id)) return; 246 js = d.createElement(s); js.id = id; 247 js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5"; 248 fjs.parentNode.insertBefore(js, fjs); 249 }(document, 'script', 'facebook-jssdk')); 250 251 $('.shareFbMessenger').on('click', function (e) { 252 e.preventDefault(); 253 var url = encodeURIComponent($(this).find('fbShareMessageButton').data('href')); 254 255 FB.ui({ 256 method: 'send', 257 link: url, 258 }); 259 }); 260 261 window.twttr = (function (d, s, id) { 262 var js, fjs = d.getElementsByTagName(s)[0], 263 t = window.twttr || {}; 264 if (d.getElementById(id)) return t; 265 js = d.createElement(s); 266 js.id = id; 267 js.src = "https://platform.twitter.com/widgets.js"; 268 fjs.parentNode.insertBefore(js, fjs); 269 270 t._e = []; 271 t.ready = function (f) { 272 t._e.push(f); 273 }; 274 return t; 275 }(document, "script", "twitter-wjs")); 276 277 $('.email').on('click', function (e) { 278 e.stopPropagation(); 279 $('#mailto-pop').show(); 280 }); 281 282 $('.pop-form-close').on('click', function (e) { 283 e.stopPropagation(); 284 $('#mailto-pop').hide(); 285 }); 286 287 var gdprStorageKey = 'gdprDeny'; 288 var $gdprBox = $('.gdprBoxContainer'); 289 var gdprStorageKeyDenyValue = '1'; 290 var openClass = 'open'; 291 var gdprStorageKeyAccepted = 'gdprAccepted'; 292 var gdprStorageKeyAcceptValue = '1'; 293 294 if (localStorage.getItem(gdprStorageKey) !== gdprStorageKeyDenyValue && localStorage.getItem(gdprStorageKeyAccepted) !== gdprStorageKeyAcceptValue) { 295 $gdprBox.addClass(openClass); 296 } 297 298 $gdprBox.find('.cancelButton').on('click', function () { 299 localStorage.setItem(gdprStorageKey, gdprStorageKeyDenyValue); 300 $gdprBox.removeClass(openClass); 301 }); 302 303})(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.