fix: attachment and gitignore
This commit is contained in:
parent
ca9d3b2d98
commit
d8070b6260
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.DS_Store
|
||||||
|
.history/
|
@ -82,10 +82,10 @@
|
|||||||
<div class="form-control rounded-0" id="messageTextArea"></div>
|
<div class="form-control rounded-0" id="messageTextArea"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="bold">Ajouter une piève jointe</label>
|
<label class="bold" id="labelAttachment"></label>
|
||||||
<div class="custom-file">
|
<div class="custom-file">
|
||||||
<input type="file" class="custom-file-input" id="attachmentPlane" aria-describedby="inputGroupFileAddon01">
|
<input type="file" class="custom-file-input" id="attachmentPlane" aria-describedby="inputGroupFileAddon01">
|
||||||
<label class="custom-file-label" for="attachmentPlane"></label>
|
<label class="custom-file-label" for="attachmentPlane" id="attachmentPlaneLabel"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -1,31 +1,43 @@
|
|||||||
var validExpeMail = false
|
var validExpeMail = false;
|
||||||
var validExpeLoc = false //turned to true in geocoder.js
|
var validExpeLoc = false; //turned to true in geocoder.js
|
||||||
var validDestMail = false
|
var validDestMail = false;
|
||||||
var validDestLoc = false //turned to true in geocoder.js
|
var validDestLoc = false; //turned to true in geocoder.js
|
||||||
|
|
||||||
function validateEmail(email) { //from https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript
|
function validateEmail(email) {
|
||||||
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
//from https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript
|
||||||
return re.test(String(email).toLowerCase());
|
const re =
|
||||||
|
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
return re.test(String(email).toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#expeMail").change(function() {
|
$("#expeMail").change(function () {
|
||||||
validExpeMail = validateEmail($("#expeMail").val())
|
validExpeMail = validateEmail($("#expeMail").val());
|
||||||
checkFormValid()
|
checkFormValid();
|
||||||
})
|
});
|
||||||
|
|
||||||
$("#destMail").change(function() {
|
$("#destMail").change(function () {
|
||||||
validDestMail = validateEmail($("#destMail").val())
|
validDestMail = validateEmail($("#destMail").val());
|
||||||
checkFormValid()
|
checkFormValid();
|
||||||
})
|
});
|
||||||
|
|
||||||
document.querySelector('.custom-file-input').addEventListener('change',function(e){
|
document
|
||||||
var fileName = document.getElementById("attachmentPlane").files[0].name;
|
.querySelector(".custom-file-input")
|
||||||
var nextSibling = e.target.nextElementSibling
|
.addEventListener("change", function (e) {
|
||||||
nextSibling.innerText = fileName
|
const file = e.target.files[0];
|
||||||
})
|
const fileName = file.name;
|
||||||
|
var nextSibling = e.target.nextElementSibling;
|
||||||
|
nextSibling.innerText = fileName;
|
||||||
|
|
||||||
function checkFormValid(){
|
const filesize = (file.size / 1024 / 1024).toFixed(4); // MB
|
||||||
if(validExpeMail && validExpeLoc && validDestMail && validDestLoc){
|
if (filesize >= 2.2) {
|
||||||
$('#sendNewPlane').prop("disabled", false)
|
e.target.classList.add("is-invalid");
|
||||||
}
|
} else {
|
||||||
|
e.target.classList.remove("is-invalid");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkFormValid() {
|
||||||
|
if (validExpeMail && validExpeLoc && validDestMail && validDestLoc) {
|
||||||
|
$("#sendNewPlane").prop("disabled", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,186 +1,193 @@
|
|||||||
// Default lang
|
// Default lang
|
||||||
var lang = 'en'
|
var lang = "en";
|
||||||
|
|
||||||
// Lang by session
|
// Lang by session
|
||||||
var langSession = sessionStorage.getItem('lang');
|
var langSession = sessionStorage.getItem("lang");
|
||||||
// Lang by navigator config
|
// Lang by navigator config
|
||||||
var userLang = navigator.userLanguage || navigator.language;
|
var userLang = navigator.userLanguage || navigator.language;
|
||||||
|
|
||||||
if (langSession) {
|
if (langSession) {
|
||||||
lang = langSession.substring(0,2)
|
lang = langSession.substring(0, 2);
|
||||||
} else if (userLang) {
|
} else if (userLang) {
|
||||||
lang = userLang.substring(0,2)
|
lang = userLang.substring(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//loading the lang.json file
|
//loading the lang.json file
|
||||||
$(document).ready(function(){
|
$(document).ready(function () {
|
||||||
translateUI(lang)
|
translateUI(lang);
|
||||||
$.getJSON("lang/lang.json", function(data){
|
$.getJSON("lang/lang.json", function (data) {
|
||||||
//creating dropdown list of languages in navbar
|
//creating dropdown list of languages in navbar
|
||||||
for (var key in data){
|
for (var key in data) {
|
||||||
$("#langChoices").append( '<a class="dropdown-item langSelect" value="'+key+'" href="#">'+data[key]+'</a>' )
|
$("#langChoices").append(
|
||||||
$("#selectDestLang").append( '<option value="'+key+'" href="#">'+data[key]+'</option>' )
|
'<a class="dropdown-item langSelect" value="' +
|
||||||
}
|
key +
|
||||||
//setting the user lang
|
'" href="#">' +
|
||||||
if(data[lang]){
|
data[key] +
|
||||||
//$("#navbarDropdownLang").html(data[lang])
|
"</a>"
|
||||||
translateUI(lang)
|
);
|
||||||
}
|
$("#selectDestLang").append(
|
||||||
//or english if not in list
|
'<option value="' + key + '" href="#">' + data[key] + "</option>"
|
||||||
else{
|
);
|
||||||
//$("#navbarDropdownLang").html("English")
|
}
|
||||||
translateUI('en')
|
//setting the user lang
|
||||||
}
|
if (data[lang]) {
|
||||||
$(".langSelect").on('click',function(e){
|
//$("#navbarDropdownLang").html(data[lang])
|
||||||
lang = e.currentTarget.attributes[1].value
|
translateUI(lang);
|
||||||
sessionStorage.setItem('lang', lang);
|
}
|
||||||
translateUI(lang)
|
//or english if not in list
|
||||||
//$("#navbarDropdownLang").html($(this).html())
|
else {
|
||||||
})
|
//$("#navbarDropdownLang").html("English")
|
||||||
}).fail(function(error){
|
translateUI("en");
|
||||||
console.log(error);
|
}
|
||||||
});
|
$(".langSelect").on("click", function (e) {
|
||||||
|
lang = e.currentTarget.attributes[1].value;
|
||||||
|
sessionStorage.setItem("lang", lang);
|
||||||
|
translateUI(lang);
|
||||||
|
//$("#navbarDropdownLang").html($(this).html())
|
||||||
|
});
|
||||||
|
}).fail(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var dictionnary = []
|
var dictionnary = [];
|
||||||
|
|
||||||
function translateUI(l){
|
function translateUI(l) {
|
||||||
$.getJSON("lang/"+l+"", function(s){
|
$.getJSON("lang/" + l + "", function (s) {
|
||||||
dictionnary = s
|
dictionnary = s;
|
||||||
//if arabic : display left to right (ltr) + troubleshooting a lot of individual elements
|
//if arabic : display left to right (ltr) + troubleshooting a lot of individual elements
|
||||||
if (lang == "ar"){
|
if (lang == "ar") {
|
||||||
//navbar
|
//navbar
|
||||||
$("nav").css('direction','rtl')
|
$("nav").css("direction", "rtl");
|
||||||
$(".nav-menus").removeClass('mr-auto')
|
$(".nav-menus").removeClass("mr-auto");
|
||||||
$(".nav-button").addClass('mr-auto')
|
$(".nav-button").addClass("mr-auto");
|
||||||
//form
|
//form
|
||||||
// $(".ql-container").css('direction','rtl')
|
// $(".ql-container").css('direction','rtl')
|
||||||
// $(".ql-container").css('float','right')
|
// $(".ql-container").css('float','right')
|
||||||
// $(".ql-editor").css('float','right')
|
// $(".ql-editor").css('float','right')
|
||||||
// $(".ql-editor p").css('float','right')
|
// $(".ql-editor p").css('float','right')
|
||||||
$(".modal-content").css('direction','rtl')
|
$(".modal-content").css("direction", "rtl");
|
||||||
$(".bold").css('float','right')
|
$(".bold").css("float", "right");
|
||||||
$("#public").css('margin-left','5px')
|
$("#public").css("margin-left", "5px");
|
||||||
$("#prive").css('margin-left','5px')
|
$("#prive").css("margin-left", "5px");
|
||||||
$("#newPlaneModalAnonyme").css('margin-right','25px')
|
$("#newPlaneModalAnonyme").css("margin-right", "25px");
|
||||||
$("#newPlaneModalCancel").css('margin-left','8px')
|
$("#newPlaneModalCancel").css("margin-left", "8px");
|
||||||
$("#closeModal").css('margin-left','0px')
|
$("#closeModal").css("margin-left", "0px");
|
||||||
$("#closeModal").css('padding-left','0px')
|
$("#closeModal").css("padding-left", "0px");
|
||||||
//anthology
|
//anthology
|
||||||
$("#anthology").css('direction','rtl')
|
$("#anthology").css("direction", "rtl");
|
||||||
$("#anthologyDisclaimer").css('float','right')
|
$("#anthologyDisclaimer").css("float", "right");
|
||||||
|
} else {
|
||||||
}
|
//navbar
|
||||||
else{
|
$("nav").css("direction", "ltr");
|
||||||
//navbar
|
$(".nav-menus").addClass("mr-auto");
|
||||||
$("nav").css('direction','ltr')
|
$(".nav-button").removeClass("mr-auto");
|
||||||
$(".nav-menus").addClass('mr-auto')
|
//form
|
||||||
$(".nav-button").removeClass('mr-auto')
|
// $(".ql-container").css('direction','ltr')
|
||||||
//form
|
// $(".ql-container").css('float','left')
|
||||||
// $(".ql-container").css('direction','ltr')
|
// $(".ql-editor").css('float','left')
|
||||||
// $(".ql-container").css('float','left')
|
// $(".ql-editor p").css('float','none')
|
||||||
// $(".ql-editor").css('float','left')
|
$(".modal-content").css("direction", "ltr");
|
||||||
// $(".ql-editor p").css('float','none')
|
$(".bold").css("float", "left");
|
||||||
$(".modal-content").css('direction','ltr')
|
$("#public").css("margin-left", "0px");
|
||||||
$(".bold").css('float','left')
|
$("#prive").css("margin-left", "0px");
|
||||||
$("#public").css('margin-left','0px')
|
$("#newPlaneModalAnonyme").css("margin-right", "0px");
|
||||||
$("#prive").css('margin-left','0px')
|
$("#newPlaneModalCancel").css("margin-left", "0px");
|
||||||
$("#newPlaneModalAnonyme").css('margin-right','0px')
|
//anthology
|
||||||
$("#newPlaneModalCancel").css('margin-left','0px')
|
$("#anthology").css("direction", "ltr");
|
||||||
//anthology
|
$("#anthologyDisclaimer").css("float", "left");
|
||||||
$("#anthology").css('direction','ltr')
|
}
|
||||||
$("#anthologyDisclaimer").css('float','left')
|
|
||||||
}
|
//changing all strings
|
||||||
|
//main page
|
||||||
//changing all strings
|
$("head title", window.parent.document).text(s.avionpoeme);
|
||||||
//main page
|
$("#navTitle").html(s.avionpoeme);
|
||||||
$('head title', window.parent.document).text(s.avionpoeme);
|
$("#buttonAnthology").html(s.anthologie);
|
||||||
$("#navTitle").html(s.avionpoeme)
|
$("#buttonAbout").html(s.apropos);
|
||||||
$("#buttonAnthology").html(s.anthologie)
|
if (typeof nbPlane !== "undefined") {
|
||||||
$("#buttonAbout").html(s.apropos)
|
$("#buttonNewPlane").val(s.lancer_avion + " " + nbPlane + "/100");
|
||||||
if (typeof nbPlane !== 'undefined') {
|
} else {
|
||||||
$("#buttonNewPlane").val(s.lancer_avion+" "+nbPlane+"/100")
|
$("#buttonNewPlane").on("click", () => {
|
||||||
} else {
|
window.location.replace("/");
|
||||||
$("#buttonNewPlane").on('click', () => {
|
});
|
||||||
window.location.replace("/");
|
}
|
||||||
})
|
//new plane form
|
||||||
}
|
$("#newPlaneModalTitle").html(s.lancer_avion);
|
||||||
//new plane form
|
$("#newPlaneModalMessage").html(s.message);
|
||||||
$("#newPlaneModalTitle").html(s.lancer_avion)
|
$("#newPlaneModalPrive").html(s.prive);
|
||||||
$("#newPlaneModalMessage").html(s.message)
|
$("#newPlaneModalPublic").html(s.public);
|
||||||
$("#newPlaneModalPrive").html(s.prive)
|
$("#labelAttachment").html(s.PJ_Ajouter);
|
||||||
$("#newPlaneModalPublic").html(s.public)
|
console.log(s);
|
||||||
$("#labelAttachment").html(s.PJ_Ajouter)
|
$("#attachmentPlaneLabel").attr("data-after", s.PJ_Parcourir);
|
||||||
console.log(s.PJ_Parcourir)
|
$("#flightTime").html(s.temps_de_vol);
|
||||||
$("#attachmentPlaneLabel").attr('data-after', s.PJ_Parcourir)
|
$("#newPlaneModalRandom").html(s.aléatoire);
|
||||||
$("#flightTime").html(s.temps_de_vol)
|
$("#newPlaneModal3j").html(s.trois_jours);
|
||||||
$("#newPlaneModalRandom").html(s.aléatoire)
|
$("#newPlaneModal7j").html(s.sept_jours);
|
||||||
$("#newPlaneModal3j").html(s.trois_jours)
|
$("#newPlaneModal30j").html(s.trente_jours);
|
||||||
$("#newPlaneModal7j").html(s.sept_jours)
|
$("#newPlaneModal365j").html(s.unan_jours);
|
||||||
$("#newPlaneModal30j").html(s.trente_jours)
|
$("#newPlaneModalExpediteur").html(s.expediteur);
|
||||||
$("#newPlaneModal365j").html(s.unan_jours)
|
$("#newPlaneModalDestinataire").html(s.destinataire);
|
||||||
$("#newPlaneModalExpediteur").html(s.expediteur)
|
$("#newPlaneModalAnonyme").html(s.anonyme);
|
||||||
$("#newPlaneModalDestinataire").html(s.destinataire)
|
$("#newPlaneModalCancel").html(s.annuler);
|
||||||
$("#newPlaneModalAnonyme").html(s.anonyme)
|
$("#sendNewPlane").html(s.lancer);
|
||||||
$("#newPlaneModalCancel").html(s.annuler)
|
$("#destLang").html(s.langue_destinataire);
|
||||||
$("#sendNewPlane").html(s.lancer)
|
$("#expeMail").attr("placeholder", s.expeMail_placeholder);
|
||||||
$("#destLang").html(s.langue_destinataire)
|
$("#expeGeocoderPhoton").attr("placeholder", s.expeLoc_placeholder);
|
||||||
$("#expeMail").attr("placeholder", s.expeMail_placeholder)
|
$("#destMail").attr("placeholder", s.destMail_placeholder);
|
||||||
$("#expeGeocoderPhoton").attr("placeholder", s.expeLoc_placeholder)
|
$("#destGeocoderPhoton").attr("placeholder", s.destLoc_placeholder);
|
||||||
$("#destMail").attr("placeholder", s.destMail_placeholder)
|
$("#anonymeTooltip").attr("title", s.anonyme_tooltip).tooltip("_fixTitle");
|
||||||
$("#destGeocoderPhoton").attr("placeholder", s.destLoc_placeholder)
|
$("#publicTooltip").attr("title", s.public_tooltip).tooltip("_fixTitle");
|
||||||
$('#anonymeTooltip').attr("title", s.anonyme_tooltip).tooltip("_fixTitle");
|
|
||||||
$('#publicTooltip').attr("title", s.public_tooltip).tooltip("_fixTitle");
|
$('#selectDestLang option[value="' + lang + '"]').prop("selected", true); //selecting by default recipient language same as interface
|
||||||
|
//Anthology
|
||||||
$('#selectDestLang option[value="'+lang+'"]').prop('selected', true); //selecting by default recipient language same as interface
|
displayAnthology();
|
||||||
//Anthology
|
$("#anthologyTitle").html(s.anthologie);
|
||||||
displayAnthology()
|
$("#anthologyDisclaimer").html(s.suppr_message_public);
|
||||||
$("#anthologyTitle").html(s.anthologie)
|
$("#closeAnthologyAbout").html(s.retour_carte);
|
||||||
$("#anthologyDisclaimer").html(s.suppr_message_public)
|
|
||||||
$("#closeAnthologyAbout").html(s.retour_carte)
|
//About
|
||||||
|
$("#aboutTitle").html(s.apropos);
|
||||||
//About
|
$("#librairies").html(s.librairies);
|
||||||
$("#aboutTitle").html(s.apropos)
|
$("#mapSources").html(s.source_carte);
|
||||||
$("#librairies").html(s.librairies)
|
$("#mapBackground").html(s.map_background);
|
||||||
$("#mapSources").html(s.source_carte)
|
$("#clouds").html(s.clouds);
|
||||||
$("#mapBackground").html(s.map_background)
|
$.getJSON("lang/about.json", function (e) {
|
||||||
$("#clouds").html(s.clouds)
|
if (lang !== "en" && lang !== "fr" && lang !== "de") {
|
||||||
$.getJSON("lang/about.json", function(e){
|
$("#aboutText").html(e[0].en);
|
||||||
if(lang !== 'en' && lang !== 'fr' && lang !== 'de'){
|
} else {
|
||||||
$("#aboutText").html(e[0].en)
|
$("#aboutText").html(e[0][lang]);
|
||||||
}
|
}
|
||||||
else{
|
$("#donationText").html(s.AvionPoeme_free_independent);
|
||||||
$("#aboutText").html(e[0][lang])
|
$("#donationButtonText").html(s.Soutenez_avionpoeme);
|
||||||
}
|
$("#donationButtonText").addClass(lang);
|
||||||
$("#donationText").html(s.AvionPoeme_free_independent)
|
});
|
||||||
$("#donationButtonText").html(s.Soutenez_avionpoeme)
|
|
||||||
$("#donationButtonText").addClass(lang)
|
//plane limit tooltip
|
||||||
})
|
if (typeof nbPlane !== "undefined") {
|
||||||
|
if (nbPlane > 99) {
|
||||||
//plane limit tooltip
|
$("#planeLimitTooltip")
|
||||||
if (typeof nbPlane !== 'undefined') {
|
.attr("title", s.AvionPoeme_epuise)
|
||||||
if (nbPlane > 99){
|
.tooltip("_fixTitle");
|
||||||
$("#planeLimitTooltip").attr("title", s.AvionPoeme_epuise).tooltip("_fixTitle");
|
} else {
|
||||||
}
|
var remainingPlanes = 100 - nbPlane;
|
||||||
else{
|
s.NB_AvionPoeme_restant = s.NB_AvionPoeme_restant.replace(
|
||||||
var remainingPlanes = 100 - nbPlane;
|
"$NB_avion_poeme",
|
||||||
s.NB_AvionPoeme_restant = s.NB_AvionPoeme_restant.replace('$NB_avion_poeme',remainingPlanes)
|
remainingPlanes
|
||||||
$("#planeLimitTooltip").attr("title", s.NB_AvionPoeme_restant).tooltip("_fixTitle");
|
);
|
||||||
}
|
$("#planeLimitTooltip")
|
||||||
}
|
.attr("title", s.NB_AvionPoeme_restant)
|
||||||
|
.tooltip("_fixTitle");
|
||||||
})
|
}
|
||||||
.always(function(callback) {
|
}
|
||||||
//console.log( callback );
|
}).always(function (callback) {
|
||||||
});
|
//console.log( callback );
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//hovering lang icon
|
//hovering lang icon
|
||||||
$( "#navbarDropdownLang" ).mouseenter(function() {
|
$("#navbarDropdownLang").mouseenter(function () {
|
||||||
$("#langIcon").attr("src","src/img/lang-hover.png");
|
$("#langIcon").attr("src", "src/img/lang-hover.png");
|
||||||
});
|
});
|
||||||
$( "#navbarDropdownLang" ).mouseleave(function() {
|
$("#navbarDropdownLang").mouseleave(function () {
|
||||||
$("#langIcon").attr("src","src/img/lang.png");
|
$("#langIcon").attr("src", "src/img/lang.png");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user