Restructure MVC into public/src layout

Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-24 14:00:58 +00:00
parent 1be6b7ff0c
commit f617ecb350
135 changed files with 75 additions and 63 deletions

40
public/views/js/d.avatar.js Executable file
View File

@@ -0,0 +1,40 @@
$(window).ready(function() {
$("#deleteavatar").click(function() {
$("aside").removeClass("avatar").addClass("noavatar");
$("#deleteavatar").hide();
$("#avatarcheckbox").prop("checked", false);
$('#avatarfile').val('');
});
$("#uploadavatar").click(function() {
$('#avatarfile').trigger('click');
});
$("#avatarfile").change(function () {
if($("#avatarfile").val == '') {
$("#avatarcheckbox").prop("checked", false);
$("aside").removeClass("avatar").addClass("noavatar");
$("#deleteavatar").hide();
}
else {
$("#avatarcheckbox").prop("checked", true);
$("aside").removeClass("noavatar").addClass("avatar");
$("#deleteavatar").show();
readURL(this);
}
});
});
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#profileavatar').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}$

22
public/views/js/d.captcha.js Executable file
View File

@@ -0,0 +1,22 @@
var time = 9;
$(window).ready(function() {
var interval = setInterval(function() {
if (time > 0) {
$("#captchahidden").val(time);
$("#captchasec").html(time+" s");
time--;
}
else {
time--;
$("#captchahidden").val(time);
$("#captchatext").remove();
$("#captchasubmit").removeAttr('disabled');
$("#captchasubmit").css("display", "block");
time--;
$("#captchahidden").val(time);
clearInterval(interval);
}
}, 1000);
});

93
public/views/js/d.header.js Executable file
View File

@@ -0,0 +1,93 @@
var small = 2;
function reduce() {
$( "header" ).animate({
height: "45px"
}, 100, function() {
// Animation complete.
});
$( "header #logo img" ).animate({
height: "34px"
}, 100, function() {
// Animation complete.
});
$( "header #logo" ).animate({
paddingTop: "3px"
}, 100, function() {
// Animation complete.
});
$( "header li.on-bar" ).animate({
height: "45px"
}, 100, function() {
// Animation complete.
});
$( "header li:not(.with-subtitle) a.on-bar" ).animate({
paddingTop: "15px",
paddingBottom: "5px"
}, 100, function() {
// Animation complete.
});
$( "header li.with-subtitle a.on-bar" ).animate({
paddingTop: "5px",
paddingBottom: "15px"
}, 100, function() {
// Animation complete.
});
}
function enlarge() {
$( "header" ).animate({
height: "65px"
}, 100, function() {
// Animation complete.
});
$( "header #logo img" ).animate({
height: "44px"
}, 100, function() {
// Animation complete.
});
$( "header #logo" ).animate({
paddingTop: "8px"
}, 100, function() {
// Animation complete.
});
$( "header li.on-bar" ).animate({
height: "65px"
}, 100, function() {
// Animation complete.
});
$( "header li:not(.with-subtitle) a.on-bar" ).animate({
paddingTop: "25px",
paddingBottom: "15px"
}, 100, function() {
// Animation complete.
});
$( "header li.with-subtitle a.on-bar" ).animate({
paddingTop: "15px",
paddingBottom: "25px"
}, 100, function() {
// Animation complete.
});
}
$(window).scroll(function() {
var position = $(window).scrollTop();
if (position>80 && small!=1 && $('body').width() > 800) {
small = 1;
reduce();
}
else if (position<=80 && small!=0 && $('body').width() > 800) {
small = 0;
enlarge();
}
});
$(window).ready(function() {
$( "#logo" ).hover(
function() {
$("#kabanologotext").show(100);
}, function() {
$("#kabanologotext").hide(100);
}
)
});

129
public/views/js/d.map.js Executable file
View File

