Primer Commit. Este codigo fue escrito en el año 2022
This commit is contained in:
113
Documentacion/index.js.html
Executable file
113
Documentacion/index.js.html
Executable file
@@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: index.js</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: index.js</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>import {carga} from "./lib/sys.js"
|
||||
var md = window.markdownit()
|
||||
var entradas
|
||||
|
||||
carga()
|
||||
.then(resp => {
|
||||
entradas = resp
|
||||
init()
|
||||
})
|
||||
|
||||
/**
|
||||
* # Funcion Init
|
||||
*
|
||||
* Esta funcion permite inicializar la pagina una vez se han cargado todos los elementos previos necesarios para el funcionamiento. Solo se ejecuta una vez por carga.
|
||||
*/
|
||||
|
||||
function init() {
|
||||
//Titulo del blog
|
||||
let titulo_b = document.createTextNode(entradas[0][0].sitio)
|
||||
titulo_blog.appendChild(titulo_b)
|
||||
|
||||
//descripcion del blog
|
||||
let descripcion_b = document.createTextNode(entradas[0][0].descripcion)
|
||||
descripcion_blog.appendChild(descripcion_b)
|
||||
|
||||
//cargar todas las entradas en orden invertido, tradicional para los blogs
|
||||
entradas[1].slice(0).reverse().map((resp,index) => {
|
||||
//construir los contenedores necesarios para las entradas
|
||||
let contenedor = document.createElement("div")
|
||||
let contenedor_post = document.createElement("div")
|
||||
let separador = document.createElement("hr")
|
||||
|
||||
//renderizar el contenido markdown en html
|
||||
contenedor_post.innerHTML = md.render(resp.contenido)
|
||||
|
||||
let meta = document.createElement("div")
|
||||
meta.innerHTML = `
|
||||
<div>
|
||||
<h3>`+ resp.titulo + `</h3>
|
||||
<a href="/editar?id=`+ resp.id + `"><small>Editar</small></a><br>
|
||||
<small><b>fecha de creación: </b>`+ resp.fecha_creacion + `</small><br>
|
||||
<small><b>fecha de modificacion: </b>`+ resp.fecha_modificacion + `</small><br>
|
||||
</div>
|
||||
<br>
|
||||
`
|
||||
contenedor.appendChild(meta)
|
||||
contenedor.appendChild(contenedor_post)
|
||||
contenedor.appendChild(separador)
|
||||
|
||||
post.appendChild(contenedor)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
||||
//https://developers.google.com/web/updates/2015/03/introduction-to-fetch si no fuera por esta pagina, nunca habria descubierto que habia que hacer un then al json() para obtener los datos
|
||||
//https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch ironicamente, aqui tambien esta la respuesta, pero no se nota tanto porque transforma la peticion a funcion asincrona para hacerle un await, por lo que el result.json() es parseado y regresado por el return
|
||||
//https://love2dev.com/blog/javascript-remove-from-array/ eliminar elementos de un array
|
||||
|
||||
//jsdoc -c jsdoc.conf js/index.js js/lib/sys.js README.md -d Documentacion
|
||||
//jsdoc -c jsdoc.conf -r ./js README.md -d Documentacion</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#actualizar">actualizar</a></li><li><a href="global.html#carga">carga</a></li><li><a href="global.html#init">init</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Thu Sep 23 2021 11:30:56 GMT-0500 (GMT-05:00)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user