-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80898d7
commit 0dc3c67
Showing
1 changed file
with
44 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: right; | ||
margin: 20px; | ||
} | ||
# Documentation | ||
|
||
h1 { | ||
color: #3498db; | ||
} | ||
<div id="documentation"></div> | ||
|
||
h2 { | ||
color: #2ecc71; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
<script> | ||
async function fetchAndDisplayDocumentation() { | ||
try { | ||
const response = await fetch('config.json'); | ||
const jsonData = await response.json(); | ||
|
||
li { | ||
margin-bottom: 10px; | ||
createDocumentation(jsonData); | ||
} catch (error) { | ||
console.error('Error fetching JSON:', error); | ||
} | ||
</style> | ||
<title>Documentation</title> | ||
</head> | ||
<body> | ||
|
||
<div id="documentation"></div> | ||
|
||
<script> | ||
async function fetchAndDisplayDocumentation() { | ||
try { | ||
const response = await fetch('http://localhost:3000/'); | ||
const jsonData = await response.json(); | ||
|
||
createDocumentation(jsonData); | ||
} catch (error) { | ||
console.error('Error fetching JSON:', error); | ||
} | ||
|
||
function createDocumentation(data) { | ||
const documentationDiv = document.getElementById('documentation'); | ||
|
||
const h1 = document.createElement('h1'); | ||
h1.textContent = data.name; | ||
documentationDiv.appendChild(h1); | ||
|
||
data.methods.forEach(method => { | ||
const h2 = document.createElement('h2'); | ||
h2.textContent = method.name; | ||
documentationDiv.appendChild(h2); | ||
|
||
const p = document.createElement('p'); | ||
p.textContent = `Method ${method.name}.`; | ||
documentationDiv.appendChild(p); | ||
|
||
if (method.parameters.length > 0) { | ||
const h3 = document.createElement('h3'); | ||
h3.textContent = 'Parameters'; | ||
documentationDiv.appendChild(h3); | ||
|
||
const ul = document.createElement('ul'); | ||
method.parameters.forEach(parameter => { | ||
const li = document.createElement('li'); | ||
li.textContent = parameter; | ||
ul.appendChild(li); | ||
}); | ||
documentationDiv.appendChild(ul); | ||
} | ||
} | ||
|
||
function createDocumentation(data) { | ||
const documentationDiv = document.getElementById('documentation'); | ||
|
||
const h1 = document.createElement('h1'); | ||
h1.textContent = data.name; | ||
documentationDiv.appendChild(h1); | ||
|
||
data.methods.forEach(method => { | ||
const h2 = document.createElement('h2'); | ||
h2.textContent = method.name; | ||
documentationDiv.appendChild(h2); | ||
|
||
const p = document.createElement('p'); | ||
p.textContent = "متد " + method.name + "."; | ||
documentationDiv.appendChild(p); | ||
|
||
if (method.parameters.length > 0) { | ||
const h3 = document.createElement('h3'); | ||
h3.textContent = "پارامترها"; | ||
documentationDiv.appendChild(h3); | ||
|
||
const ul = document.createElement('ul'); | ||
method.parameters.forEach(parameter => { | ||
const li = document.createElement('li'); | ||
li.textContent = parameter; | ||
ul.appendChild(li); | ||
}); | ||
documentationDiv.appendChild(ul); | ||
} | ||
}); | ||
} | ||
|
||
fetchAndDisplayDocumentation(); | ||
</script> | ||
}); | ||
} | ||
|
||
</body> | ||
</html> | ||
fetchAndDisplayDocumentation(); | ||
</script> |