From bb6268af7b5f94f3677112310c49bb99f6c36e5f Mon Sep 17 00:00:00 2001 From: Divlo Date: Thu, 29 Aug 2019 12:50:17 +0200 Subject: [PATCH] Revert manually commit weatherRequest execution... --- .gitignore | 2 +- incl/header.php | 1 + scripts/main.js | 25 +++++++++++++++------- views/function-views/weatherRequest.php | 28 ------------------------- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index f5e9c0f..b7b10ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ htaccess -php/apiKey.php \ No newline at end of file +scripts/config.js \ No newline at end of file diff --git a/incl/header.php b/incl/header.php index ee9b6b8..0860397 100644 --- a/incl/header.php +++ b/incl/header.php @@ -32,6 +32,7 @@ + diff --git a/scripts/main.js b/scripts/main.js index 397bf51..abb481a 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -8,7 +8,23 @@ $(function () { /* ÉXECUTION DES FONCTONS */ - // $("#submitWeatherRequest") se fait exécuter dans weatherRequest.php + $( "#submitWeatherRequest" ).click(function() + { + let city = $('#cityName').val(); + let cityName = city.split(' ').join('+'); + if(isEmptyValue(cityName)) + { + $('.results').html(emptyMessageError); + $("#cityName, #submitWeatherRequest").click(function() { + document.location.replace("../function-views/weatherRequest.php"); + }); + } + else + { + let url = "https://api.openweathermap.org/data/2.5/weather?q=" + cityName + "&lang=fr&units=metric&appid=" + config.APIkey + ""; + weatherRequest(url, 'weather'); + } + }); $("#submitRandomNumber").click(function() { @@ -110,13 +126,6 @@ $(function () { /* Window Scroll Top Button */ var $btnScrollTop = $('.scroll-top-arrow'); - $(window).scroll(function () { - if ($(this).scrollTop() > 100) { - $btnScrollTop.fadeIn(); - } else { - $btnScrollTop.fadeOut(); - } - }); $btnScrollTop.on('click', function () { $('html, body').animate({scrollTop: 0}, 800); diff --git a/views/function-views/weatherRequest.php b/views/function-views/weatherRequest.php index 31b93a9..6b160b3 100644 --- a/views/function-views/weatherRequest.php +++ b/views/function-views/weatherRequest.php @@ -22,33 +22,5 @@ - - - - \ No newline at end of file