@@ -0,0 +1,129 @@
var mymap;
var markers = [];
$( document ).ready(function() {
// Differents layers for the map
var topo_maptiler = L.tileLayer('https://api.maptiler.com/maps/topographique/{z}/{x}/{y}.png?key=Sm8M7mJ53GtYdl773rpi', {tms: false, attribution: 'Carte © <a href="https://www.maptiler.com/copyright/" target="_blank">MapTiler</a>, Données © <a href="http://www.openstreetmap.org/copyright" target="_blank">Contributeurs OpenStreetMap</a>', tileSize: 512, zoomOffset: -1, minZoom: 1});
var ign = L.tileLayer('https://data.geopf.fr/private/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/jpeg&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&apikey=ign_scan_ws', {attribution: 'Carte & Connées © <a href="http://ign.fr/" target="_blank">IGN-F/Géoportail</a>'});
// Base layers
var baseLayers = {
"OpenStreetMap": topo_maptiler,
"IGN France": ign
};
mymap = L.map('mapid', {
zoomControl: false,
layers: [topo_maptiler]
}).setView([47, 3], 6);
$("#map-credits").html(topo_maptiler.getAttribution());
L.control.scale({
position: "bottomleft",
imperial: false
}).addTo(mymap);
var credits = L.easyButton('fa-info',
function(control, mymap){
$("footer").hide();
$("#footer-credits").show();
$("#footer-legend").hide();
}, 'Credits');
var legend = L.easyButton('fa-question',
function(control, mymap){
$("footer").hide();
$("#footer-credits").hide();
$("#footer-legend").show();
}, 'Legend');
L.easyBar([ credits, legend, ], {position: "bottomleft"}).addTo(mymap);
L.control.fullscreen({
position: "bottomleft"
}).addTo(mymap);
L.control.zoom({
zoomOutText: "<i class=\"fa fa-minus\" aria-hidden=\"true\"></i>",
zoomInText: "<i class=\"fa fa-plus\" aria-hidden=\"true\"></i>",
position: "bottomleft"
}).addTo(mymap);
L.control.layers(baseLayers,null,{
position: "bottomright"
}).addTo(mymap);
mymap.removeControl(mymap.attributionControl);
$(".close-link").click(function() {
$("footer").show();
$("#footer-credits").hide();
$("#footer-legend").hide();
});
mymap.on('baselayerchange', function(e) {
$("#map-credits").html(e.layer.getAttribution());
});
mymap.on("zoomend", function () {
var z = mymap.getZoom();
var size = 32;
if (z < 8) size = 20;
if (z < 4) size = 12;
markers.forEach(function(marker) {
var icon = marker.options.icon;
icon.options.iconSize = [size, size];
icon.options.iconAnchor = [size/2, size];
marker.setIcon(icon);
});
});
// ---------------------------------------------------------
// CHARGEMENT DES POIs
// ---------------------------------------------------------
$.getJSON(root + "poi/api_list", function(pois) {
var icons = {};
// Préparer les icônes
for (const type in window.poi_icons) {
icons[type] = L.icon({
iconUrl: window.poi_icons[type],
iconSize: [32, 32],
iconAnchor: [16, 32],
popupAnchor: [0, -32]
});
}
// Ajouter les POIs
pois.forEach(function(poi) {
var icon = icons[poi.type] || icons["default"];
var marker = L.marker([poi.lat, poi.lon], { icon: icon })
.addTo(mymap);
// Tooltip discret au survol
marker.bindTooltip(poi.name, {
direction: "top",
offset: [0, -10],
opacity: 0.9,
className: "poi-tooltip"
});
// Clic → ouvrir la fiche directement
marker.on("click", function() {
window.location = root + "poi/" + poi.permalink;
});
markers.push(marker);
});
// Ajuster la vue
if (markers.length > 0) {
var group = L.featureGroup(markers);
mymap.fitBounds(group.getBounds(), { padding: [30, 30] });
}
});
});

132
public/views/js/d.poi_map.js Executable file
View File

@@ -0,0 +1,132 @@
var mymap;
var poi_layer;
$(document).ready(function() {
// Mode : edit (formulaire) ou view (affichage)
var isEdit = (typeof poi_mode === "undefined" || poi_mode === "edit");
// Differents layers for the map
var topo_maptiler = L.tileLayer(
'https://api.maptiler.com/maps/topographique/{z}/{x}/{y}.png?key=Sm8M7mJ53GtYdl773rpi',
{
tms: false,
attribution: 'Carte © <a href="https://www.maptiler.com/copyright/" target="_blank">MapTiler</a>, Données © <a href="http://www.openstreetmap.org/copyright" target="_blank">Contributeurs OpenStreetMap</a>',
tileSize: 512,
zoomOffset: -1,
minZoom: 1
}
);
var ign = L.tileLayer(
'https://data.geopf.fr/private/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/jpeg&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&apikey=ign_scan_ws',
{
attribution: 'Carte & Connées © <a href="http://ign.fr/" target="_blank">IGN-F/Géoportail</a>'
}
);
// Base layers
var baseLayers = {
"OpenStreetMap": topo_maptiler,
"IGN France": ign
};
mymap = L.map('mapid', {
zoomControl: false,
layers: [topo_maptiler]
}).setView([47, 3], 6);
$("#map-credits").html(topo_maptiler.getAttribution());
L.control.scale({
position: "bottomleft",
imperial: false
}).addTo(mymap);
L.control.fullscreen({
position: "bottomleft"
}).addTo(mymap);
L.control.zoom({
zoomOutText: "<i class=\"fa fa-minus\" aria-hidden=\"true\"></i>",
zoomInText: "<i class=\"fa fa-plus\" aria-hidden=\"true\"></i>",
position: "bottomleft"
}).addTo(mymap);
L.control.layers(baseLayers, null, {
position: "bottomright"
}).addTo(mymap);
mymap.removeControl(mymap.attributionControl);
mymap.on('baselayerchange', function(e) {
$("#map-credits").html(e.layer.getAttribution());
});
// Position initiale : soit celle du POI, soit le centre par défaut
var startLat = (typeof poi_lat !== "undefined" && poi_lat) ? poi_lat : 47;
var startLon = (typeof poi_lon !== "undefined" && poi_lon) ? poi_lon : 3;
// Icône : si poi_type défini, on lutilise, sinon icône Leaflet par défaut
var poiicon = null;
if (typeof poi_type !== "undefined" && poi_type) {
poiicon = L.icon({
iconSize: [24, 24],
iconAnchor: [12, 12],
iconUrl: root + "views/img/" + poi_type + ".svg"
});
}
if (poiicon) {
poi_layer = L.marker([startLat, startLon], {draggable: isEdit, icon: poiicon}).addTo(mymap);
} else {
poi_layer = L.marker([startLat, startLon], {draggable: isEdit}).addTo(mymap);
}
if (isEdit) {
poi_layer.bindTooltip("Glissez moi au bon endroit.", {permanent: true, direction: 'auto'}).openTooltip();
}
// Interactions uniquement en mode édition
if (isEdit) {
mymap.on('click', function(e){
poi_layer.setLatLng(e.latlng);
});
poi_layer.on('move', function(e){
poi_layer.unbindTooltip();
$("#lat").val(+e.latlng.lat.toFixed(6));
$("#lon").val(+e.latlng.lng.toFixed(6));
$("#elevation_icon").show();
});
$("#lat,#lon").change(function() { // If the user changes the lat/lon input values manualy
if(isNaN($("#lat").val()) || isNaN($("#lon").val()) || $("#lat").val().length==0 || $("#lon").val()==null)
$("#elevation_icon").hide();
else {
$("#elevation_icon").show();
poi_layer.setLatLng([$("#lat").val(),$("#lon").val()]);
}
});
var editPoiIcon = L.icon({
iconSize: [24, 24],
iconAnchor: [12, 12]
});
$("#type_selector label").click(function(e) {
poi_layer.unbindTooltip();
editPoiIcon.options.iconUrl = e.currentTarget.firstChild.currentSrc;
poi_layer.setIcon(editPoiIcon);
});
$("#elevation_icon").click(function(e) {
$(this).find($(".fas")).removeClass('fa-search-location').addClass('fa-spinner').addClass('fa-spin');
$.get(root+"poi/elevation_proxy", {location:$("#lat").val()+","+$("#lon").val()}, function(result){
$("#ele").val(result.results[0].elevation);
$("#elevation_icon").find($(".fas")).removeClass('fa-spinner').removeClass('fa-spin').addClass('fa-search-location');
});
});
} else {
// Mode affichage : centrer sur le POI si coordonnées présentes
if (typeof poi_lat !== "undefined" && typeof poi_lon !== "undefined") {
mymap.setView([poi_lat, poi_lon], 14);
}
}
});