diff --git a/public/pages/index.html b/public/pages/index.html index d46c842..f28127a 100644 --- a/public/pages/index.html +++ b/public/pages/index.html @@ -5,38 +5,213 @@ Mrfluffy-dev - - + diff --git a/public/pages/people.js b/public/pages/people.js index 3f412e0..e05b033 100644 --- a/public/pages/people.js +++ b/public/pages/people.js @@ -1,8 +1,8 @@ async function loadPeople(name,id) { try { // fix name from spaces to dashes - name = name.replace(' ', '+'); - const response = await fetch(`http://localhost:4200/api/${name}`); + name = name.replace(/ /g, '+'); + const response = await fetch(`https://wars.mrfluffy.xyz/api/${name}`); const data = await response.json(); const peopleElement = document.getElementById('people'+id); // Clear any existing content @@ -23,4 +23,26 @@ async function loadPeople(name,id) { } catch (error) { console.error('Error loading people:', error); } +} + +// make a function to load the people it takes in to parameters name and name2 and and calles http://localhost:4200/battle/name/name2 plave the responce in id battle +async function loadBattle(name, name2) { + try { + // fix name from spaces to dashes + name = name.replace(/ /g, '+'); + name2 = name2.replace(/ /g, '+'); + const response = await fetch(`https://wars.mrfluffy.xyz/battle/${name}/${name2}`); + let data = await response.text(); // Assuming the response is plain text + const battleElement = document.getElementById('battle'); + // Clear any existing content + battleElement.innerHTML = ''; + // Create a div element for the battle + const battleDiv = document.createElement('div'); + // Replace all \n with
and set the text content using the battle story + battleDiv.innerHTML = data.replace(/\\n/g, '
'); + // Append the battleDiv element to the battleElement + battleElement.appendChild(battleDiv); + } catch (error) { + console.error('Error loading battle:', error); + } } \ No newline at end of file diff --git a/public/pages/style.css b/public/pages/style.css index 5a34604..91ea979 100644 --- a/public/pages/style.css +++ b/public/pages/style.css @@ -127,6 +127,13 @@ input[type="text"] { font-size: 32px; /* Change as needed */ } +#battle{ + font-family: 'Arial', sans-serif; /* Change as needed */ + color: #50fa7b; /* Change as needed */ + line-height: 1.6; + font-size: 20px; /* Change as needed */ +} + button { padding: 10px 20px; border: none;