├── numeros ├── notacion-exponencial.js ├── mayor-numeros-array.js ├── numeros-segun-localizacion.js └── mayor-de-dos-numeros-math.js ├── .gitignore ├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container └── .jsdtscope ├── dockerfile ├── apis ├── modernizr │ ├── polyfills │ │ ├── placeholder │ │ │ ├── placeholder.js │ │ │ ├── polyfill-placeholder.html │ │ │ └── jquery.placeholder.min.js │ │ └── fd-slider │ │ │ ├── polyfill-slider.html │ │ │ └── fd-slider.css │ ├── cargar-modernizr.html │ └── modernizr.js ├── javascriptsql │ ├── bases │ │ └── victor │ │ │ ├── paises.jsbd │ │ │ └── victor.jsbd │ └── consulta-jssql.html └── raphael │ └── figuras.html ├── basicos ├── dia-semana.html ├── confirmar-datos.html ├── funcion-argumentos-variables.html ├── operador-ternario-en-javascript.html ├── foreach.js ├── mayor-de-dos-numeros.js ├── variable-local.js ├── avisos.html ├── constante-javascript.js ├── variable-global.js ├── console-table.js ├── hola-mundo-javascript.html ├── for-of.html ├── for-in.html ├── pedir-datos.js ├── console-log.html ├── swapping-variables.js ├── pagina-con-pwd.html ├── convertir-segundos-a-formato-hora.html ├── convertir-cadena-texto-a-date.html └── comparar-con-fecha-sistema.html ├── dom ├── getElementById.html ├── cambiar-imagen │ ├── MT05.JPG │ ├── MT07.JPG │ └── cambiar-imagen.html ├── getElementsByName.html ├── crear-elemento-html.html ├── cambiar-tamanio-imagen │ ├── firefox.jpg │ └── cambiar-el-tamanio-de-la-imagen-de-forma-dinamica.html ├── eliminar-elementos-de-una-pagina.html ├── crear-documento-html-dinamicamente.html ├── hacer-foco-en-un-elemento-de-la-pagina.html ├── quitar-el-foco-de-un-elemento.html ├── inyectar-html.html ├── crear-estilos-css-online.html └── obtener-el-contenido-de-un-elemento-por-su-tag.html ├── pagina ├── volver-atras.html ├── url-del-documento.html ├── ver-codigo-fuente.html ├── imprimir-pagina-web.html ├── forward-en-el-historial.html ├── resolucion-de-pantalla.html ├── anadir-pagina-a-favoritos.html ├── poner-texto-barra-estado.html ├── numero-enlaces-del-documento.html ├── obtener-titulo-de-la-pagina.html ├── obtener-informacion-de-la-url.html ├── numero-de-elementos-del-historial.html ├── numero-imagenes-de-un-documento.html ├── obtener-la-pagina-de-referencia-del-documento.html ├── obtener-hash.html ├── obtener-el-dominio-de-url.html ├── eliminar-contenido-capa.html ├── cambiar-contenido-capa.html ├── cambiar-estilos-online.html └── modificar-enlace.html ├── cadenas ├── cadena-reverse.html ├── convertir-array-en-cadena.html ├── funcion-replace-javascript.html ├── dividir-una-cadena-en-elementos.html ├── implementandonos-funcion-replace.html ├── texto-con-formato-en-javascript.html ├── reemplazar-caracter.js ├── invertir-cadena-javascript.html ├── caracteres-escapados.html └── replace.html ├── ventanas ├── abrir-ventana.html ├── abrir-ventana-sin-redimension.html ├── cerrar-ventana.html └── abrir-y-cerrar-ventana.html ├── raton └── coordenadas-raton.html ├── validaciones ├── validar-cif.html ├── validar-email.html ├── ccTLD │ ├── ccTLDName.html │ └── ccTLD.js └── calculo-del-nif-en-javascript.html ├── formularios ├── buscar-en-lista.html ├── validar-numerico.html ├── validar-password.html ├── campos-obligatorios.html ├── multiplicar-numeros.html ├── contar-checkbox-activos.html ├── validar-numero-tarjeta.html ├── contar-caracteres-on-line.html ├── calculo-totales-subtotales.html ├── contar-caracteres-palabras.html ├── controlar-envio-formulario.html ├── checkbox-y-operadores-binarios.html ├── marcar-valor-combo-dinamicamente.html ├── cambiar-estado-radio-group.html └── numero-de-formularios.html ├── eventos ├── add-eventos-javascript.html ├── deshabilitar-boton-derecho.html ├── conocer-que-evento-se-ha-lanzado.html ├── detectar-que-boton-fue-pulsado.html └── detectar-que-elemento-fue-selecionado.html ├── browser └── nombre-version-navegador.html ├── teclado ├── controlar-pulsacion-tecla-shift.html └── capturar-tecla-f5.html ├── timers ├── ejecutar-metodo-cada-x-segundos.html ├── ejecutar-a-los-x-segundos.html ├── settimeout-con-parametros.html ├── hora-en-capa.html └── hora.html ├── matematicas ├── formulas.html ├── deg2Rad.js ├── factorial.js ├── esPrimo.js └── formulas.js ├── arrays ├── recorrer-array.js ├── rellenar-array.js ├── desestructurar-array.js ├── recorrer-matriz.js ├── rellenar-array-numeros-aleatorios.js ├── mayor-cinco-numeros.js ├── aplanar-array.js ├── array-push.js ├── inicializar-array.js └── multiplicar-matrices.js ├── readme.md ├── .project ├── funciones └── valores-por-defecto.js ├── objetos ├── unpacking-objetos.js ├── objeto-persona.js ├── objeto-rectangulo.js ├── objeto-rectangulo-atributos-privados.js ├── crear-propiedades-dinamicas.js ├── crear-metodos-dinamicamente.js ├── objeto-con-tostring.js ├── tipo-objeto.js ├── objeto-rectangulo-metodos-privados.js ├── multiples-constructores-call.js ├── multiples-constructores-apply.js ├── unpacking-iterar-objetos.js ├── unpacking-objetos-anidados.js ├── tiene-propiedad.js └── ejemplo-javascript-oo.js ├── i18n ├── digitos-significantes.js ├── formatear-divisas.js └── formatear-lista.js ├── regexp ├── unpacking-regexp.js ├── extraer-email.js └── extraer-url.js ├── fechas ├── formatear-horas.js ├── fechas-relativas-texto.js ├── formato-fecha-locale.js └── formatear-fecha.js ├── promesas └── crear-promesa.js └── selectores ├── queryselector.html ├── queryselector-id.html └── queryselector-class.html /numeros/notacion-exponencial.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | .project 3 | /working -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12.15 2 | COPY . /home/lineadecodigo 3 | CMD ["npm","install --save locale-es-es"] -------------------------------------------------------------------------------- /apis/modernizr/polyfills/placeholder/placeholder.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | 5 | $("input, textarea").placeholder(); -------------------------------------------------------------------------------- /basicos/dia-semana.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/basicos/dia-semana.html -------------------------------------------------------------------------------- /dom/getElementById.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/getElementById.html -------------------------------------------------------------------------------- /pagina/volver-atras.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/volver-atras.html -------------------------------------------------------------------------------- /cadenas/cadena-reverse.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/cadena-reverse.html -------------------------------------------------------------------------------- /dom/cambiar-imagen/MT05.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/cambiar-imagen/MT05.JPG -------------------------------------------------------------------------------- /dom/cambiar-imagen/MT07.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/cambiar-imagen/MT07.JPG -------------------------------------------------------------------------------- /dom/getElementsByName.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/getElementsByName.html -------------------------------------------------------------------------------- /ventanas/abrir-ventana.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/ventanas/abrir-ventana.html -------------------------------------------------------------------------------- /basicos/confirmar-datos.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/basicos/confirmar-datos.html -------------------------------------------------------------------------------- /dom/crear-elemento-html.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/crear-elemento-html.html -------------------------------------------------------------------------------- /pagina/url-del-documento.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/url-del-documento.html -------------------------------------------------------------------------------- /pagina/ver-codigo-fuente.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/ver-codigo-fuente.html -------------------------------------------------------------------------------- /raton/coordenadas-raton.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/raton/coordenadas-raton.html -------------------------------------------------------------------------------- /validaciones/validar-cif.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/validaciones/validar-cif.html -------------------------------------------------------------------------------- /formularios/buscar-en-lista.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/buscar-en-lista.html -------------------------------------------------------------------------------- /pagina/imprimir-pagina-web.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/imprimir-pagina-web.html -------------------------------------------------------------------------------- /validaciones/validar-email.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/validaciones/validar-email.html -------------------------------------------------------------------------------- /eventos/add-eventos-javascript.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/eventos/add-eventos-javascript.html -------------------------------------------------------------------------------- /formularios/validar-numerico.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/validar-numerico.html -------------------------------------------------------------------------------- /formularios/validar-password.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/validar-password.html -------------------------------------------------------------------------------- /pagina/forward-en-el-historial.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/forward-en-el-historial.html -------------------------------------------------------------------------------- /pagina/resolucion-de-pantalla.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/resolucion-de-pantalla.html -------------------------------------------------------------------------------- /validaciones/ccTLD/ccTLDName.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/validaciones/ccTLD/ccTLDName.html -------------------------------------------------------------------------------- /apis/modernizr/cargar-modernizr.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/apis/modernizr/cargar-modernizr.html -------------------------------------------------------------------------------- /browser/nombre-version-navegador.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/browser/nombre-version-navegador.html -------------------------------------------------------------------------------- /formularios/campos-obligatorios.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/campos-obligatorios.html -------------------------------------------------------------------------------- /formularios/multiplicar-numeros.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/multiplicar-numeros.html -------------------------------------------------------------------------------- /pagina/anadir-pagina-a-favoritos.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/anadir-pagina-a-favoritos.html -------------------------------------------------------------------------------- /pagina/poner-texto-barra-estado.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/poner-texto-barra-estado.html -------------------------------------------------------------------------------- /cadenas/convertir-array-en-cadena.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/convertir-array-en-cadena.html -------------------------------------------------------------------------------- /cadenas/funcion-replace-javascript.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/funcion-replace-javascript.html -------------------------------------------------------------------------------- /dom/cambiar-imagen/cambiar-imagen.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/cambiar-imagen/cambiar-imagen.html -------------------------------------------------------------------------------- /dom/cambiar-tamanio-imagen/firefox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/cambiar-tamanio-imagen/firefox.jpg -------------------------------------------------------------------------------- /eventos/deshabilitar-boton-derecho.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/eventos/deshabilitar-boton-derecho.html -------------------------------------------------------------------------------- /formularios/contar-checkbox-activos.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/contar-checkbox-activos.html -------------------------------------------------------------------------------- /formularios/validar-numero-tarjeta.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/validar-numero-tarjeta.html -------------------------------------------------------------------------------- /pagina/numero-enlaces-del-documento.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/numero-enlaces-del-documento.html -------------------------------------------------------------------------------- /pagina/obtener-titulo-de-la-pagina.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/obtener-titulo-de-la-pagina.html -------------------------------------------------------------------------------- /basicos/funcion-argumentos-variables.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/basicos/funcion-argumentos-variables.html -------------------------------------------------------------------------------- /dom/eliminar-elementos-de-una-pagina.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/eliminar-elementos-de-una-pagina.html -------------------------------------------------------------------------------- /formularios/contar-caracteres-on-line.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/contar-caracteres-on-line.html -------------------------------------------------------------------------------- /pagina/obtener-informacion-de-la-url.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/obtener-informacion-de-la-url.html -------------------------------------------------------------------------------- /basicos/operador-ternario-en-javascript.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/basicos/operador-ternario-en-javascript.html -------------------------------------------------------------------------------- /cadenas/dividir-una-cadena-en-elementos.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/dividir-una-cadena-en-elementos.html -------------------------------------------------------------------------------- /cadenas/implementandonos-funcion-replace.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/implementandonos-funcion-replace.html -------------------------------------------------------------------------------- /cadenas/texto-con-formato-en-javascript.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/cadenas/texto-con-formato-en-javascript.html -------------------------------------------------------------------------------- /dom/crear-documento-html-dinamicamente.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/crear-documento-html-dinamicamente.html -------------------------------------------------------------------------------- /eventos/conocer-que-evento-se-ha-lanzado.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/eventos/conocer-que-evento-se-ha-lanzado.html -------------------------------------------------------------------------------- /eventos/detectar-que-boton-fue-pulsado.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/eventos/detectar-que-boton-fue-pulsado.html -------------------------------------------------------------------------------- /formularios/calculo-totales-subtotales.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/calculo-totales-subtotales.html -------------------------------------------------------------------------------- /formularios/contar-caracteres-palabras.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/contar-caracteres-palabras.html -------------------------------------------------------------------------------- /formularios/controlar-envio-formulario.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/controlar-envio-formulario.html -------------------------------------------------------------------------------- /pagina/numero-de-elementos-del-historial.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/numero-de-elementos-del-historial.html -------------------------------------------------------------------------------- /pagina/numero-imagenes-de-un-documento.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/numero-imagenes-de-un-documento.html -------------------------------------------------------------------------------- /teclado/controlar-pulsacion-tecla-shift.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/teclado/controlar-pulsacion-tecla-shift.html -------------------------------------------------------------------------------- /timers/ejecutar-metodo-cada-x-segundos.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/timers/ejecutar-metodo-cada-x-segundos.html -------------------------------------------------------------------------------- /ventanas/abrir-ventana-sin-redimension.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/ventanas/abrir-ventana-sin-redimension.html -------------------------------------------------------------------------------- /dom/hacer-foco-en-un-elemento-de-la-pagina.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/hacer-foco-en-un-elemento-de-la-pagina.html -------------------------------------------------------------------------------- /formularios/checkbox-y-operadores-binarios.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/checkbox-y-operadores-binarios.html -------------------------------------------------------------------------------- /eventos/detectar-que-elemento-fue-selecionado.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/eventos/detectar-que-elemento-fue-selecionado.html -------------------------------------------------------------------------------- /formularios/marcar-valor-combo-dinamicamente.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/formularios/marcar-valor-combo-dinamicamente.html -------------------------------------------------------------------------------- /pagina/obtener-la-pagina-de-referencia-del-documento.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/pagina/obtener-la-pagina-de-referencia-del-documento.html -------------------------------------------------------------------------------- /apis/javascriptsql/bases/victor/paises.jsbd: -------------------------------------------------------------------------------- 1 | _aux['paises']=Array(); 2 | _aux['paises']=[ 3 | [1,"Noruega"], 4 | [2,"Portugal"], 5 | [3,"Francia"], 6 | [4,"Italia"], 7 | [5,"UK"] 8 | ]; 9 | -------------------------------------------------------------------------------- /dom/cambiar-tamanio-imagen/cambiar-el-tamanio-de-la-imagen-de-forma-dinamica.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorcuervo/lineadecodigo_javascript/HEAD/dom/cambiar-tamanio-imagen/cambiar-el-tamanio-de-la-imagen-de-forma-dinamica.html -------------------------------------------------------------------------------- /apis/javascriptsql/bases/victor/victor.jsbd: -------------------------------------------------------------------------------- 1 | _bd={ 2 | "paises":{ 3 | "IdPais":"numeric", 4 | "Pais":"string", 5 | } 6 | }; 7 | _bd_ind={ 8 | 'paises':[false,false] 9 | }; 10 | _bd_pag={ 11 | 'paises':0 12 | }; 13 | -------------------------------------------------------------------------------- /matematicas/formulas.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Formulas Matemáticas 6 | 7 | 8 |

