diff --git a/manifest.json b/manifest.json index 76b3ec2..f7b3d31 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,6 @@ "default_popup": "popup.html" }, "permissions": [ - "activeTab", "geolocation", "topSites" ], diff --git a/package-lock.json b/package-lock.json index 4956e78..261ae73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1892,6 +1892,11 @@ "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" }, + "fontawesome": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/fontawesome/-/fontawesome-5.6.3.tgz", + "integrity": "sha512-FCc+CawwsJWWprVEg9X14yI7zI+l9YVAyhzgu70qwGeDn0tLLDH/dVfqgij72g4BBGgLGfK2qnvFGAmYUkhaWg==" + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", diff --git a/popup.html b/popup.html index ac1d0c6..10d8fcb 100644 --- a/popup.html +++ b/popup.html @@ -2,42 +2,114 @@ - - - - - Earth Weather - + + + + Weather + -
-
- - Location - -
Loading
-
-
-
-
-
-
-
-

-

-
-
-
-
-
+ +
+ +
+ +

Warsaw

+ +

Mon, 12:30 PM, Mostly Sunny

+
+

+ 23°C +

+ +
+ +
+

+ 44:44 am Sunrise +

+

3% Precipitation

+
+ +
+

+ 44:44 am pm Sunset +

+

+ 21 km/h Winds +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tuesday +

24°/12°

+
+ +
Wednesday +

19°/10°

+
+ +
Thursday +

23°/15°

+
+ +
Friday +

26°/19°

+
+ +
Saturday +

20°/16°

+
+ +
Sunday +

22°/13°

+
+ +
+
+ @@ -45,9 +117,9 @@
- - + + - + \ No newline at end of file diff --git a/popupold.html b/popupold.html new file mode 100644 index 0000000..ac1d0c6 --- /dev/null +++ b/popupold.html @@ -0,0 +1,53 @@ + + + + + + + + + Earth Weather + + + + +
+
+ + Location + +
Loading
+
+
+
+
+
+
+
+

+

+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/setimage.js b/src/setimage.js index 6e83761..336309b 100644 --- a/src/setimage.js +++ b/src/setimage.js @@ -1,12 +1,19 @@ function setImage(dateDirection) { try { - ymd = positionDate.getFullYear() + "-" + (positionDate.getMonth() + 1) + "-" + positionDate.getDate(); - // alert(APIUrl + ymd + key); - fetch(APIUrl + ymd + key) - .then((response) => response.json()) - .then((data) => addBackGround(data, dateDirection)); + currDate = new Date() + if (positionDate > currDate) { + positionDate.setDate(positionDate.getDate() - 1); + setImage(-1); + } else { + ymd = positionDate.getFullYear() + "-" + (positionDate.getMonth() + 1) + "-" + positionDate.getDate(); + console.log(APIUrl + ymd + key); + fetch(APIUrl + ymd + key) + .then((response) => response.json()) + .then((data) => addBackGround(data, dateDirection)); + } } catch { - if (positionDate >= new Date()) { + currDate = new Date() + if (positionDate > currDate) { positionDate.setDate(positionDate.getDate() - 1); setImage(-1); } else { @@ -106,7 +113,7 @@ document.getElementById("right").addEventListener("click", function (e) { } }); -document.addEventListener("keydown", function (event) { +document.addEventListener("keyup", function (event) { const key = event.key; switch (key) { case "ArrowRight": @@ -115,7 +122,6 @@ document.addEventListener("keydown", function (event) { currDate = new Date(); if (positionDate > currDate) { positionDate.setDate(positionDate.getDate() - 1); - break; } else { if (positionDate.getFullYear() == currDate.getFullYear() && positionDate.getMonth() == currDate.getMonth() && @@ -123,8 +129,8 @@ document.addEventListener("keydown", function (event) { document.getElementById("right").style.visibility = "hidden"; } setImage(dateDirection); - break; } + break; case "ArrowLeft": document.getElementById("right").style.visibility = "visible"; dateDirection = -1;