Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
fix file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mariogarridopt committed Feb 3, 2023
1 parent 163a143 commit 61b0720
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
gulp.task('default', gulp.series('js'));
6 changes: 3 additions & 3 deletions js/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions js/astronautHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +=
'<a href="' + wiki + '" ' +
'class="ast" id="ast-' + crew.id + '" '+
'class="ast" id="ast-' + crew.id + '" ' +
'style="position: relative; ' +
'width: ' + size + 'px; height: ' + size + 'px;" >' +
'<!--span class="location">ISS</span-->' +
'<img src="' + crew.profile_image_thumbnail + '" ' +
'class="horizontal"></img>' +
'</a>';
'</a>';
}

document.getElementById("ast-list").innerHTML = html;
Expand Down
6 changes: 3 additions & 3 deletions js/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ function formatTimeLeft(date) {
}

return text;
}
}
2 changes: 1 addition & 1 deletion js/launchHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<article" + ((itemNum != 0) ? ' class="gradient" ' : '') + ">";
Expand Down
8 changes: 4 additions & 4 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand All @@ -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);
});
}
42 changes: 21 additions & 21 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
"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": "[email protected]"
}
}
}
}
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 61b0720

Please sign in to comment.