Formulas Matemáticas

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /arrays/recorrer-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file recorrer-array.js 3 | * @version 2.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 21/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/recorrer-un-array-en-javascript/ 7 | * @description Recorrer los elementos de un array en Javascript 8 | */ 9 | 10 | var a=[1,2,3,4,5,6,7,8,9,10]; 11 | for (x=0;x 2 | 3 | lineadecodigo_javascript 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.wst.jsdt.core.jsNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /matematicas/deg2Rad.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file deg2Rad.js 3 | * @version 1.0 4 | * @author Víctor Cuervo (http://lineadecodigo.com) 5 | * @date 20/marzo/2023 6 | * @url http://lineadecodigo.com/javascript/pdte/ 7 | * @description Convertir grados a radianes para funciones trigonométricas 8 | */ 9 | 10 | function deg2Rad(deg){ 11 | return deg * (Math.PI/180.0); 12 | } 13 | 14 | console.log(deg2Rad(0)); 15 | console.log(deg2Rad(90)); 16 | console.log(deg2Rad(180)); 17 | console.log(deg2Rad(270)); 18 | console.log(deg2Rad(360)); -------------------------------------------------------------------------------- /arrays/rellenar-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file rellenar-array.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 13/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/rellenar-un-array-con-numeros-en-javascript/ 7 | * @description Rellena los elementos de un array con un valor mediante un método fill. 8 | */ 9 | 10 | 11 | let miarray = new Array(10); 12 | miarray.fill(2,0,10); 13 | 14 | miarray.forEach(function(item,index,arr){ 15 | console.log("Posición " + index + ": " + item); 16 | }); -------------------------------------------------------------------------------- /arrays/desestructurar-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file desestructurar-array.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 20/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/desestructurar-arrays-javascript/ 7 | * @description Realizar una desectructuración de un array 8 | */ 9 | 10 | var miarray = [1,2,3,4,5]; 11 | var [a,b] = miarray; 12 | 13 | console.log(a); 14 | console.log(b); 15 | 16 | var [x,y, ...resto] = miarray; 17 | 18 | console.log(x); 19 | console.log(y); 20 | console.log(resto); 21 | -------------------------------------------------------------------------------- /arrays/recorrer-matriz.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file recorrer-matriz.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 7/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/recorrer-una-matriz-con-javascript/ 7 | * @description Recorrer los elementos de una matriz en Javascript 8 | */ 9 | 10 | const matriz = [[1,2,3],[4,5,6],[7,8,9]]; 11 | 12 | for (x=0;x Math.floor(Math.random() * 10)); 12 | 13 | miarray.forEach(function(item,index,arr){ 14 | console.log(item); 15 | }); -------------------------------------------------------------------------------- /arrays/mayor-cinco-numeros.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mayor-cinco-numeros.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 2/julio/2017 6 | * @url http://lineadecodigo.com/javascript/mayor-cinco-numeros-javascript/ 7 | * @description Calcular el mayor de 5 números con Javascript 8 | */ 9 | 10 | numeros = [5,2,9,4,8]; 11 | 12 | numeroMayor = numeros[0]; 13 | 14 | for (x=1;x numeroMayor) 16 | numeroMayor = numeros[x]; 17 | } 18 | 19 | console.log('El número mayor es: ' + numeroMayor); -------------------------------------------------------------------------------- /funciones/valores-por-defecto.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file valores-por-defecto.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 28/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/valores-por-defecto-en-una-funcion-javascript/ 7 | * @description Cómo asignar valores por defecto a parámetros de una función 8 | */ 9 | 10 | function mifuncion({tamanio = 'XL', color = 'rojo'} = {}) { 11 | console.log(tamanio,color); 12 | } 13 | 14 | mifuncion({color:'verde'}); 15 | mifuncion({tamanio:'L', color:'azul'}); 16 | mifuncion(); 17 | -------------------------------------------------------------------------------- /objetos/unpacking-objetos.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file unpacking-objetos.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/unpacking-objetos-javascript/ 7 | * @description Realizar un unpacking de un objeto sobre variables 8 | */ 9 | 10 | 11 | var objeto = {x:"Saludo", y:3} 12 | console.log (objeto.y); 13 | 14 | // Unpacking 15 | var {x,y} = objeto; 16 | console.log(x); 17 | 18 | // Cambiando el nombre de las propiedades 19 | var {x:a, y:b} = objeto; 20 | console.log(a); 21 | -------------------------------------------------------------------------------- /basicos/foreach.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file foreachjs 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 30/enero/2021 6 | * @url http://lineadecodigo.com/javascript/bucle-foreach-en-javascript/ 7 | * @description Realizar un bucle foreach para recorrer una lista de elementos 8 | */ 9 | 10 | // Con variable intermedia 11 | const paises=['España','Francia','Holanda','EEUU','Jordania','Australia','Egipto','Japón']; 12 | 13 | paises.forEach(function(item,index) { 14 | console.log("El país " + item + " está en la posición " + index); 15 | } 16 | ); -------------------------------------------------------------------------------- /basicos/mayor-de-dos-numeros.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mayor-de-dos-numeros.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 28/mayo/2023 6 | * @url http://lineadecodigo.com/javascript/mayor-de-dos-numeros-en-javascript/ 7 | * @description Saber cual de los dos números es mayor. 8 | */ 9 | 10 | 11 | let n1 = 5; 12 | let n2 = 2; 13 | 14 | if (n1>n2) { 15 | console.log(n1 + " es mayor que " + n2); 16 | } else if (n2 > n1) { 17 | console.log(n2 + " es mayor que " + n1); 18 | } else { 19 | console.log("Los dos números osn iguales"); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /basicos/variable-local.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file variable-local.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 14/febrero/2021 6 | * @url https://lineadecodigo.com/javascript/variables-locales-en-javascript/ 7 | * @description Variables locales en Javascript 8 | */ 9 | 10 | 11 | let x=0; 12 | 13 | while (x<10) { 14 | let numero = x; 15 | x++; 16 | } 17 | 18 | console.log(x); 19 | 20 | try { 21 | console.log(numero); 22 | } catch(error) { 23 | console.log("No se puede acceder a una variable local. " + error); 24 | } 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /numeros/numeros-segun-localizacion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file numeros-segun-localizacion.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 15/febrero/2020 6 | * @url http://lineadecodigo.com/javascript/numeros-en-javascript-segun-locale/ 7 | * @description Formatear un número para que aparezca en su localización 8 | */ 9 | 10 | const numero = 11223.48; 11 | 12 | // Español 13 | console.log(numero.toLocaleString("es-ES")); 14 | // Inglés Americano 15 | console.log(numero.toLocaleString("en-US")); 16 | // Árabe 17 | console.log(numero.toLocaleString("ar-EG")); -------------------------------------------------------------------------------- /basicos/avisos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Avisos 6 | 7 | 8 |

Avisos

9 | 10 | 13 | 14 | 15 |

16 |
17 | Artículo disponible en: http://lineadecodigo.com/javascript/mostrar-avisos-en-javascript/
18 | lineadecodigo.com 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /arrays/aplanar-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file aplanararray.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 7/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/aplanar-arrays-en-javascript/ 7 | * @description Código que nos permite aplanar los elementos de un array 8 | */ 9 | 10 | const a=[[1,2],[3,[4,5],6],[7],[8,9,10]]; 11 | 12 | // Recorrer el array multidimensional 13 | for (x=0;x { 13 | console.log(new Intl.NumberFormat('es-ES', { maximumSignificantDigits: 2 }).format(element)); 14 | }); 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /basicos/console-table.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file console-table.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 14/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/mostrar-tablas-por-consola-en-javascript/ 7 | * @description Muestra la salida en consola como si fuese una tabla 8 | */ 9 | 10 | 11 | function Persona(nombre,edad){ 12 | this.nombre = nombre; 13 | this.edad = edad; 14 | } 15 | 16 | p1 = new Persona("Marta",36); 17 | p2 = new Persona("Luis",12); 18 | p3 = new Persona("Javier",43); 19 | 20 | console.table([p1,p2,p3]); 21 | 22 | console.table([p1,p2,p3],['edad']); -------------------------------------------------------------------------------- /basicos/hola-mundo-javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mi primer Código con Javascript 6 | 7 | 8 | 9 |

Mi primer Código con JavaScript

10 | 11 | 14 | 15 |

16 |
17 | Artículo disponible en: "http://lineadecodigo.com/javascript/hola-mundo-en-javascript/
18 | lineadecodigo.com 19 | 20 | 21 | -------------------------------------------------------------------------------- /matematicas/esPrimo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file esPrimo.js 3 | * @version 1.0 4 | * @author Víctor Cuervo (http://lineadecodigo.com) 5 | * @date 31/enero/2021 6 | * @url http://lineadecodigo.com/javascript/numeros-primos-del-1-al-100-en-javascript/ 7 | * @description Cálculo de los números primos del 1 al 100 8 | */ 9 | 10 | 11 | function esPrimo(numero) { 12 | 13 | for(let i = 2,raiz=Math.sqrt(numero); i <= raiz; i++) 14 | if(numero % i === 0) return false; 15 | return numero > 1; 16 | } 17 | 18 | for (let x=0;x<=100;x++) { 19 | if (esPrimo(x)) 20 | console.log("El número " + x + " es primo"); 21 | } -------------------------------------------------------------------------------- /regexp/unpacking-regexp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file unpacking-regexp.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/unpacking-de-valores-con-expresiones-regulares-en-javascript/ 7 | * @description Unpacking de valores con expresiones regulares 8 | */ 9 | 10 | 11 | var cadena = 'Buenos días Juan, ¿Te gustó Ávila?'; 12 | var cadena_analizada = /días ([^]+),[^]+gustó ([^]+)\?/.exec(cadena); 13 | 14 | console.log(cadena_analizada); 15 | 16 | var [,nombre,ciudad] = cadena_analizada; 17 | 18 | console.log(nombre); 19 | console.log(ciudad); 20 | -------------------------------------------------------------------------------- /objetos/objeto-persona.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file objeto-persona.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/ 7 | * @description Definir un objeto Persona con Javascript 8 | */ 9 | 10 | function persona(nombre,apellido,edad){ 11 | this.nombre = nombre; 12 | this.apellido = apellido; 13 | this.edad = edad; 14 | } 15 | 16 | var p1 = new persona("victor","cuervo",32); 17 | var p2 = new persona("ignacio","santos",33); 18 | 19 | console.log(p1.nombre + "-" + p1.edad); 20 | console.log(p2.nombre + "-" + p2.edad); 21 | -------------------------------------------------------------------------------- /objetos/objeto-rectangulo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file objeto-rectangulo.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/ 7 | * @description Definir un objeto Rectángulo con Javascript 8 | */ 9 | 10 | function rectangulo(base,altura){ 11 | this.base = base; 12 | this.altura = altura; 13 | this.calcularArea = function() { return this.base*this.altura; }; 14 | } 15 | 16 | var r1 = new rectangulo(2,6); 17 | 18 | console.log("Un rectangulo de " + r1.base + "x" + r1.altura + " tiene un área de " + r1.calcularArea()); 19 | -------------------------------------------------------------------------------- /pagina/obtener-hash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Obtener hash de la Página 6 | 7 | 8 |

Obtener hash de la Página

9 | 10 | 14 | 15 |

16 |
17 | Artículo disponible en: http://lineadecodigo.com/javascript/acceder-al-hash-de-la-url-con-javascript/
18 | lineadecodigo.com 19 | 20 | 21 | -------------------------------------------------------------------------------- /arrays/array-push.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file array-push.js 3 | * @version 2.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 20/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/anadir-elementos-a-un-array-con-javascript-push/ 7 | * @description Manejar un método .push en Javascript 8 | */ 9 | 10 | console.log("Antes del Push"); 11 | 12 | var nombres = ["victor","pedro"]; 13 | for (name in nombres) 14 | console.log(nombres[name]); 15 | 16 | console.log("Después del Push"); 17 | nombres.push("juan"); 18 | nombres.push("maría"); 19 | nombres.push("irene"); 20 | nombres.push("juan"); 21 | 22 | for (name in nombres) 23 | console.log(nombres[name]); 24 | -------------------------------------------------------------------------------- /basicos/for-of.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Javascript For Of 6 | 7 | 8 |

Javascript For Of

9 | 10 | 15 | 16 | 17 |

18 |
19 | Artículo disponible en: http://lineadecodigo.com/javascript/estructura-javascript-for-of/
20 | lineadecodigo.com 21 | 22 | 23 | -------------------------------------------------------------------------------- /cadenas/reemplazar-caracter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file reemplazar-caracter.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 14/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/reemplazar-por-posicion-con-javascript/ 7 | * @description Reemplazar el caracter concreto de una cadena 8 | */ 9 | 10 | String.prototype.replaceAt = function(index, replacement) { 11 | return this.substr(0, index) + replacement + this.substr(index + replacement.length); 12 | } 13 | 14 | 15 | let cadena = "Soy una cadena"; 16 | console.log(cadena); 17 | 18 | cadena = cadena.replaceAt(3,"_"); 19 | cadena = cadena.replaceAt(7,"_"); 20 | 21 | console.log(cadena); -------------------------------------------------------------------------------- /basicos/for-in.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Javascript For In 6 | 7 | 8 |

Javascript For In

9 | 10 | 15 | 16 | 17 |

18 |
19 | Artículo disponible en: http://lineadecodigo.com/javascript/estructura-javascript-for-in/
20 | lineadecodigo.com 21 | 22 | 23 | -------------------------------------------------------------------------------- /fechas/formatear-horas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formatear-horas.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 15/febrero/2020 6 | * @url http://lineadecodigo.com/javascript/formato-de-horas-en-javascript/ 7 | * @description Utilización del método .toLocaleTimeString para dar formato a una hora dependiendo de la localización. 8 | */ 9 | 10 | // Definimos una fecha 11 | const fecha = new Date('February 15, 2020 20:52:30 GMT+00:00'); 12 | 13 | // El formato americano lo pondrá en AM/PM 14 | console.log(fecha.toLocaleTimeString('en-US')); 15 | 16 | 17 | // El formato español lo pondrá en un formato 24h 18 | console.log(fecha.toLocaleTimeString('es-ES')); -------------------------------------------------------------------------------- /basicos/pedir-datos.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file pedir-datos.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 13/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/pedir-datos-con-prompt-en-javascript/ 7 | * @description Pedir un dato mediante un prompt 8 | */ 9 | 10 | let valor1 = prompt("Dame el valor 1",0); 11 | let valor2 = prompt("Dame el valor 2",0); 12 | 13 | console.log("El contenido de un prompt es del tipo: " + typeof(valor1)); 14 | 15 | valor1 = (valor1=="")?"0":valor1; 16 | valor2 = (valor2=="")?"0":valor2; 17 | 18 | let suma = parseInt(valor1) + parseInt(valor2); 19 | 20 | console.log("La suma de " + valor1 + "+" + valor2 + " es " + suma); -------------------------------------------------------------------------------- /i18n/formatear-divisas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formatear-divisas.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 23/septiembre/2020 6 | * @url http://lineadecodigo.com/javascript/formatear-divisas-en-javascript/ 7 | * @description Ejemplo que nos explica cómo dar formato a las divisas 8 | */ 9 | 10 | 11 | const cantidad = 1235.64; 12 | 13 | console.log(new Intl.NumberFormat('es-ES', { style: 'currency', currency: 'EUR' }).format(cantidad)); 14 | console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(cantidad)); 15 | console.log(new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(cantidad)); 16 | 17 | -------------------------------------------------------------------------------- /regexp/extraer-email.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file extraer-email.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/xxx/ 7 | * @description Extraer un email mediante una expresión regular y el uso del operador de destructuring en Javascript 8 | */ 9 | 10 | 11 | var email = 'juan.sanchez@gmail.com'; 12 | var email_analizado = /^([^]+)@(\w+).(\w+)$/.exec(email); 13 | 14 | console.log(email_analizado); 15 | 16 | var [,nombre,servidor,dominio] = email_analizado; 17 | 18 | console.log('Nombre del usuario: ' + nombre); 19 | console.log('Servidor de Correo: ' + servidor); 20 | console.log('Dominio: ' + dominio); 21 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /promesas/crear-promesa.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crear-promesa.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 25/enero/2024 6 | * @url http://lineadecodigo.com/javascript/crear-promesa-en-javascript/ 7 | * @description Crear una promesa en Javascript. 8 | */ 9 | 10 | let promesa = new Promise((resolve, reject) => { 11 | 12 | let numero = Math.floor(Math.random()*6+1); 13 | 14 | if (numero == 6) { 15 | resolve({ "mensaje":"Tenemos un 6"}); 16 | } else { 17 | reject({ "mensaje":"Número No Obtenido", "numero":numero}); 18 | } 19 | }); 20 | 21 | promesa.then(resolve => resolve.mensaje, reject => `${reject.mensaje}. Salió ${reject.numero}`).then((value)=>console.log(value)); -------------------------------------------------------------------------------- /regexp/extraer-url.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file extraer-url.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/extraer-partes-de-una-url-en-javascript/ 7 | * @description Extraer partes de una URL mediante una expresión regular y el uso del operador de destructuring en Javascript 8 | */ 9 | 10 | 11 | var url = 'https://www.manualweb.net/java/tipos-datos-primitivos/'; 12 | var url_analizada = /^(\w+):\/\/([^\/]+)([^]+)$/.exec(url); 13 | 14 | console.log(url_analizada); 15 | 16 | var [,protocolo,servidor,path] = url_analizada; 17 | 18 | console.log('Protocolo: ' + protocolo); 19 | console.log('Servidor: ' + servidor); 20 | console.log('Path: ' + path); 21 | -------------------------------------------------------------------------------- /fechas/fechas-relativas-texto.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file fechas-relativas-texto.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 09/febrero/2020 6 | * @url http://lineadecodigo.com/javascript/fechas-relativas-en-javascript/ 7 | * @description Utilizar formatos relativos para poner en texto fechas.s 8 | */ 9 | 10 | // Si eliminas la propiedad numeric lo muestra en números. 11 | const rtf1 = new Intl.RelativeTimeFormat('es-ES', { style: 'long', numeric:'auto' }); 12 | 13 | // Dentro de tres trimestres 14 | console.log(rtf1.format(3, 'quarter')); 15 | 16 | // El mes pasado 17 | console.log(rtf1.format(-1, 'month')); 18 | 19 | // Ayer 20 | console.log(rtf1.format(-1, 'day')); 21 | 22 | // Pasado mañana 23 | console.log(rtf1.format(2, 'day')); 24 | -------------------------------------------------------------------------------- /objetos/objeto-rectangulo-atributos-privados.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file objeto-rectangulo-atributos-privados.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/crear-un-objeto-con-metodos-en-javascript/ 7 | * @description Definir atributos privados en Javascript 8 | */ 9 | 10 | function rectangulo(base,altura){ 11 | var base = base; 12 | var altura = altura; 13 | this.calcularArea = function() { return base*altura; } 14 | this.getBase = function() {return base;} 15 | this.getAltura = function() {return altura;} 16 | 17 | } 18 | 19 | var r1 = new rectangulo(2,6); 20 | console.log("Un rectangulo de " + r1.getBase() + "x" + r1.getAltura() + " tiene un área de " + r1.calcularArea()); 21 | -------------------------------------------------------------------------------- /objetos/crear-propiedades-dinamicas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crear-propiedades-dinamicas.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/crear-propiedades-dinamicas-en-javascript/ 7 | * @description Crear propiedades dinámicamente con Javascript 8 | */ 9 | 10 | function persona(nombre,apellido,edad){ 11 | this.nombre = nombre; 12 | this.apellido = apellido; 13 | this.edad = edad; 14 | } 15 | 16 | var p1 = new persona("victor","cuervo","32"); 17 | persona.prototype.ciudad = "Avila"; 18 | 19 | var p2 = new persona(); 20 | p2.nombre = "Juan"; 21 | p2.apellido = "Sin Tierra"; 22 | p2.edad = "45"; 23 | 24 | console.log("Ciudad: " + p1.ciudad); 25 | console.log("Ciudad: " + p2.ciudad); 26 | -------------------------------------------------------------------------------- /basicos/console-log.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Javascript Console.log 6 | 7 | 8 |

Javascript console.log

9 | Mira en tu consola Javascript. 10 | 11 | 23 | 24 |

25 |
26 | Artículo disponible en: http://lineadecodigo.com/javascript/volcar-datos-a-consola-con-javascript-console-log/
27 | lineadecodigo.com 28 | 29 | 30 | -------------------------------------------------------------------------------- /numeros/mayor-de-dos-numeros-math.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mayor-de-dos-numeros-math.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 28/mayo/2023 6 | * @url http://lineadecodigo.com/javascript/mayor-de-dos-numeros-en-javascript-con-math/ 7 | * @description Saber cual de los dos números es mayor con el objeto Math 8 | */ 9 | 10 | let n1 = 5; 11 | let n2 = 2; 12 | 13 | // Con estructuras 14 | if (n1>n2) 15 | console.log("El mayor de los números " + n1 + " y " + n2 + " es " + n1); 16 | else if (n2>n1) 17 | console.log("El mayor de los números " + n1 + " y " + n2 + " es " + n2); 18 | else 19 | console.log("Los números " + n1 + " y " + n2 + " son iguales"); 20 | 21 | // Con Math 22 | console.log("El mayor de los números " + n1 + " y " + n2 + " es " + Math.max(n1,n2)); 23 | -------------------------------------------------------------------------------- /i18n/formatear-lista.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formatear-listas.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 23/septiembre/2020 6 | * @url http://lineadecodigo.com/javascript/formatear-listas-en-javascript/ 7 | * @description Nos permite dar formato a la extracción de elementos de una lista. 8 | */ 9 | 10 | 11 | const ciudades = ['Avila','Salamanca','Segovia']; 12 | 13 | const formatter = new Intl.ListFormat('es', { style: 'long', type: 'conjunction' }); 14 | console.log(formatter.format(ciudades)); 15 | 16 | const formatter2 = new Intl.ListFormat('es', { style: 'long', type: 'disjunction' }); 17 | console.log(formatter2.format(ciudades)); 18 | 19 | const formatter3 = new Intl.ListFormat('es', { style: 'narrow', type: 'unit' }); 20 | console.log(formatter3.format(ciudades)); -------------------------------------------------------------------------------- /objetos/crear-metodos-dinamicamente.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file crear-metodos-dinamicamente.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/crear-metodos-dinamicamente-en-javascript/ 7 | * @description Crear métodos dinámicamente con Javascript 8 | */ 9 | 10 | function rectangulo(base,altura){ 11 | this.base = base; 12 | this.altura = altura; 13 | } 14 | 15 | r1 = new rectangulo(2,4); 16 | r2 = new rectangulo(4,8); 17 | 18 | rectangulo.prototype.calcularArea = function() { return this.base*this.altura; }; 19 | 20 | console.log("Un rectangulo de " + r1.base + "x" + r1.altura + " tiene un área de " + r1.calcularArea()); 21 | console.log("Un rectangulo de " + r2.base + "x" + r2.altura + " tiene un área de " + r2.calcularArea()); 22 | -------------------------------------------------------------------------------- /objetos/objeto-con-tostring.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file objeto-con-tostring.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/sobrescribir-el-metodo-tostring-en-javascript/ 7 | * @description Crear un método .toString() en un objeto Javascript 8 | */ 9 | 10 | function persona(nombre,apellido,edad){ 11 | this.nombre = nombre; 12 | this.apellido = apellido; 13 | this.edad = edad; 14 | this.toString = function() { return this.nombre + " " + this.apellido + ". " + this.edad + " años"; }; 15 | } 16 | 17 | var p1 = new persona("Victor","Cuervo",32); 18 | console.log(p1.toString()); 19 | 20 | persona.prototype.toString = function toString() { return this.nombre + " " + this.apellido + ". " + this.edad + " años"; } 21 | console.log(p1.toString()); 22 | -------------------------------------------------------------------------------- /objetos/tipo-objeto.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tipo-objeto.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/tipo-de-objeto-en-javascript/ 7 | * @description Tipo de objeto en Javascript 8 | */ 9 | 10 | var x = new String("Cadena de Texto"); 11 | 12 | if (x instanceof String) 13 | console.log("El objeto es de tipo String"); 14 | else 15 | console.log("El objeto NO es de tipo String"); 16 | 17 | 18 | function rectangulo(base,altura){ 19 | this.base = base; 20 | this.altura = altura; 21 | this.calcularArea = function() { return this.base*this.altura; }; 22 | } 23 | 24 | var r1 = new rectangulo(2,6); 25 | 26 | if (r1 instanceof rectangulo) 27 | console.log("El objeto es de tipo Rectangulo"); 28 | else 29 | console.log("El objeto NO es de tipo rectangulo"); 30 | -------------------------------------------------------------------------------- /fechas/formato-fecha-locale.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formato-fechas-locale.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 15/marzo/2020 6 | * @url http://lineadecodigo.com/javascript/fechas-en-formato-local-con-javascript/ 7 | * @description Mostrar una fecha en formato de texto atendiendo a un locale concreto. 8 | */ 9 | 10 | const fecha = new Date(Date.UTC(2020, 02, 15, 12, 0, 0)); 11 | 12 | const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; 13 | 14 | // Castellano 15 | console.log(fecha.toLocaleDateString('es-ES', options)); 16 | 17 | // Alemán 18 | console.log(fecha.toLocaleDateString('de-DE', options)); 19 | 20 | // Árabe 21 | console.log(fecha.toLocaleDateString('ar-EG', options)); 22 | 23 | // Por defecto del sistema 24 | console.log(fecha.toLocaleDateString(undefined, options)); 25 | -------------------------------------------------------------------------------- /basicos/swapping-variables.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file swapping-variables.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/swapping-variables-javascript/ 7 | * @description Realizar un intercambio de variables 8 | */ 9 | 10 | // Con variable intermedia 11 | var x = 1; 12 | var y = 2; 13 | 14 | console.log('Variable x con valor:' + x); 15 | console.log('Variable y con valor:' + y); 16 | 17 | var z = x; 18 | x = y; 19 | y = z; 20 | 21 | console.log('Variable x con valor:' + x); 22 | console.log('Variable y con valor:' + y); 23 | 24 | // Con Swapping 25 | var a = 1; 26 | var b = 2; 27 | 28 | console.log('Variable a con valor:' + a); 29 | console.log('Variable b con valor:' + b); 30 | 31 | [a,b] = [b,a]; 32 | 33 | console.log('Variable a con valor:' + a); 34 | console.log('Variable b con valor:' + b); 35 | -------------------------------------------------------------------------------- /fechas/formatear-fecha.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formatear-fecha.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 15/febrero/2020 6 | * @url http://lineadecodigo.com/javascript/formato-de-fechas-en-javascript/ 7 | * @description Manejo del método Intl.DateTimeFormat para dar formato a las fechas. 8 | */ 9 | 10 | // Definimos una fecha 11 | const fecha = new Date('February 15, 2020 20:52:30 GMT+00:00'); 12 | 13 | // En inglés americano se pone primero el mes y luego el día. 14 | console.log(new Intl.DateTimeFormat('en-US',{dateStyle:'short'}).format(fecha)); 15 | console.log(new Intl.DateTimeFormat('en-US',{dateStyle:'full'}).format(fecha)); 16 | 17 | // Es formato español se pone primero el día y luego el mes. 18 | console.log(new Intl.DateTimeFormat('es-ES',{dateStyle:'short'}).format(fecha)); 19 | console.log(new Intl.DateTimeFormat('es-ES',{dateStyle:'full',calendar:'islamic'}).format(fecha)); 20 | -------------------------------------------------------------------------------- /objetos/objeto-rectangulo-metodos-privados.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file objeto-rectangulo-metodos-privados.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/clase-javascript-con-metodos-privados/ 7 | * @description Definir métodos privados en Javascript 8 | */ 9 | 10 | function rectangulo(base,altura){ 11 | var base = base; 12 | var altura = altura; 13 | this.calcularArea = function() { return base*altura; }; 14 | this.getBase = function() {return base;} 15 | this.getAltura = function() {return altura;} 16 | 17 | this.inc = function() { incBase(); incAltura(); }; 18 | 19 | function incBase() { base++; } 20 | function incAltura() { altura++; } 21 | } 22 | 23 | var r1 = new rectangulo(2,6); 24 | r1.inc(); 25 | 26 | console.log("Un rectangulo de " + r1.getBase() + "x" + r1.getAltura() + " tiene un �rea de " + r1.calcularArea()); 27 | -------------------------------------------------------------------------------- /timers/ejecutar-a-los-x-segundos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ejecutar a los X segundos 6 | 11 | 12 | 13 | 14 |

Ejecutar a los X segundos

15 | 16 | 17 | 18 |

19 |
20 | Artículo disponible en: http://lineadecodigo.com/2007/11/19/ejecutar-cuando-pasen-x-segundos-en-javascript/
21 | lineadecodigo.com 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /arrays/inicializar-array.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file inicializar-array.js 3 | * @version 2.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 21/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/inicializar-un-array-en-javascript/ 7 | * @description Inicializar un array en Javascript 8 | */ 9 | 10 | var ciudades = new Array("Avila","Salamanca","Zamora","León"); 11 | 12 | var ciudades2 = new Array(4); 13 | ciudades2[0] = "Avila"; 14 | ciudades2[1] = "Salamanca"; 15 | ciudades2[2] = "Zamora"; 16 | ciudades2[3] = "León"; 17 | 18 | var mixto = new Array("Victor",34,true); 19 | 20 | console.log("Listado el primer array"); 21 | for (x=0;x 2 | 3 | 4 | 5 | Cerrar ventana 6 | 7 | 8 |

Cerrar ventana

9 | 10 | 13 | 14 | Cerrar la ventana 15 | 16 |

17 |
18 | Artículo disponible en: http://lineadecodigo.com/javascript/cerrar-una-ventana-con-javascript/
19 | lineadecodigo.com 20 | 21 | 22 | -------------------------------------------------------------------------------- /objetos/multiples-constructores-apply.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file multiples-constructores-apply.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/creando-clases-en-javascript-con-apply/ 7 | * @description Uso de apply para crear múltiples constructores 8 | */ 9 | 10 | function persona(nombre,apellido,edad,direccion,cp,ciudad){ 11 | datosbasicos.apply(this,arguments); 12 | domicilio.apply(this,arguments); 13 | } 14 | 15 | function datosbasicos(nombre,apellido,edad,direccion,cp,ciudad) { 16 | this.nombre = nombre; 17 | this.apellido = apellido; 18 | this.edad = edad; 19 | } 20 | 21 | function domicilio(nombre,apellido,edad,direccion,cp,ciudad){ 22 | this.direccion = direccion; 23 | this.cp = cp; 24 | this.ciudad = ciudad; 25 | } 26 | 27 | var p1 = new persona("victor","cuervo","33","calle del pez,3","28001","Madrid"); 28 | 29 | console.log("Mi código postal es " + p1.cp); 30 | -------------------------------------------------------------------------------- /pagina/obtener-el-dominio-de-url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Obtener el dominio de la URL 6 | 7 | 8 |

Obtener el dominio de la URL

9 | 10 | 11 | 18 | 19 |

20 |
21 | Artículo disponible en: http://lineadecodigo.com/2008/01/18/obtener-el-dominio-de-la-url-con-javascript/
22 | lineadecodigo.com 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /basicos/pagina-con-pwd.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Página con Password 6 | 7 | 17 | 18 | 19 | 20 | 21 | 22 |

Página con Password

23 | 24 | 25 | Contenido secreto 26 | 27 |

28 |
29 | Artículo disponible en: "http://lineadecodigo.com/javascript/protegiendo-la-pagina-en-javascript/
30 | lineadecodigo.com 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /teclado/capturar-tecla-f5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Capturar tecla F5 6 | 7 | 8 | 20 | 21 | 22 | 23 |

Capturar tecla F5

24 | 25 | Prueba a pulsar la tecla F5... 26 | 27 | 28 |

29 |
30 | Artículo disponible en: http://lineadecodigo.com/java/capturar-la-tecla-f5-con-javascript/
31 | lineadecodigo.com 32 | 33 | 34 | -------------------------------------------------------------------------------- /objetos/unpacking-iterar-objetos.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file unpacking-iterar-objetos.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 29/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/unpacking-iterando-objetos-en-javascript/ 7 | * @description Realizar un unpacking e iterar sobre los elementos de un objeto 8 | */ 9 | 10 | 11 | var autor = { 12 | nombre: 'Santiago Posteguillo', 13 | libros: [ 14 | { 15 | titulo: 'Africanus, el hijo del cónsul', 16 | trilogia:'Escipion' 17 | }, 18 | { 19 | titulo: 'Las Legiones Malditas', 20 | trilogia:'Escipion' 21 | }, 22 | { 23 | titulo: 'Los Asesinos del Emperador', 24 | trilogia:'Trajano' 25 | }, 26 | { 27 | titulo: 'Circo Máximo', 28 | trilogia:'Trajano' 29 | } 30 | ] 31 | } 32 | 33 | 34 | // Unpacking 35 | var {nombre} = autor; 36 | console.log(nombre); 37 | 38 | var {libros} = autor; 39 | for (var {titulo} of libros) 40 | console.log(titulo); 41 | -------------------------------------------------------------------------------- /selectores/queryselector.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | API QuerySelector 6 | 7 | 8 |

API QuerySelector

9 | 10 | 11 |
Esto es un mensaje
12 | 13 | 14 | 28 | 29 | 30 |









31 |
32 | Artículo disponible en: http://lineadecodigo.com/javascript/api-queryselector/
33 | lineadecodigo.com 34 | 35 | 36 | -------------------------------------------------------------------------------- /pagina/eliminar-contenido-capa.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Eliminar Contenido Capa 6 | 7 | 8 |

Eliminar Contenido Capa

9 | 10 |
Contenido de mi capa... 11 |
12 | 13 |
14 | Fin del contenido de mi capa 15 |
16 | 17 | 18 | 19 | 20 | 21 | 32 | 33 | 34 |

35 |
36 | Artículo disponible en: http://lineadecodigo.com/javascript/borrar-contenido-capa-javascript/
37 | lineadecodigo.com 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /dom/quitar-el-foco-de-un-elemento.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Quitar el foco de un elemento 6 | 12 | 13 | 14 |

Quitar el foco de un elemento

15 | 16 | 17 | 18 |
19 | Pon el cursor sobre el campo:
20 | 21 |
22 | 23 | 24 |

25 |
26 | Artículo disponible en: http://lineadecodigo.com/2008/01/19/quitar-el-foco-de-un-elemento/
27 | lineadecodigo.com 28 | 29 | 30 | -------------------------------------------------------------------------------- /ventanas/abrir-y-cerrar-ventana.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Abrir y cerrar ventana 6 | 17 | 18 | 19 | 20 |

Abrir y cerrar ventana

21 | 22 | Abrir ventana (a los 5 segundos se cerrara) 23 | 24 |

25 |
26 | Artículo disponible en: http://lineadecodigo.com/2008/03/23/abrir-y-cerrar-una-ventana/
27 | lineadecodigo.com 28 | 29 | 30 | -------------------------------------------------------------------------------- /selectores/queryselector-id.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Acceder a un ID con API QuerySelector 6 | 7 | 8 |

Acceder a un ID con QuerySelector

9 | 10 | 11 |
Esto es un mensaje
12 | 13 | 14 | 29 | 30 | 31 |









32 |
33 | Artículo disponible en: http://lineadecodigo.com/html5/obtener-id-con-api-queryselector/
34 | lineadecodigo.com 35 | 36 | 37 | -------------------------------------------------------------------------------- /timers/settimeout-con-parametros.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetTimeout y Función con parámetros 6 | 7 | 8 | 9 |

SetTimeout y Función con parámetros

10 | Abre la consola Javascript. 11 | 12 | 46 | 47 |

48 |
49 | Artículo disponible en: http://lineadecodigo.com/javascript/settimeout-con-parametros/
50 | lineadecodigo.com 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /objetos/unpacking-objetos-anidados.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file unpacking-objetos-anidados.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 29/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/unpacking-objetos-anidados-javascript/ 7 | * @description Realizar un unpacking de un objetos anidados 8 | */ 9 | 10 | 11 | var autor = { 12 | nombre: 'Santiago Posteguillo', 13 | libros: [ 14 | { 15 | titulo: 'Africanus, el hijo del cónsul', 16 | trilogia:'Escipion' 17 | }, 18 | { 19 | titulo: 'Las Legiones Malditas', 20 | trilogia:'Escipion' 21 | }, 22 | { 23 | titulo: 'Los Asesinos del Emperador', 24 | trilogia:'Trajano' 25 | }, 26 | { 27 | titulo: 'Circo Máximo', 28 | trilogia:'Trajano' 29 | } 30 | ] 31 | } 32 | 33 | console.log("--Usando Objetos--"); 34 | console.log(autor.nombre); 35 | console.log(autor.libros[0].titulo); 36 | 37 | // Unpacking 38 | console.log("--Usando Unpacking--"); 39 | var {nombre} = autor; 40 | console.log(nombre); 41 | 42 | var {libros: [{titulo}]} = autor; 43 | console.log(titulo); 44 | -------------------------------------------------------------------------------- /basicos/convertir-segundos-a-formato-hora.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Convertir segundos a formato hora en Javascript 6 | 7 | 8 |

Convertir segundos a formato hora en Javascript

9 | 25 | 26 |

27 |
28 | Artículo disponible en: http://lineadecodigo.com/javascript/convertir-segundos-en-formato-hora-con-javascript/
29 | lineadecodigo.com 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /selectores/queryselector-class.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Acceder a una Clase con API QuerySelector 6 | 7 | 8 |

Acceder a una Clase con API QuerySelector

9 | 10 | 11 | 12 |
    13 |
  • Item 1
  • 14 |
  • Item 2
  • 15 |
  • Item 3
  • 16 |
  • Item 4
  • 17 |
  • Item 5
  • 18 |
19 | 20 | 21 | 33 | 34 | 35 |









36 |
37 | Artículo disponible en: http://lineadecodigo.com/javascript/acceder-una-clase-con-queryselector/
38 | lineadecodigo.com 39 | 40 | 41 | -------------------------------------------------------------------------------- /apis/modernizr/polyfills/placeholder/polyfill-placeholder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PlaceHolder Modernizr Polyfill 6 | 7 | 13 | 14 | 15 | 16 |

PlaceHolder Modernizr Polyfill

17 | 18 |
19 | 20 |
21 | 22 |

23 |
24 | Artículo disponible en: http://lineadecodigo.com/javascript/como-utilizar-un-polyfill-con-modernizr/
25 | lineadecodigo.com 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /objetos/tiene-propiedad.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tiene-propiedad.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/saber-si-un-objeto-tiene-una-propiedad-con-javascript/ 7 | * @description Saber si un objeto tiene una propiedad en concreto 8 | */ 9 | 10 | function rectangulo(base,altura){ 11 | this.base = base; 12 | var altura = altura; 13 | this.calcularArea = function() { return this.base*this.altura; }; 14 | this.getBase = function() {return base;} 15 | this.getAltura = function() {return altura;} 16 | } 17 | 18 | var r1 = new rectangulo(2,3); 19 | 20 | if (r1.hasOwnProperty("base")) 21 | console.log("El objeto tiene la propiedad BASE"); 22 | else 23 | console.log("El objeto NO tiene la propiedad BASE"); 24 | 25 | 26 | if (r1.hasOwnProperty("altura")) 27 | console.log("El objeto tiene la propiedad ALTURA"); 28 | else 29 | console.log("El objeto NO tiene la propiedad ALTURA"); 30 | 31 | 32 | if (r1.hasOwnProperty("area")) 33 | console.log("El objeto tiene la propiedad AREA"); 34 | else 35 | console.log("El objeto NO tiene la propiedad AREA"); 36 | -------------------------------------------------------------------------------- /pagina/cambiar-contenido-capa.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cambiar el contenido de una capa 6 | 11 | 12 | 13 |

Cambiar el contenido de una capa

14 | 15 |
Contenido de mi capa...
16 | 17 |
18 | 19 | 20 |
21 | 22 |

23 |
24 | Artículo disponible en: http://lineadecodigo.com/2008/03/03/cambiar-el-contenido-de-una-capa-con-javascript/
25 | lineadecodigo.com 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /cadenas/invertir-cadena-javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Invertir una cadena con Javascript 6 | 7 | 8 | 9 |

Invertir una cadena con Javascript

10 | 11 | 12 | 31 | 32 |

33 |
34 | Artículo disponible en: http://lineadecodigo.com/javascript/invertir-una-cadena-en-javascript/
35 | lineadecodigo.com 36 | 37 | 38 | -------------------------------------------------------------------------------- /dom/inyectar-html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Inyectar HTML 6 | 7 | 8 |

Inyectar HTML

9 | 10 |
    11 |
  • Elemento
  • 12 |
13 | 14 | 15 | 16 | 17 | 32 | 33 | 34 |

35 |
36 | Artículo disponible en: http://lineadecodigo.com/javascript/insertar-codigo-html-en-una-pagina-web-insertadjacenthtml/
37 | lineadecodigo.com 38 | 39 | 40 | -------------------------------------------------------------------------------- /objetos/ejemplo-javascript-oo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ejemplo-javascript-oo.js 3 | * @version 1.0 4 | * @author Fernando Carraro Aguirre 5 | * @date 27/agosto/2017 6 | * @url http://lineadecodigo.com/javascript/programacion-orientada-a-objetos-con-javascript-un-sencillo-ejemplo/ 7 | * @description Ejemplo básico de programación orientada a objetos con Javascript 8 | */ 9 | 10 | // Constructor de la clase 11 | function Economica(valor,tasa,periodo){ 12 | this.valor=valor; 13 | this.tasa=tasa; 14 | this.periodo=periodo; 15 | this.desplegarResultado=desplegarResultado; // Método para mostrar el resultado 16 | } 17 | 18 | // Método para obtener el resultado de la operación 19 | function desplegarResultado(){ 20 | var valorFuturo=parseFloat(this.valor)*Math.pow(1+parseFloat(this.tasa)/100,parseInt(this.periodo)); 21 | console.log("Valor futuro: "+valorFuturo*"\n"); 22 | var result="Valor: "+this.valor+"\nTasa: "+this.tasa+"\nPeriodo: "+this.periodo; 23 | result+="\nResultado: "+valorFuturo.toString(); 24 | console.log(result); 25 | } 26 | 27 | var valor = 2; 28 | var tasa= 4; 29 | var periodo= 1; 30 | 31 | // Objeto de tipo Economica 32 | obj1=new Economica(parseFloat(valor),parseFloat(tasa),parseInt(periodo)); 33 | obj1.desplegarResultado(); 34 | -------------------------------------------------------------------------------- /cadenas/caracteres-escapados.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Caracteres escapados 6 | 7 | 14 | 15 | 16 | 17 |

Caracteres escapados

18 | 19 |
20 |
21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 | 29 |

30 |
31 | Artículo disponible en: http://lineadecodigo.com/javascript/escapar-caracteres-en-javascript/
32 | lineadecodigo.com 33 | 34 | 35 | -------------------------------------------------------------------------------- /validaciones/calculo-del-nif-en-javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Calcular NIF 4 | 5 | 20 | 21 | 22 | 23 |

24 | Calculo del NIF

25 |
26 | NIF: 27 | - 29 | 30 |
31 | 32 |

33 |
34 | Artículo disponible en: http://lineadecodigo.com/javascript/calculo-del-nif-en-javascript/
35 | lineadecodigo.com 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /formularios/cambiar-estado-radio-group.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cambiar el estado de un radio group 6 | 11 | 12 | 13 | 14 |

Cambiar el estado de un radio group

15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 |
25 | 26 |

27 |
28 | Artículo disponible en: http://lineadecodigo.com/2008/02/04/buscar-en-la-lista/
29 | lineadecodigo.com 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /pagina/cambiar-estilos-online.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cambiar estilos online 6 | 7 | 12 | 13 | 18 | 19 | 20 | 21 |

Cambiar estilos online

22 | 23 |
24 | 25 | 26 |
27 | 28 |

29 |
30 | Artículo disponible en: http://lineadecodigo.com/javascript/cambiar-estilos-dinamicamente/
31 | lineadecodigo.com 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /formularios/numero-de-formularios.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Numero de formularios 6 | 7 | 8 |

Numero de formularios

9 | 10 |

Datos personales

11 |
12 |
13 | 14 |
15 | 16 |

Datos de la incidencia

17 |
18 | 19 |
20 | 21 |
22 | 23 |
24 | 25 |
26 | 27 | 30 | 31 |

32 |
33 | Artículo disponible en: http://lineadecodigo.com/2008/02/27/cuantos-formularios-hay-en-mi-pagina/
34 | lineadecodigo.com 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /dom/crear-estilos-css-online.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Crear estilos CSS on-line 6 | 23 | 24 | 25 |

Crear estilos CSS on-line

26 | 27 | Este es un documento que crea estilos CSS on-line.
28 | 29 | 30 |

31 |
32 | Artículo disponible en: http://lineadecodigo.com/2008/01/21/crear-estilos-css-on-line/
33 | lineadecodigo.com 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /apis/javascriptsql/consulta-jssql.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Consulta con JavascriptSQL 6 | 7 | 8 | 9 |

Consulta con JavascriptSQL

10 | 11 | 34 | 35 |

36 |
37 | Artículo disponible en: http://lineadecodigo.com/javascript/jssql-un-motor-de-base-de-datos-en-javascript/
38 | lineadecodigo.com 39 | 40 | 41 | -------------------------------------------------------------------------------- /apis/modernizr/polyfills/fd-slider/polyfill-slider.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Polyfill Slider 6 | 7 | 14 | 15 | 16 | 17 | 18 |

Polyfill Slider

19 | 20 | 21 | 22 | 23 | 33 | 34 |

35 |
36 | Artículo disponible en: http://lineadecodigo.com/jquery/crear-un-slider-con-jquery/
37 | lineadecodigo.com 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /cadenas/replace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Replace 6 | 21 | 22 | 23 | 24 | 25 |

Replace

26 | 27 |
28 | 29 |
30 | Cadena 1:
31 | Cadena 2: 32 | 33 |
34 | 35 |

36 |
37 | Artículo disponible en: http://lineadecodigo.com/2007/08/07/funcion-replace-en-javascript/
38 | lineadecodigo.com 39 | 40 | 41 | -------------------------------------------------------------------------------- /matematicas/formulas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file formulas.js 3 | * @version 1.1 4 | * @author Víctor Cuervo (http://lineadecodigo.com) 5 | * @date 02/agosto/2015 6 | * @url http://lineadecodigo.com/tag/javascript-math/ 7 | * @description Fichero con diferentes formulas matemáticas para Javascript 8 | */ 9 | 10 | 11 | function formulas() { 12 | 13 | /* Área de un círculo */ 14 | this.areaCirculo = function (radio) { 15 | return Math.PI * Math.pow(radio,2); 16 | } 17 | 18 | /* Área Triángulo */ 19 | this.areaTriangulo = function (base,altura) { 20 | return (base*altura)/2; 21 | } 22 | 23 | /* Número Aleatorio */ 24 | this.aleatorio = function (maximo) { 25 | return parseInt(Math.random()*maximo+1); 26 | } 27 | 28 | /* Calcular la hipotenusa */ 29 | this.hipotenusa = Math.hypot || function() { 30 | var y = 0; 31 | var length = arguments.length; 32 | 33 | for (var i = 0; i < length; i++) { 34 | if (arguments[i] === Infinity || arguments[i] === -Infinity) { 35 | return Infinity; 36 | } 37 | y += arguments[i] * arguments[i]; 38 | } 39 | return Math.sqrt(y); 40 | }; 41 | 42 | } 43 | 44 | 45 | var f = new formulas(); 46 | console.log ("El área de un círculo de radio 2 es " + f.areaCirculo(2)); 47 | 48 | console.log("Generar 10 números aleatorios"); 49 | for (x=0;x<10;x++) { 50 | // Números aleatorios entre 1 y 10 51 | console.log (f.aleatorio(10)); 52 | } 53 | 54 | console.log ("La hipotenusa de un triángulo de catetos 3 y 2 es: " + f.hipotenusa(3, 2)); -------------------------------------------------------------------------------- /timers/hora-en-capa.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Reloj en una capa 6 | 9 | 35 | 36 | 37 | 38 | 39 |

Reloj en una capa

40 |
41 | 42 |

43 |
44 | Artículo disponible en: http://lineadecodigo.com/javascript/reloj-javascript-en-una-capa/
45 | lineadecodigo.com 46 | 47 | 48 | -------------------------------------------------------------------------------- /arrays/multiplicar-matrices.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @file multiplicar-matrices.js 3 | * @version 1.0 4 | * @author Víctor Cuervo - http://lineadecodigo.com 5 | * @date 7/febrero/2021 6 | * @url http://lineadecodigo.com/javascript/multiplicar-matrices-en-javascript/ 7 | * @description Código que nos multiplica matrices en Javascript 8 | */ 9 | 10 | function multiplicarMatriz(m1,m2) { 11 | 12 | fil_m1 = m1.length; 13 | col_m1 = m1[0].length; 14 | 15 | fil_m2 = m2.length; 16 | col_m2 = m2[0].length; 17 | 18 | if (col_m1 != fil_m2) 19 | throw "No se pueden multiplicar las matrices"; 20 | 21 | let multiplicacion = new Array(fil_m1); 22 | for (x=0; x 2 | 3 | 4 | 5 | Convertir una cadena de texto a un objeto Date 6 | 7 | 8 | 9 |

Convertir una cadena de texto a un objeto Date

10 | 11 | 12 |
13 | / 14 | / 15 |
16 | 17 |

18 | 19 | 20 | 40 | 41 |

42 |
43 | Artículo disponible en: http://lineadecodigo.com/javascript/convertir-una-cadena-a-fecha-en-javascript/
44 | lineadecodigo.com 45 | 46 | 47 | -------------------------------------------------------------------------------- /timers/hora.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hora en JavaScript 6 | 31 | 32 | 33 | 34 |

Hora en JavaScript

35 | 36 | 37 |
38 | 39 | 40 |
41 | 42 | 43 | 44 |

45 |
46 | Artículo disponible en: http://lineadecodigo.com/javascript/reloj-en-javascript/
47 | lineadecodigo.com 48 | 49 | 50 | -------------------------------------------------------------------------------- /dom/obtener-el-contenido-de-un-elemento-por-su-tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Obtener el contenido de un elemento por su tag 6 | 7 | 21 | 22 | 23 | 24 | 25 |

Obtener el contenido de un elemento por su tag

26 | 31 | 32 | 35 | 36 |

37 |
38 | Artículo disponible en: http://lineadecodigo.com/2007/08/17/obtener-el-contenido-de-un-elemento-conociendo-su-tag/
39 | lineadecodigo.com 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /apis/raphael/figuras.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Figuras con Raphaël 6 | 7 | 8 | 9 | 10 |

Figuras con Raphaël

11 | 12 | 42 | 43 | 44 |

45 |
46 | Artículo disponible en: http://lineadecodigo.com/javascript/usando-raphael-para-dibujar-algunas-formas-en-multiples-navegadores/
47 | lineadecodigo.com 48 | 49 | 50 | -------------------------------------------------------------------------------- /basicos/comparar-con-fecha-sistema.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Comparar con fecha del sistema 6 | 7 | 8 |

Comparar con fecha del sistema

9 | 10 |
11 | / 12 | / 13 |
14 | 15 |

16 | 17 | 18 | 44 | 45 |

46 |
47 | Artículo disponible en: http://lineadecodigo.com/javascript/comparar-con-la-fecha-del-sistema-en-javascript/
48 | lineadecodigo.com 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /pagina/modificar-enlace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Modificar el enlace 6 | 17 | 18 | 19 | 20 | 21 | 22 |

Modificar el enlace

23 | 24 |

Enlace

25 | Google 26 | 27 |

Modificar el enlace

28 |
29 |
30 |
31 | 32 |
38 | 39 |
40 | 41 | 42 |

43 |
44 | Artículo disponible en: http://lineadecodigo.com/2008/02/29/modificar-los-enlaces-con-javascript/
45 | lineadecodigo.com 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /apis/modernizr/polyfills/placeholder/jquery.placeholder.min.js: -------------------------------------------------------------------------------- 1 | /*! http://mths.be/placeholder v2.0.3 by @mathias */ 2 | ;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){return this.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder').end()};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;e.call(m)}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder')}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery)); -------------------------------------------------------------------------------- /validaciones/ccTLD/ccTLD.js: -------------------------------------------------------------------------------- 1 | extensions = new Array( 2 | ['.ac','Ascension Island'], 3 | ['.ad','Andorra'], 4 | ['.ae','United Arab Emirates'], 5 | ['.af','Afghanistan'], 6 | ['.ag','Antigua and Barbuda'], 7 | ['.ai','Anguilla'], 8 | ['.al','Albania'], 9 | ['.am','Armenia'], 10 | ['.an','Netherlands Antilles'], 11 | ['.ao','Angola'], 12 | ['.aq','Antarctica'], 13 | ['.ar','Argentina'], 14 | ['.as','American Samoa'], 15 | ['.at','Austria'], 16 | ['.au','Australia'], 17 | ['.aw','Aruba'], 18 | ['.az','Azerbaijan'], 19 | ['.ba','Bosnia and Herzegovina'], 20 | ['.bb','Barbados'], 21 | ['.bd','Bangladesh'], 22 | ['.be','Belgium'], 23 | ['.bf','Burkina Faso'], 24 | ['.bg','Bulgaria'], 25 | ['.bh','Bahrain'], 26 | ['.bi','Burundi'], 27 | ['.bj','Benin'], 28 | ['.bm','Bermuda'], 29 | ['.bn','Brunei Darussalam'], 30 | ['.bo','Bolivia'], 31 | ['.br','Brazil'], 32 | ['.bs','Bahamas'], 33 | ['.bt','Bhutan'], 34 | ['.bv','Bouvet Island'], 35 | ['.bw','Botswana'], 36 | ['.by','Belarus'], 37 | ['.bz','Belize'], 38 | ['.ca','Canada'], 39 | ['.cc','Cocos (Keeling) Islands'], 40 | ['.cd','Congo, Democratic Republic of the'], 41 | ['.cf','Central African Republic'], 42 | ['.cg','Congo, Republic of'], 43 | ['.ch','Switzerland'], 44 | ['.ci','Cote d\'Ivoire'], 45 | ['.ck','Cook Islands'], 46 | ['.cl','Chile'], 47 | ['.cm','Cameroon'], 48 | ['.cn','China'], 49 | ['.co','Colombia'], 50 | ['.cr','Costa Rica'], 51 | ['.cu','Cuba'], 52 | ['.cv','Cap Verde'], 53 | ['.cx','Christmas Island'], 54 | ['.cy','Cyprus'], 55 | ['.cz','Czech Republic'], 56 | ['.de','Germany'], 57 | ['.dj','Djibouti'], 58 | ['.dk','Denmark'], 59 | ['.dm','Dominica'], 60 | ['.do','Dominican Republic'], 61 | ['.dz','Algeria'], 62 | ['.ec','Ecuador'], 63 | ['.ee','Estonia'], 64 | ['.eg','Egypt'], 65 | ['.eh','Western Sahara'], 66 | ['.er','Eritrea'], 67 | ['.es','Spain'], 68 | ['.et','Ethiopia'], 69 | ['.fi','Finland'], 70 | ['.fj','Fiji'], 71 | ['.fk','Falkland Islands (Malvina)'], 72 | ['.fm','Micronesia, Federal State of'], 73 | ['.fo','Faroe Islands'], 74 | ['.fr','France'], 75 | ['.ga','Gabon'], 76 | ['.gd','Grenada'], 77 | ['.ge','Georgia'], 78 | ['.gf','French Guiana'], 79 | ['.gg','Guernsey'], 80 | ['.gh','Ghana'], 81 | ['.gi','Gibraltar'], 82 | ['.gl','Greenland'], 83 | ['.gm','Gambia'], 84 | ['.gn','Guinea'], 85 | ['.gp','Guadeloupe'], 86 | ['.gq','Equatorial Guinea'], 87 | ['.gr','Greece'], 88 | ['.gs','South Georgia and the South Sandwich Islands'], 89 | ['.gt','Guatemala'], 90 | ['.gu','Guam'], 91 | ['.gw','Guinea'], 92 | ['.gy','Guyana'], 93 | ['.hk','Hong Kong'], 94 | ['.hm','Heard and McDonald Islands'], 95 | ['.hn','Honduras'], 96 | ['.hr','Croatia/Hrvatska'], 97 | ['.ht','Haiti'], 98 | ['.hu','Hungary'], 99 | ['.id','Indonesia'], 100 | ['.ie','Ireland'], 101 | ['.il','Israel'], 102 | ['.im','Isle of Man'], 103 | ['.in','India'], 104 | ['.io','British Indian Ocean Territory'], 105 | ['.iq','Iraq'], 106 | ['.ir','Iran (Islamic Republic of)'], 107 | ['.is','Iceland'], 108 | ['.it','Italy'], 109 | ['.je','Jersey'], 110 | ['.jm','Jamaica'], 111 | ['.jo','Jordan'], 112 | ['.jp','Japan'], 113 | ['.ke','Kenya'], 114 | ['.kg','Kyrgyzstan'], 115 | ['.kh','Cambodia'], 116 | ['.ki','Kiribati'], 117 | ['.km','Comoros'], 118 | ['.kn','Saint Kitts and Nevis'], 119 | ['.kp','Korea, Democratic People\'s Republic'], 120 | ['.kr','Korea, Republic of'], 121 | ['.kw','Kuwait'], 122 | ['.ky','Cayman Islands'], 123 | ['.kz','Kazakhstan'], 124 | ['.la','Lao People\'s Democratic Republic'], 125 | ['.lb','Lebanon'], 126 | ['.lc','Saint Lucia'], 127 | ['.li','Liechtenstein'], 128 | ['.lk','Sri Lanka'], 129 | ['.lr','Liberia'], 130 | ['.ls','Lesotho'], 131 | ['.lt','Lithuania'], 132 | ['.lu','Luxembourg'], 133 | ['.lv','Latvia'], 134 | ['.ly','Libyan Arab Jamahiriya'], 135 | ['.ma','Morocco'], 136 | ['.mc','Monaco'], 137 | ['.md','Moldova, Republic of'], 138 | ['.mg','Madagascar'], 139 | ['.mh','Marshall Islands'], 140 | ['.mk','Macedonia, Former Yugoslav Republic'], 141 | ['.ml','Mali'], 142 | ['.mm','Myanmar'], 143 | ['.mn','Mongolia'], 144 | ['.mo','Macau'], 145 | ['.mp','Northern Mariana Islands'], 146 | ['.mq','Martinique'], 147 | ['.mr','Mauritania'], 148 | ['.ms','Montserrat'], 149 | ['.mt','Malta'], 150 | ['.mu','Mauritius'], 151 | ['.mv','Maldives'], 152 | ['.mw','Malawi'], 153 | ['.mx','Mexico'], 154 | ['.my','Malaysia'], 155 | ['.mz','Mozambique'], 156 | ['.na','Namibia'], 157 | ['.nc','New Caledonia'], 158 | ['.ne','Niger'], 159 | ['.nf','Norfolk Island'], 160 | ['.ng','Nigeria'], 161 | ['.ni','Nicaragua'], 162 | ['.nl','Netherlands'], 163 | ['.no','Norway'], 164 | ['.np','Nepal'], 165 | ['.nr','Nauru'], 166 | ['.nu','Niue'], 167 | ['.nz','New Zealand'], 168 | ['.om','Oman'], 169 | ['.pa','Panama'], 170 | ['.pe','Peru'], 171 | ['.pf','French Polynesia'], 172 | ['.pg','Papua New Guinea'], 173 | ['.ph','Philippines'], 174 | ['.pk','Pakistan'], 175 | ['.pl','Poland'], 176 | ['.pm','St. Pierre and Miquelon'], 177 | ['.pn','Pitcairn Island'], 178 | ['.pr','Puerto Rico'], 179 | ['.ps','Palestinian Territories'], 180 | ['.pt','Portugal'], 181 | ['.pw','Palau'], 182 | ['.py','Paraguay'], 183 | ['.qa','Qatar'], 184 | ['.re','Reunion Island'], 185 | ['.ro','Romania'], 186 | ['.ru','Russian Federation'], 187 | ['.rw','Rwanda'], 188 | ['.sa','Saudi Arabia'], 189 | ['.sb','Solomon Islands'], 190 | ['.sc','Seychelles'], 191 | ['.sd','Sudan'], 192 | ['.se','Sweden'], 193 | ['.sg','Singapore'], 194 | ['.sh','St. Helena'], 195 | ['.si','Slovenia'], 196 | ['.sj','Svalbard and Jan Mayen Islands'], 197 | ['.sk','Slovak Republic'], 198 | ['.sl','Sierra Leone'], 199 | ['.sm','San Marino'], 200 | ['.sn','Senegal'], 201 | ['.so','Somalia'], 202 | ['.sr','Suriname'], 203 | ['.st','Sao Tome and Principe'], 204 | ['.sv','El Salvador'], 205 | ['.sy','Syrian Arab Republic'], 206 | ['.sz','Swaziland'], 207 | ['.tc','Turks and Caicos Islands'], 208 | ['.td','Chad'], 209 | ['.tf','French Southern Territories'], 210 | ['.tg','Togo'], 211 | ['.th','Thailand'], 212 | ['.tj','Tajikistan'], 213 | ['.tk','Tokelau'], 214 | ['.tm','Turkmenistan'], 215 | ['.tn','Tunisia'], 216 | ['.to','Tonga'], 217 | ['.tp','East Timor'], 218 | ['.tr','Turkey'], 219 | ['.tt','Trinidad and Tobago'], 220 | ['.tv','Tuvalu'], 221 | ['.tw','Taiwan'], 222 | ['.tz','Tanzania'], 223 | ['.ua','Ukraine'], 224 | ['.ug','Uganda'], 225 | ['.uk','United Kingdom'], 226 | ['.um','US Minor Outlying Islands'], 227 | ['.us','United States'], 228 | ['.uy','Uruguay'], 229 | ['.uz','Uzbekistan'], 230 | ['.va','Holy See (City Vatican State)'], 231 | ['.vc','Saint Vincent and the Grenadines'], 232 | ['.ve','Venezuela'], 233 | ['.vg','Virgin Islands (British)'], 234 | ['.vi','Virgin Islands (USA)'], 235 | ['.vn','Vietnam'], 236 | ['.vu','Vanuatu'], 237 | ['.wf','Wallis and Futuna Islands'], 238 | ['.ws','Western Samoa'], 239 | ['.ye','Yemen'], 240 | ['.yt','Mayotte'], 241 | ['.yu','Yugoslavia'], 242 | ['.za','South Africa'], 243 | ['.zm','Zambia'], 244 | ['.zw','Zimbabwe'] 245 | ); -------------------------------------------------------------------------------- /apis/modernizr/modernizr.js: -------------------------------------------------------------------------------- 1 | /* Modernizr 2.0.6 (Custom Build) | MIT & BSD 2 | * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-iepp-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load 3 | */ 4 | ;window.Modernizr=function(a,b,c){function H(){e.input=function(a){for(var b=0,c=a.length;b",a,""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),x,y={}.hasOwnProperty,z;!C(y,c)&&!C(y.call,c)?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)};var G=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return w("dragstart")&&w("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var I in r)z(r,I)&&(x=I.toLowerCase(),e[x]=r[I](),u.push((e[x]?"":"no-")+x));e.input||H(),A(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b