This file contains hidden or 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
| const d = document, | |
| $site = d.getElementById("site"), | |
| $posts = d.getElementById("posts"), | |
| $loader = d.querySelector(".loader"), | |
| $template = d.getElementById("post-template"), | |
| $fragment = d.createDocumentFragment(), | |
| DOMAIN = "https://malvestida.com", | |
| SITE = `${DOMAIN}/wp-json`, | |
| API_WP = `${SITE}/wp/v2`, | |
| POSTS = `${API_WP}/posts?_embed`, |
This file contains hidden or 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
| // const d = document, | |
| // $site = d.getElementById("site"), | |
| // $posts = d.getElementById("posts"), | |
| // $loader = d.querySelector(".loader"), | |
| // $template = d.getElementById("post-template"), | |
| // $fragment = d.createDocumentFragment(), | |
| // DOMAIN = "https://malvestida.com", | |
| // SITE = `${DOMAIN}/wp-json`, | |
| // API_WP = `${SITE}/wp/v2`, | |
| // POSTS = `${API_WP}/posts`, |
This file contains hidden or 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
| const d = document, | |
| $shows = d.getElementById("shows"), | |
| $template = d.getElementById("show-template"), | |
| $fragment = d.createDocumentFragment(); | |
| d.addEventListener("keypress", async (e) => { | |
| if (e.target.matches("#search")) { | |
| // console.log(e.key, e.keyCode); | |
| if (e.key === "Enter") { | |
| try { |
This file contains hidden or 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
| // connect | |
| $dsn = 'mysql:host=nombre_de_servidor;dbname=nombre_de_base_de_datos'; | |
| $usuario = 'nombre_de_usuario'; | |
| $contraseña = 'contraseña'; | |
| try { | |
| $dbh = new PDO($dsn, $usuario, $contraseña); | |
| } catch (PDOException $e) { | |
| echo 'Conexión fallida: ' . $e->getMessage(); | |
| } |
This file contains hidden or 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
| const cut = (text, cut) => { | |
| return text.slice(0, cut); | |
| }; |
This file contains hidden or 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
| const contarChar = (dato) => { | |
| if (typeof dato === "string") { | |
| return dato.length; | |
| } | |
| if (typeof dato === "number") { | |
| let numToString = dato.toString(); | |
| return numToString.length; | |
| } | |
| if (typeof dato === "object") { | |
| let objToString = dato.toString(); |
NewerOlder