Commit 017deae9 authored by Joe Mobbs's avatar Joe Mobbs

Merge and update link

parents 688b70a0 6a4b828f
Flight2fart Converter is a fun javascript based website that calculates CO2 equivalent emissions from flights in a humourous way in order to draw attention to aviation's odious contribution to climate change.
Find out how badly your flights stink...
http://flight2fart.com
\ No newline at end of file
......@@ -85,12 +85,12 @@
<fieldset id="singlefieldset">
<div class="form-group has-feedback">
<label for="origin" class="control-label">Origine :</label>
<input type="text" id="OriginInputSF" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='origin'>
<input type="text" id="OriginInputSF" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='origin'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label for="destination" class="control-label">Destination :</label>
<input type="text" id="DestinationInputSF" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='destination'>
<input type="text" id="DestinationInputSF" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='destination'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......@@ -121,12 +121,12 @@
</div>
<div class="form-group has-feedback">
<label for="origin" class="control-label">Origine :</label>
<input type="text" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='origin'>
<input type="text" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='origin'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label for="destination" class="control-label">Destination :</label>
<input type="text" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='destination'>
<input type="text" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='destination'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......@@ -152,12 +152,12 @@
odieuse et puante de l'aviation au changement climatique.
</p>
<p>Calculez vos emissions CO<sub>2</sub> d'un vol simple ou de tous les vols accumulé de votre vie.
<p>Calculez vos émissions CO<sub>2</sub> d'un vol simple ou de tous les vols accumulé de votre vie.
</p>
<p>Les emissions de CO<sub>2</sub> sont estimées sur la base de la distance entre la ville d'origine et la ville de destination avec la terre approximé par un sphère.
<p>Les émissions de CO<sub>2</sub> sont estimées sur la base de la distance entre la ville d'origine et la ville de destination avec la terre approximé par un sphère.
Le calcule utilise une formule basé sur <a href="https://www.gov.uk/government/collections/government-conversion-factors-for-company-reporting#conversion-factors-2018">les
chiffres pour CO<sub>2</sub>e par km pour l'aviation du gouvernement du Royaume Uni</a>, ils prendent en comp te le forçage radiative.
chiffres pour CO<sub>2</sub>e par km pour l'aviation du gouvernement du Royaume Uni</a>, ils prendent en compte le forçage radiative.
</p>
<p>Avec les impacts du changement climatique sur l'agriculture, avec les océans qui acidifient et avec un augmentation du nombre de feux de forêt et d'ouragons,
......@@ -195,7 +195,7 @@
<div id="footer-spacer"></div>
</div>
<footer>
<p align="center">Flight2fart is community driven software: <a href='https!//framagit.org'>hackers welcome</a></p>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org/QuoiQue/flight2fart-converter'>hackers welcome</a></p>
</footer>
</body>
</html>
\ No newline at end of file
......@@ -86,12 +86,12 @@
<fieldset id="singlefieldset">
<div class="form-group has-feedback">
<label for="origin" class="control-label">Origine :</label>
<input type="text" id="OriginInputSF" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='origin'>
<input type="text" id="OriginInputSF" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='origin'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label for="destination" class="control-label">Destination :</label>
<input type="text" id="DestinationInputSF" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='destination'>
<input type="text" id="DestinationInputSF" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='destination'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......@@ -122,12 +122,12 @@
</div>
<div class="form-group has-feedback">
<label for="origin" class="control-label">Origine :</label>
<input type="text" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='origin'>
<input type="text" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='origin'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<label for="destination" class="control-label">Destination :</label>
<input type="text" class="form-control autocomplete" size="35" placeholder="Airport, city or IATA code" autocomplete="off" spellcheck="false" name='destination'>
<input type="text" class="form-control autocomplete" size="35" placeholder="Aéroport, ville ou code IATA" autocomplete="off" spellcheck="false" name='destination'>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......@@ -153,12 +153,12 @@
odieuse et puante de l'aviation au changement climatique.
</p>
<p>Calculez vos emissions CO<sub>2</sub> d'un vol simple ou de tous les vols accumulé de votre vie.
<p>Calculez vos émissions CO<sub>2</sub> d'un vol simple ou de tous les vols accumulé de votre vie.
</p>
<p>Les emissions de CO<sub>2</sub> sont estimées sur la base de la distance entre la ville d'origine et la ville de destination avec la terre approximé par un sphère.
<p>Les émissions de CO<sub>2</sub> sont estimées sur la base de la distance entre la ville d'origine et la ville de destination avec la terre approximé par un sphère.
Le calcule utilise une formule basé sur <a href="https://www.gov.uk/government/collections/government-conversion-factors-for-company-reporting#conversion-factors-2018">les
chiffres pour CO<sub>2</sub>e par km pour l'aviation du gouvernement du Royaume Uni</a>, ils prendent en comp te le forçage radiative.
chiffres pour CO<sub>2</sub>e par km pour l'aviation du gouvernement du Royaume Uni</a>, ils prendent en compte le forçage radiative.
</p>
<p>Avec les impacts du changement climatique sur l'agriculture, avec les océans qui acidifient et avec un augmentation du nombre de feux de forêt et d'ouragons,
......@@ -199,7 +199,7 @@
<div id="footer-spacer"></div>
</div>
<footer>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org'>hackers welcome</a></p>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org/QuoiQue/flight2fart-converter'>hackers welcome</a></p>
</footer>
</body>
</html>
\ No newline at end of file
......@@ -195,7 +195,7 @@
<div id="footer-spacer"></div>
</div>
<footer>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org'>hackers welcome</a></p>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org/QuoiQue/flight2fart-converter'>hackers welcome</a></p>
</footer>
</body>
</html>
\ No newline at end of file
......@@ -199,7 +199,7 @@
<div id="footer-spacer"></div>
</div>
<footer>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org'>hackers welcome</a></p>
<p align="center">Flight2fart is community driven software: <a href='https://framagit.org/QuoiQue/flight2fart-converter'>hackers welcome</a></p>
</footer>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
var fieldSets = new Array();
var fieldSet;
window.addEventListener('load', eventWindowLoaded, false);
function eventWindowLoaded() {
fieldSet = document.getElementById("inviteemail");
document.getElementById("minus").style.display = 'none';
addFieldSet();
}
function removeFieldSet() {
var removal = fieldSets.pop();
var lastLine = removal.parentNode;
lastLine.parentNode.removeChild(lastLine);
if (fieldSets.length <= 1) {
document.getElementById("minus").style.display = 'none';
}
}
function addFieldSet() {
//get flight data from form
var emailform = document.getElementById('emailform');
var placeNames = ['ferdinand', 'prospero', 'ariel', 'caliban', 'alonso']
var newFieldSet = fieldSet.cloneNode(true);
fieldSets.push(newFieldSet);
var buttons = document.getElementById('buttons');
var newParagraph = document.createElement('p');
newParagraph.appendChild(newFieldSet);
emailform.insertBefore(newParagraph, buttons);
if (fieldSets.length > 1) {
document.getElementById("minus").style.display = 'inline';
}
var count = (fieldSets.length - 1);
newFieldSet.id = "FieldSet" + count;
$( '#' + newFieldSet.id + " input[name='receiveremail']" ).attr("id","ReceiverInput" + count);
var modF = count % placeNames.length;
$( '#' + 'ReceiverInput' + count).attr("placeholder", placeNames[modF] + "@example.com");
setupInputs();
}
function clearForm() {
while (fieldSets.length > 1) {
removeFieldSet();
}
}
function setupInputs() {
$("input[name='email']").on(
"change, focusin, focusout, keydown, keyup", function(eventObject) {
var elem = $( this );
var date = new Date();
var year = date.getFullYear();
var input = parseInt(elem[0].value);
if (elem[0].value === "") {
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove glyphicon-ok");
elem.parent().removeClass("has-warning has-error has-success");
elem.css("background-color", "#FFFFFF");
}
else if (input == Math.floor(input) && input >= 0 && input <= year) {
if (input >= 1903) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-remove glyphicon-warning-sign");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-error has-warning");
elem.css("background-color", "#D6FFD6");
}
else {
elem.parent().find("span").addClass("glyphicon-warning-sign");
elem.parent().find("span").removeClass("glyphicon-ok glyphicon-remove");
elem.parent().addClass("has-warning");
elem.parent().removeClass("has-success has-error");
elem.css("background-color", "#FFF0B6");
}
}
else {
elem.parent().find("span").addClass("glyphicon-remove")
elem.parent().find("span").removeClass("glyphicon-ok glyphicon-warning-sign");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-success has-warning");
elem.css("background-color", "#FFD6D6");
console.log(elem );
}
}
);
$( "input[name='origin'], input[name='destination']" ).on(
"change",
function( eventObject ) {
var elem = $( this );
var input = elem[0].value;
console.log(elem);
var check = false;
if (input === "") {
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove glyphicon-ok");
elem.parent().removeClass("has-warning has-error has-success");
elem.css("background-color", "#FFFFFF");
check = true;
}
else {
for (var i = 0; i < airportAuto.length; i++) {
if (input.localeCompare(airportAuto[i]) == 0) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-warning has-error");
elem.css("background-color", "#D6FFD6");
check = true;
break;
}
}
}
if (!check) {
elem.parent().find("span").addClass("glyphicon-remove");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-ok");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-warning has-success");
elem.css("background-color", "#FFD6D6");
}
}
);
$( "input[name='origin'], input[name='destination']" ).on(
"keydown, keyup, focusin",
function ( eventObject ) {
var elem = $( this );
var input = elem[0].value;
var pattern = new RegExp(input, "i");
var check = false;
for (var i = 0; i < airportAuto.length; i++) {
if (pattern.test(airportAuto[i])) {
if (input.localeCompare(airportAuto[i]) == 0) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-warning has-error");
elem.css("background-color", "#D6FFD6");
}
else {
elem.parent().find("span").addClass("glyphicon-warning-sign");
elem.parent().find("span").removeClass("glyphicon-ok glyphicon-remove");
elem.parent().addClass("has-warning");
elem.parent().removeClass("has-success has-error");
elem.css("background-color", "#FFF0B6");
}
check = true;
break;
}
}
if (!check) {
elem.parent().find("span").addClass("glyphicon-remove");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-ok");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-warning has-success");
elem.css("background-color", "#FFD6D6");
}
}
);
$( "input[name='origin'], input[name='destination']" ).on(
"focusout",
function ( eventObject ) {
var elem = $( this );
var input = elem[0].value;
console.log(elem);
var check = false;
if (input === "") {
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove glyphicon-ok");
elem.parent().removeClass("has-warning has-error has-success");
elem.css("background-color", "#FFFFFF");
check = true;
}
else {
for (var i = 0; i < airportAuto.length; i++) {
if (input.localeCompare(airportAuto[i]) == 0) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-warning has-error");
elem.css("background-color", "#D6FFD6");
check = true;
break;
}
}
if (!check) {
elem.parent().find("span").addClass("glyphicon-remove");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-ok");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-warning has-success");
elem.css("background-color", "#FFD6D6");
}
}
}
);
$( "select[name='return']" ).on(
"change, focusin, focusout, keydown, keyup, click",
function( eventObject ) {
var elem = $( this );
var input = elem[0].value;
if (input.localeCompare("Return") == 0 || input.localeCompare("Single")) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-warning has-error");
elem.css("background-color", "#D6FFD6");
}
else {
elem.parent().find("span").addClass("glyphicon-remove");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-ok");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-warning has-success");
elem.css("background-color", "#FFD6D6");
}
}
);
$( "select[name='return']" ).focusout(function( eventObject ) {
var elem = $( this );
var input = elem[0].value;
if (input.localeCompare("Return") == 0 || input.localeCompare("Single")) {
elem.parent().find("span").addClass("glyphicon-ok");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-remove");
elem.parent().addClass("has-success");
elem.parent().removeClass("has-warning has-error");
elem.css("background-color", "#D6FFD6");
}
else {
elem.parent().find("span").addClass("glyphicon-remove");
elem.parent().find("span").removeClass("glyphicon-warning-sign glyphicon-ok");
elem.parent().addClass("has-error");
elem.parent().removeClass("has-warning has-success");
elem.css("background-color", "#FFD6D6");
}
}
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment