Skip to content

Commit

Permalink
update init
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcrb3 committed Jun 5, 2024
1 parent 100f04d commit eeb22e9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
4 changes: 4 additions & 0 deletions dist/assets/index-CRQUOndl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/assets/index-DlEL5neL.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
}
</style>

<script type="module" crossorigin src="assets/index-DlEL5neL.js"></script>
<script type="module" crossorigin src="assets/index-CRQUOndl.js"></script>
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<script type="module" src="/src/main.js"></script>

<title>Visor Territorial</title>
<style>
html,
Expand Down Expand Up @@ -291,7 +291,7 @@
</div>

<span id="openPanel" onclick="openPanel()">&#9776;</span>

<script type="module" src="./src/main.js"></script>

</body>

Expand Down
23 changes: 21 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async function geocoderRequest(text) {
}
}

function init() {
function initMap() {
map = new maplibregl.Map({
container: "map",
style:
Expand Down Expand Up @@ -292,5 +292,24 @@ function closePanel() {
infoPanel.style.width = "0px"; // Tancar el panell
document.getElementById("openPanel").style.display = "block"; // Mostrar el botó d'obrir quan el panell està tancat
}
function init() {
initMap();

const serveiSelector2 = document.getElementById("serveiSelector2");
serveiSelector2.addEventListener('change', onBaseChange);

// Altres funcions d'inicialització aquí si n'hi ha
const openPanelButton = document.getElementById("openPanel");
openPanelButton.addEventListener('click', openPanel);
const closePanelButton = document.getElementById("closePanel");
closePanelButton.addEventListener('click', closePanel);

const textInput = document.getElementById("textSelector");
textInput.addEventListener('change', () => {
const searchText = textInput.value;
geocoderRequest(searchText);
});
}

init();
// Executar la funció d'inicialització una vegada que tota la pàgina estigui carregada
window.addEventListener('DOMContentLoaded', init);

0 comments on commit eeb22e9

Please sign in to comment.