From 61b07208a8a7f36a6a40139b399bf2c2dc786f18 Mon Sep 17 00:00:00 2001 From: Mario Garrido Date: Fri, 3 Feb 2023 11:28:08 +0000 Subject: [PATCH] fix file formatting --- gulpfile.js | 10 +++++----- js/ajax.js | 6 +++--- js/astronautHTML.js | 6 +++--- js/cache.js | 6 +++--- js/datetime.js | 2 +- js/launchHTML.js | 2 +- js/main.js | 8 ++++---- manifest.json | 42 +++++++++++++++++++++--------------------- package.json | 32 ++++++++++++++++---------------- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 26f45ba..0c2baef 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,14 +2,14 @@ const gulp = require('gulp'); const watch = require('gulp-watch'); const concat = require('gulp-concat'); -gulp.task('watch', function () { +gulp.task('watch', function() { gulp.watch('js/*.js', gulp.series('js')); }); -gulp.task('js', function(){ +gulp.task('js', function() { return gulp.src('js/*.js') - .pipe(concat('app.js')) - .pipe(gulp.dest('./')) + .pipe(concat('app.js')) + .pipe(gulp.dest('./')) }); -gulp.task('default', gulp.series('js')); \ No newline at end of file +gulp.task('default', gulp.series('js')); diff --git a/js/ajax.js b/js/ajax.js index 7fe7d0e..62fa710 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -6,12 +6,12 @@ */ function _ajaxrequest(url, func, err) { fetch(url) - .then(function (response) { - if(response.status != 200) { + .then(function(response) { + if (response.status != 200) { return false; } return response.json(); }) .then(func) .catch(err); -} \ No newline at end of file +} diff --git a/js/astronautHTML.js b/js/astronautHTML.js index 6931985..d6c7429 100644 --- a/js/astronautHTML.js +++ b/js/astronautHTML.js @@ -12,20 +12,20 @@ function drawAstronautHtml(data) { const crew = list[i]; const obj_p_line = list.length; - if(obj_p_line > 6) { + if (obj_p_line > 6) { size = Math.floor((420 - (obj_p_line * 10) - 40) / obj_p_line); } let wiki = (crew.wiki != null) ? crew.wiki : "https://www.google.com/search?q=" + encodeURI("astronaut " + crew.name); html += '' + '' + '' + - ''; + ''; } document.getElementById("ast-list").innerHTML = html; diff --git a/js/cache.js b/js/cache.js index 4e475fd..77de11c 100644 --- a/js/cache.js +++ b/js/cache.js @@ -9,12 +9,12 @@ const CACHE_PREFIX = "rls"; function isDataInCache(key) { const interval = 10; // in minutes const date = localStorage.getItem((CACHE_PREFIX + '_date_' + key)); - - if(date != null && date != "") { + + if (date != null && date != "") { const current_date = new Date(); const request_date = new Date((new Date()).getTime() + interval * 60000); - if(request_date > current_date) { + if (request_date > current_date) { return true; } } diff --git a/js/datetime.js b/js/datetime.js index d36f10f..9e86cdd 100644 --- a/js/datetime.js +++ b/js/datetime.js @@ -40,4 +40,4 @@ function formatTimeLeft(date) { } return text; -} \ No newline at end of file +} diff --git a/js/launchHTML.js b/js/launchHTML.js index b39c02a..89f9e9e 100644 --- a/js/launchHTML.js +++ b/js/launchHTML.js @@ -6,7 +6,7 @@ function drawLaunchHtml(data) { var itemNum = 0; - if(!Array.isArray(data.results)) return; + if (!Array.isArray(data.results)) return; for (var i = 0; i < data.results.length && itemNum < 5; i++) { var elem = ""; diff --git a/js/main.js b/js/main.js index def5698..831dd27 100644 --- a/js/main.js +++ b/js/main.js @@ -6,13 +6,13 @@ if (isDataInCache("launch")) { const launchesAPI = "https://ll.thespacedevs.com/2.0.0/launch/upcoming/?limit=10&mode=detailed"; - _ajaxrequest(launchesAPI, function (d) { + _ajaxrequest(launchesAPI, function(d) { if (d != false) { updateCachedData("launch", d); drawLaunchHtml(d); } }, - function (e) { + function(e) { console.error(e); }); } @@ -25,13 +25,13 @@ if (isDataInCache("astronaut")) { const astronautsAPI = "https://ll.thespacedevs.com/2.2.0/astronaut/?in_space=true&is_human=true"; - _ajaxrequest(astronautsAPI, function (d) { + _ajaxrequest(astronautsAPI, function(d) { if (d != false) { updateCachedData("astronaut", d); drawAstronautHtml(d); } }, - function (e) { + function(e) { console.error(e); }); } diff --git a/manifest.json b/manifest.json index c2f241f..b3197de 100755 --- a/manifest.json +++ b/manifest.json @@ -1,24 +1,24 @@ { - "name": "Rocket Launch Schedule", - "description": "List of all upcoming rocket launches", - "version": "23.2.2", - "manifest_version": 3, - "action": { - "default_popup": "popup.html", - "default_icon": "img/icon_16.png" - }, - "icons": { - "128": "img/icon_128.png", - "16": "img/icon_16.png", - "48": "img/icon_48.png" - }, - "permissions": [ - "storage", - "https://ll.thespacedevs.com/*" - ], - "browser_specific_settings": { - "gecko": { - "id": "login@mariogarrido.pt" + "name": "Rocket Launch Schedule", + "description": "List of all upcoming rocket launches", + "version": "23.2.2", + "manifest_version": 3, + "action": { + "default_popup": "popup.html", + "default_icon": "img/icon_16.png" + }, + "icons": { + "128": "img/icon_128.png", + "16": "img/icon_16.png", + "48": "img/icon_48.png" + }, + "permissions": [ + "storage", + "https://ll.thespacedevs.com/*" + ], + "browser_specific_settings": { + "gecko": { + "id": "login@mariogarrido.pt" + } } - } } diff --git a/package.json b/package.json index bf9f96d..064de4e 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "name": "rocket-launch-schedule", - "scripts": { - "build": "mkdir -p build && zip -r build/app.zip . -x \"*node_modules*\" -x \"js\" -x \"js/*\" -x \".*\" -x \"*.md\" -x \"LICENSE\" -x \"gulpfile.js\" -x \"package*\" -x \"build*\" -x \"*.zip\" -x \"*.DS_Store\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/mariogarridopt/Rocket-Launch-Schedule.git" - }, - "bugs": { - "url": "https://github.com/mariogarridopt/Rocket-Launch-Schedule/issues" - }, - "devDependencies": { - "gulp": "^4.0.2", - "gulp-concat": "^2.6.1", - "gulp-watch": "^5.0.1" - } + "name": "rocket-launch-schedule", + "scripts": { + "build": "mkdir -p build && zip -r build/app.zip . -x \"*node_modules*\" -x \"js\" -x \"js/*\" -x \".*\" -x \"*.md\" -x \"LICENSE\" -x \"gulpfile.js\" -x \"package*\" -x \"build*\" -x \"*.zip\" -x \"*.DS_Store\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mariogarridopt/Rocket-Launch-Schedule.git" + }, + "bugs": { + "url": "https://github.com/mariogarridopt/Rocket-Launch-Schedule/issues" + }, + "devDependencies": { + "gulp": "^4.0.2", + "gulp-concat": "^2.6.1", + "gulp-watch": "^5.0.1" + } }