identifier
stringlengths
0
89
parameters
stringlengths
0
399
return_statement
stringlengths
0
982
docstring
stringlengths
10
3.04k
docstring_summary
stringlengths
0
3.04k
function
stringlengths
13
25.8k
function_tokens
sequence
start_point
sequence
end_point
sequence
argument_list
null
language
stringclasses
3 values
docstring_language
stringclasses
4 values
docstring_language_predictions
stringclasses
4 values
is_langid_reliable
stringclasses
2 values
is_langid_extra_reliable
bool
1 class
type
stringclasses
9 values
volverOrigen
()
null
/*Esta funcion envia una señal a true, y despues de un segundo la vuelve false cambia la variable ON_ORIGEN
/*Esta funcion envia una señal a true, y despues de un segundo la vuelve false cambia la variable ON_ORIGEN
function volverOrigen(){ if (comprobarUso()) { var origenActivado = document.getElementById("gif"); origenActivado.style.display = "inline-block"; botonLoadOrigen = true; $($.ajax({ method:'POST', data:'\"WEB_1\".ON_ORIGEN=true', success:function(e){ console.log("Funciona, se ha enviado: "+'\"WEB_1\".ON_ORIGEN=true'); }, error:function(){ console.log("errores"); } })); setTimeout(function(){ $($.ajax({ method:'POST', data:'\"WEB_1\".ON_ORIGEN=false', success:function(e){ console.log("Funciona, se ha enviado: "+'\"WEB_1\".ON_ORIGEN=false'); }, error:function(){ console.log("errores"); } })); },1000); } }
[ "function", "volverOrigen", "(", ")", "{", "if", "(", "comprobarUso", "(", ")", ")", "{", "var", "origenActivado", "=", "document", ".", "getElementById", "(", "\"gif\"", ")", ";", "origenActivado", ".", "style", ".", "display", "=", "\"inline-block\"", ";", "botonLoadOrigen", "=", "true", ";", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "'\\\"WEB_1\\\".ON_ORIGEN=true'", ",", "success", ":", "function", "(", "e", ")", "{", "console", ".", "log", "(", "\"Funciona, se ha enviado: \"", "+", "'\\\"WEB_1\\\".ON_ORIGEN=true'", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", ";", "setTimeout", "(", "function", "(", ")", "{", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "'\\\"WEB_1\\\".ON_ORIGEN=false'", ",", "success", ":", "function", "(", "e", ")", "{", "console", ".", "log", "(", "\"Funciona, se ha enviado: \"", "+", "'\\\"WEB_1\\\".ON_ORIGEN=false'", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", ";", "}", ",", "1000", ")", ";", "}", "}" ]
[ 13, 0 ]
[ 41, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Se crea el metodo que cambia el icono del boton
Se crea el metodo que cambia el icono del boton
function(){ $('.smk-fullscreen').children('.glyphicon').toggleClass('glyphicon-fullscreen').toggleClass('glyphicon-resize-small'); }
[ "function", "(", ")", "{", "$", "(", "'.smk-fullscreen'", ")", ".", "children", "(", "'.glyphicon'", ")", ".", "toggleClass", "(", "'glyphicon-fullscreen'", ")", ".", "toggleClass", "(", "'glyphicon-resize-small'", ")", ";", "}" ]
[ 1143, 27 ]
[ 1145, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
areaCirculo
(radio)
null
console.log("El perímetro del círculo es de: " + circunferencia + " cm.");
console.log("El perímetro del círculo es de: " + circunferencia + " cm.");
function areaCirculo(radio) { return PI * radio * radio; }
[ "function", "areaCirculo", "(", "radio", ")", "{", "return", "PI", "*", "radio", "*", "radio", ";", "}" ]
[ 67, 0 ]
[ 69, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
onClickMarkerUser
(markerUser)
null
/*FIN Lo que ocurre si se presiona click en el marcador de una estación. ---------------------- /*Lo que ocurre si se presiona click en el marcador de ubicación seleccionada por el usuario.
/*FIN Lo que ocurre si se presiona click en el marcador de una estación. ---------------------- /*Lo que ocurre si se presiona click en el marcador de ubicación seleccionada por el usuario.
function onClickMarkerUser(markerUser) { /*Si ningún marcador está activo...*/ if (eventBackup === null) { /*Se cambia el marcador al "activo".*/ markerUser.setIcon(markerSelectedActive); /*Se almacena como marcador activo.*/ eventBackup = markerUser; } else { /*Si ya hay un marcador activo...*/ /*Si representa una ubicación seleccionada por el usuario...*/ if (eventBackup.options.represents === "click") { /*Se deselecciona*/ /*Se cambia el marcador al "inactivo".*/ markerUser.setIcon(markerSelected); /*Se almacena que no hay marcador activo.*/ eventBackup = null; } else if (eventBackup.options.represents === "station") { /*Si representa una estación...*/ /*Se cambia el activo por el marcador de estación "inactivo".*/ eventBackup.setIcon(markerStation); /*Se cambia el marcador de estación al "activo".*/ markerUser.setIcon(markerSelectedActive); /*Se almacena como marcador activo.*/ eventBackup = markerUser; paintCollapseByDefault(); } } }
[ "function", "onClickMarkerUser", "(", "markerUser", ")", "{", "/*Si ningún marcador está activo...*/", "if", "(", "eventBackup", "===", "null", ")", "{", "/*Se cambia el marcador al \"activo\".*/", "markerUser", ".", "setIcon", "(", "markerSelectedActive", ")", ";", "/*Se almacena como marcador activo.*/", "eventBackup", "=", "markerUser", ";", "}", "else", "{", "/*Si ya hay un marcador activo...*/", "/*Si representa una ubicación seleccionada por el usuario...*/", "if", "(", "eventBackup", ".", "options", ".", "represents", "===", "\"click\"", ")", "{", "/*Se deselecciona*/", "/*Se cambia el marcador al \"inactivo\".*/", "markerUser", ".", "setIcon", "(", "markerSelected", ")", ";", "/*Se almacena que no hay marcador activo.*/", "eventBackup", "=", "null", ";", "}", "else", "if", "(", "eventBackup", ".", "options", ".", "represents", "===", "\"station\"", ")", "{", "/*Si representa una estación...*/", "/*Se cambia el activo por el marcador de estación \"inactivo\".*/", "eventBackup", ".", "setIcon", "(", "markerStation", ")", ";", "/*Se cambia el marcador de estación al \"activo\".*/", "markerUser", ".", "setIcon", "(", "markerSelectedActive", ")", ";", "/*Se almacena como marcador activo.*/", "eventBackup", "=", "markerUser", ";", "paintCollapseByDefault", "(", ")", ";", "}", "}", "}" ]
[ 157, 0 ]
[ 184, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
SameValue
( x, y )
null
7.2.3 SameValue( x, y )
7.2.3 SameValue( x, y )
function SameValue ( x, y ) { if ( typeof x !== typeof y ) { return false; } if ( Type(x) === 'undefined' ) { return true; } if ( Type(x) === 'number' ) { if ( x !== x && y !== y ) { return true; } if ( x === 0 ) { return 1 / x === 1 / y; } } return x === y; }
[ "function", "SameValue", "(", "x", ",", "y", ")", "{", "if", "(", "typeof", "x", "!==", "typeof", "y", ")", "{", "return", "false", ";", "}", "if", "(", "Type", "(", "x", ")", "===", "'undefined'", ")", "{", "return", "true", ";", "}", "if", "(", "Type", "(", "x", ")", "===", "'number'", ")", "{", "if", "(", "x", "!==", "x", "&&", "y", "!==", "y", ")", "{", "return", "true", ";", "}", "if", "(", "x", "===", "0", ")", "{", "return", "1", "/", "x", "===", "1", "/", "y", ";", "}", "}", "return", "x", "===", "y", ";", "}" ]
[ 90, 2 ]
[ 106, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
cargarBanner
()
null
llama a la función mostrarBannerAleatorio() cada 4s.
llama a la función mostrarBannerAleatorio() cada 4s.
function cargarBanner() { mostrarBannerAleatorio(); setInterval(mostrarBannerAleatorio, 4000); }
[ "function", "cargarBanner", "(", ")", "{", "mostrarBannerAleatorio", "(", ")", ";", "setInterval", "(", "mostrarBannerAleatorio", ",", "4000", ")", ";", "}" ]
[ 22, 0 ]
[ 25, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
renderTasks
(tasks)
null
Renderiza el listado de tareas
Renderiza el listado de tareas
function renderTasks(tasks) { tasklist.innerHTML = ''; footer.innerText = `Total de tareas: ${tasks.length}`; tasks.map(t => { tasklist.innerHTML += ` <li class="list-group-item" id="${t._id}"> <img class="img-circle media-object pull-left" src="./assets/img/task-icon.png" width="32" height="32"> <div class="media-body"> <strong>${t.name}</strong> <p>${t.description}</p> </div> <div class="media-footer"> <button onclick="editTask('${t._id}')" class="btn btn-warning"> Editar <span class="icon icon-pencil text-white"></span> </button> <button onclick="deleteTask('${t._id}')" class="btn btn-negative pull-right"> Eliminar <span class="icon icon-trash text-white"></span> </button> </div> </li> `; }) }
[ "function", "renderTasks", "(", "tasks", ")", "{", "tasklist", ".", "innerHTML", "=", "''", ";", "footer", ".", "innerText", "=", "`", "${", "tasks", ".", "length", "}", "`", ";", "tasks", ".", "map", "(", "t", "=>", "{", "tasklist", ".", "innerHTML", "+=", "`", "${", "t", ".", "_id", "}", "${", "t", ".", "name", "}", "${", "t", ".", "description", "}", "${", "t", ".", "_id", "}", "${", "t", ".", "_id", "}", "`", ";", "}", ")", "}" ]
[ 73, 0 ]
[ 95, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
disableIE
()
null
#region Bloqueando click derecho
#region Bloqueando click derecho
function disableIE() { if (document.all) { return false; } }
[ "function", "disableIE", "(", ")", "{", "if", "(", "document", ".", "all", ")", "{", "return", "false", ";", "}", "}" ]
[ 2, 0 ]
[ 6, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
customSmartPooling
()
null
una hora antes de empezar la reunión hacer smart pooling el servidor tarda unos segundos en darse cuenta del cambio de la hora
una hora antes de empezar la reunión hacer smart pooling el servidor tarda unos segundos en darse cuenta del cambio de la hora
function customSmartPooling() { const futureDate = new Date('2021-05-08T12:00:000Z'); // fecha reunion (dentro de una hora y algo) futureDate.setHours(futureDate.getHours() - 1); futureDate.setMinutes(futureDate.getMinutes() + 1); // margen al servidor const dif = futureDate - now; if (dif >= 0) { console.log('dif', dif) setTimeout(() => { console.log('tiempo') }, dif); return dif; } return 'el futuro ya ha pasado'; }
[ "function", "customSmartPooling", "(", ")", "{", "const", "futureDate", "=", "new", "Date", "(", "'2021-05-08T12:00:000Z'", ")", ";", "// fecha reunion (dentro de una hora y algo)", "futureDate", ".", "setHours", "(", "futureDate", ".", "getHours", "(", ")", "-", "1", ")", ";", "futureDate", ".", "setMinutes", "(", "futureDate", ".", "getMinutes", "(", ")", "+", "1", ")", ";", "// margen al servidor", "const", "dif", "=", "futureDate", "-", "now", ";", "if", "(", "dif", ">=", "0", ")", "{", "console", ".", "log", "(", "'dif'", ",", "dif", ")", "setTimeout", "(", "(", ")", "=>", "{", "console", ".", "log", "(", "'tiempo'", ")", "}", ",", "dif", ")", ";", "return", "dif", ";", "}", "return", "'el futuro ya ha pasado'", ";", "}" ]
[ 75, 0 ]
[ 91, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(event)
null
/* eslint-enable no-undef Methods to add/remove your own addEventListener hijacking on document + window.
/* eslint-enable no-undef Methods to add/remove your own addEventListener hijacking on document + window.
function (event) { return (windowEventHandlers[event] = channel.create(event)); }
[ "function", "(", "event", ")", "{", "return", "(", "windowEventHandlers", "[", "event", "]", "=", "channel", ".", "create", "(", "event", ")", ")", ";", "}" ]
[ 186, 27 ]
[ 188, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
mapStateToProps
(state)
null
Esta funcion convierte el valor de la store que yo quiero en propiedades para el componente.
Esta funcion convierte el valor de la store que yo quiero en propiedades para el componente.
function mapStateToProps(state){ return { users: state.getUsers } }
[ "function", "mapStateToProps", "(", "state", ")", "{", "return", "{", "users", ":", "state", ".", "getUsers", "}", "}" ]
[ 264, 0 ]
[ 268, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
handleResetFav
(event)
null
/////////////// Función para escuchar el click del botón de
/////////////// Función para escuchar el click del botón de
function handleResetFav(event) { event.preventDefault(); favorites = []; localStorage.removeItem("favorites"); renderFavourite(); }
[ "function", "handleResetFav", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "favorites", "=", "[", "]", ";", "localStorage", ".", "removeItem", "(", "\"favorites\"", ")", ";", "renderFavourite", "(", ")", ";", "}" ]
[ 147, 0 ]
[ 152, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
calcularPerimetroCuadrado
()
null
aqui interactuamos con el HTML Cuadrado
aqui interactuamos con el HTML Cuadrado
function calcularPerimetroCuadrado() { const input = document.getElementById("InputCuadrado"); const value = input.value; const perimetro = perimetroCuadrado(value); alert("El perimetro del cuadrado es:" + perimetro); }
[ "function", "calcularPerimetroCuadrado", "(", ")", "{", "const", "input", "=", "document", ".", "getElementById", "(", "\"InputCuadrado\"", ")", ";", "const", "value", "=", "input", ".", "value", ";", "const", "perimetro", "=", "perimetroCuadrado", "(", "value", ")", ";", "alert", "(", "\"El perimetro del cuadrado es:\"", "+", "perimetro", ")", ";", "}" ]
[ 96, 0 ]
[ 102, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(data)
null
Mostramos un mensaje con la respuesta de PHP
Mostramos un mensaje con la respuesta de PHP
function(data) { $('#form')[0].reset(); toastr.success(data); }
[ "function", "(", "data", ")", "{", "$", "(", "'#form'", ")", "[", "0", "]", ".", "reset", "(", ")", ";", "toastr", ".", "success", "(", "data", ")", ";", "}" ]
[ 21, 12 ]
[ 24, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
(dat, det, nombre)
null
caracteristicas del producto
caracteristicas del producto
function (dat, det, nombre) { dat.text(""); dat.append($('<div class="titulo"></div>') .append($('<span></span>').text(nombre))) .append($('<div class="conte"></div>') .append($('<ul></ul>').append($('<li></li>').text(det)))); }
[ "function", "(", "dat", ",", "det", ",", "nombre", ")", "{", "dat", ".", "text", "(", "\"\"", ")", ";", "dat", ".", "append", "(", "$", "(", "'<div class=\"titulo\"></div>'", ")", ".", "append", "(", "$", "(", "'<span></span>'", ")", ".", "text", "(", "nombre", ")", ")", ")", ".", "append", "(", "$", "(", "'<div class=\"conte\"></div>'", ")", ".", "append", "(", "$", "(", "'<ul></ul>'", ")", ".", "append", "(", "$", "(", "'<li></li>'", ")", ".", "text", "(", "det", ")", ")", ")", ")", ";", "}" ]
[ 1, 15 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
( paginationType )
null
y y /** updatePage() execute actual page update work. @param { string } paginationType, "last" or "next".
y y /** updatePage() execute actual page update work.
function( paginationType ) { if ( paginationType === "next" ) { // "next" button is clicked. if ( this.segmentIndex === 0 ) { // First page now, click "next" button will show "last" button. this.showLastButton(); } if ( this.segmentIndex === this.totalSegments - 2 ) { // Is going to the last page, the last page do not have "next" button. this.hideNextButton(); } // Update segmentIndex. this.segmentIndex += 1; } else { // "last" button is clicked. if ( this.segmentIndex === this.totalSegments - 1 ) { // The Last page now, click "last" button will show "next" button. this.showNextButton(); } if ( this.segmentIndex === 1 ) { // Is going to the first page, the first page do not have "last" button. this.hideLastButton(); } // Update segmentIndex. this.segmentIndex -= 1; } // Modify segment element based on new segment index. this.queueHandler.updateSegmentIndex( this.segmentIndex ); // Check whether queue length change, situation: the page's length may different with previous page. if ( this.queueHandler.isLengthChanged ) { this.queueLength = this.queueHandler.queueLength; if ( this.nextButtonHandler !== undefined ) { let nextButtonPos = this.calcPaginationButtonPos( "next" ); this.nextButtonHandler.updatePos( nextButtonPos ); } if ( this.lastButtonHandler !== undefined ) { let lastButtonPos = this.calcPaginationButtonPos( "last" ); this.lastButtonHandler.updatePos( lastButtonPos ); } let closeButtonPos = this.calcCloseButtonPos(); this.closeButtonHandler.updatePos( closeButtonPos ); } if ( this.neuralValue !== undefined ) { this.updateQueueVis(); } }
[ "function", "(", "paginationType", ")", "{", "if", "(", "paginationType", "===", "\"next\"", ")", "{", "// \"next\" button is clicked.", "if", "(", "this", ".", "segmentIndex", "===", "0", ")", "{", "// First page now, click \"next\" button will show \"last\" button.", "this", ".", "showLastButton", "(", ")", ";", "}", "if", "(", "this", ".", "segmentIndex", "===", "this", ".", "totalSegments", "-", "2", ")", "{", "// Is going to the last page, the last page do not have \"next\" button.", "this", ".", "hideNextButton", "(", ")", ";", "}", "// Update segmentIndex.", "this", ".", "segmentIndex", "+=", "1", ";", "}", "else", "{", "// \"last\" button is clicked.", "if", "(", "this", ".", "segmentIndex", "===", "this", ".", "totalSegments", "-", "1", ")", "{", "// The Last page now, click \"last\" button will show \"next\" button.", "this", ".", "showNextButton", "(", ")", ";", "}", "if", "(", "this", ".", "segmentIndex", "===", "1", ")", "{", "// Is going to the first page, the first page do not have \"last\" button.", "this", ".", "hideLastButton", "(", ")", ";", "}", "// Update segmentIndex.", "this", ".", "segmentIndex", "-=", "1", ";", "}", "// Modify segment element based on new segment index.", "this", ".", "queueHandler", ".", "updateSegmentIndex", "(", "this", ".", "segmentIndex", ")", ";", "// Check whether queue length change, situation: the page's length may different with previous page.", "if", "(", "this", ".", "queueHandler", ".", "isLengthChanged", ")", "{", "this", ".", "queueLength", "=", "this", ".", "queueHandler", ".", "queueLength", ";", "if", "(", "this", ".", "nextButtonHandler", "!==", "undefined", ")", "{", "let", "nextButtonPos", "=", "this", ".", "calcPaginationButtonPos", "(", "\"next\"", ")", ";", "this", ".", "nextButtonHandler", ".", "updatePos", "(", "nextButtonPos", ")", ";", "}", "if", "(", "this", ".", "lastButtonHandler", "!==", "undefined", ")", "{", "let", "lastButtonPos", "=", "this", ".", "calcPaginationButtonPos", "(", "\"last\"", ")", ";", "this", ".", "lastButtonHandler", ".", "updatePos", "(", "lastButtonPos", ")", ";", "}", "let", "closeButtonPos", "=", "this", ".", "calcCloseButtonPos", "(", ")", ";", "this", ".", "closeButtonHandler", ".", "updatePos", "(", "closeButtonPos", ")", ";", "}", "if", "(", "this", ".", "neuralValue", "!==", "undefined", ")", "{", "this", ".", "updateQueueVis", "(", ")", ";", "}", "}" ]
[ 913, 13 ]
[ 1000, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
()
null
Funciones de referencias Envio de datos de referencia por post
Funciones de referencias Envio de datos de referencia por post
function(){ var urlStore = '/historial/referencia/parroquial/store'; // Insercion de datos [ Arreglo Vue = v-model Formulario ] this.nuevaReferencia.F_IdFicha = this.F_IdFicha, axios.post( urlStore, this.nuevaReferencia).then( response => { this.cargarParticipaciones(); this.nuevaReferencia = { 'MAP_P_IdParticipacion': '', 'MAP_Nota': '', 'MAP_Observacion': '' }; this.errors = ''; $('#ModalAgregarRef').modal('hide'); toastr['success']('referencias cargadas correctamente', 'Listado actualizado'); }).catch(error => { this.errors = error.response.data }); }
[ "function", "(", ")", "{", "var", "urlStore", "=", "'/historial/referencia/parroquial/store'", ";", "// Insercion de datos [ Arreglo Vue = v-model Formulario ]", "this", ".", "nuevaReferencia", ".", "F_IdFicha", "=", "this", ".", "F_IdFicha", ",", "axios", ".", "post", "(", "urlStore", ",", "this", ".", "nuevaReferencia", ")", ".", "then", "(", "response", "=>", "{", "this", ".", "cargarParticipaciones", "(", ")", ";", "this", ".", "nuevaReferencia", "=", "{", "'MAP_P_IdParticipacion'", ":", "''", ",", "'MAP_Nota'", ":", "''", ",", "'MAP_Observacion'", ":", "''", "}", ";", "this", ".", "errors", "=", "''", ";", "$", "(", "'#ModalAgregarRef'", ")", ".", "modal", "(", "'hide'", ")", ";", "toastr", "[", "'success'", "]", "(", "'referencias cargadas correctamente'", ",", "'Listado actualizado'", ")", ";", "}", ")", ".", "catch", "(", "error", "=>", "{", "this", ".", "errors", "=", "error", ".", "response", ".", "data", "}", ")", ";", "}" ]
[ 227, 29 ]
[ 244, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
registrar_Indicadores
()
null
funcion para registar indicadores
funcion para registar indicadores
function registrar_Indicadores(){ var token = new $('#token').val(); var datos = new FormData($("#frmIngresarIndicadores")[0]); $.ajax({ url:"/app/indicadores", headers :{'X-CSRF-TOKEN': token}, type: 'POST', dataType: 'json', contentType: false, processData: false, data: datos, success:function(res){ if(res.registro==true){ //swal("Efood!", "El usuario se ha registro correctamente!", "success"); swal("Indicador Registrado Correctamente..!!", "", "success"); document.getElementById("frmIngresarIndicadores").reset(); $("#myModal_IngresarIndicador").modal("hide"); $("#datatable").load("/lista_indicadores"); } } }); }
[ "function", "registrar_Indicadores", "(", ")", "{", "var", "token", "=", "new", "$", "(", "'#token'", ")", ".", "val", "(", ")", ";", "var", "datos", "=", "new", "FormData", "(", "$", "(", "\"#frmIngresarIndicadores\"", ")", "[", "0", "]", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "\"/app/indicadores\"", ",", "headers", ":", "{", "'X-CSRF-TOKEN'", ":", "token", "}", ",", "type", ":", "'POST'", ",", "dataType", ":", "'json'", ",", "contentType", ":", "false", ",", "processData", ":", "false", ",", "data", ":", "datos", ",", "success", ":", "function", "(", "res", ")", "{", "if", "(", "res", ".", "registro", "==", "true", ")", "{", "//swal(\"Efood!\", \"El usuario se ha registro correctamente!\", \"success\");", "swal", "(", "\"Indicador Registrado Correctamente..!!\"", ",", "\"\"", ",", "\"success\"", ")", ";", "document", ".", "getElementById", "(", "\"frmIngresarIndicadores\"", ")", ".", "reset", "(", ")", ";", "$", "(", "\"#myModal_IngresarIndicador\"", ")", ".", "modal", "(", "\"hide\"", ")", ";", "$", "(", "\"#datatable\"", ")", ".", "load", "(", "\"/lista_indicadores\"", ")", ";", "}", "}", "}", ")", ";", "}" ]
[ 70, 0 ]
[ 93, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getDepartamentos
(request, response)
null
Tomar todos los departamentos
Tomar todos los departamentos
function getDepartamentos(request, response) { pool.query('SELECT * FROM TIPO_DEPARTAMENTO', (err, res) => { if (err) { console.log(err.stack) } else { return response.json(res.rows) } }) }
[ "function", "getDepartamentos", "(", "request", ",", "response", ")", "{", "pool", ".", "query", "(", "'SELECT * FROM TIPO_DEPARTAMENTO'", ",", "(", "err", ",", "res", ")", "=>", "{", "if", "(", "err", ")", "{", "console", ".", "log", "(", "err", ".", "stack", ")", "}", "else", "{", "return", "response", ".", "json", "(", "res", ".", "rows", ")", "}", "}", ")", "}" ]
[ 6, 0 ]
[ 14, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
hideResponse
()
null
Función para ocultar las respuestas del servidor
Función para ocultar las respuestas del servidor
function hideResponse () { response.className = "d-none"; }
[ "function", "hideResponse", "(", ")", "{", "response", ".", "className", "=", "\"d-none\"", ";", "}" ]
[ 13, 0 ]
[ 15, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setup
()
null
Display x & y coords
Display x & y coords
function setup() { createCanvas(400, 400); background(200); }
[ "function", "setup", "(", ")", "{", "createCanvas", "(", "400", ",", "400", ")", ";", "background", "(", "200", ")", ";", "}" ]
[ 1, 0 ]
[ 4, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mark_reconciled
(e)
null
Marcar como reconciliado
Marcar como reconciliado
function mark_reconciled(e) { var valor= e.getAttribute('value'); var _token = $('meta[name="csrf-token"]').attr('content'); var folio = e.getAttribute('datas'); Swal.fire({ title: '¿Estás seguro?', text: "Se marcara como conciliada, la nota de credito con folio: "+folio, type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Aceptar', cancelButtonText: 'Cancelar' }).then((result) => { if (result.value) { $.ajax({ type: "POST", url: '/sales/customer-credit-notes/mark-reconciled', data: {token_b : valor, _token : _token}, success: function (data) { if(data.status == 200){ Swal.fire('Operación completada!', '', 'success') .then(()=> { location.href ="/sales/credit-notes-history"; }); } else { Swal.fire({ type: 'error', title: 'Oops... Error: '+data.status, text: 'El recurso no se ha modificado', }); } }, error: function (err) { Swal.fire({ type: 'error', title: 'Oops...', text: err.statusText, }); } }) } }); }
[ "function", "mark_reconciled", "(", "e", ")", "{", "var", "valor", "=", "e", ".", "getAttribute", "(", "'value'", ")", ";", "var", "_token", "=", "$", "(", "'meta[name=\"csrf-token\"]'", ")", ".", "attr", "(", "'content'", ")", ";", "var", "folio", "=", "e", ".", "getAttribute", "(", "'datas'", ")", ";", "Swal", ".", "fire", "(", "{", "title", ":", "'¿Estás seguro?',", "", "text", ":", "\"Se marcara como conciliada, la nota de credito con folio: \"", "+", "folio", ",", "type", ":", "'warning'", ",", "showCancelButton", ":", "true", ",", "confirmButtonColor", ":", "'#3085d6'", ",", "cancelButtonColor", ":", "'#d33'", ",", "confirmButtonText", ":", "'Aceptar'", ",", "cancelButtonText", ":", "'Cancelar'", "}", ")", ".", "then", "(", "(", "result", ")", "=>", "{", "if", "(", "result", ".", "value", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "'/sales/customer-credit-notes/mark-reconciled'", ",", "data", ":", "{", "token_b", ":", "valor", ",", "_token", ":", "_token", "}", ",", "success", ":", "function", "(", "data", ")", "{", "if", "(", "data", ".", "status", "==", "200", ")", "{", "Swal", ".", "fire", "(", "'Operación completada!',", " ", "',", " ", "success')", "", ".", "then", "(", "(", ")", "=>", "{", "location", ".", "href", "=", "\"/sales/credit-notes-history\"", ";", "}", ")", ";", "}", "else", "{", "Swal", ".", "fire", "(", "{", "type", ":", "'error'", ",", "title", ":", "'Oops... Error: '", "+", "data", ".", "status", ",", "text", ":", "'El recurso no se ha modificado'", ",", "}", ")", ";", "}", "}", ",", "error", ":", "function", "(", "err", ")", "{", "Swal", ".", "fire", "(", "{", "type", ":", "'error'", ",", "title", ":", "'Oops...'", ",", "text", ":", "err", ".", "statusText", ",", "}", ")", ";", "}", "}", ")", "}", "}", ")", ";", "}" ]
[ 437, 0 ]
[ 481, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getTaskHandler
(request, response)
null
Funcion que contiene la información de la base de datos y regresa la información al usuario
Funcion que contiene la información de la base de datos y regresa la información al usuario
function getTaskHandler(request, response){ response.writeHead(200, {'Content-Type': 'application/json'}); // Respuesta a enviar response.write( // Convertimos Json a string JSON.stringify(database) ); response.end(); }
[ "function", "getTaskHandler", "(", "request", ",", "response", ")", "{", "response", ".", "writeHead", "(", "200", ",", "{", "'Content-Type'", ":", "'application/json'", "}", ")", ";", "// Respuesta a enviar", "response", ".", "write", "(", "// Convertimos Json a string ", "JSON", ".", "stringify", "(", "database", ")", ")", ";", "response", ".", "end", "(", ")", ";", "}" ]
[ 12, 0 ]
[ 20, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(err)
null
> Gestiona los errores
> Gestiona los errores
function (err) { gutil.beep(); console.log(err); }
[ "function", "(", "err", ")", "{", "gutil", ".", "beep", "(", ")", ";", "console", ".", "log", "(", "err", ")", ";", "}" ]
[ 20, 14 ]
[ 23, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
mutationResult
(req, res)
null
aqui cambia la respuesta segun lo que el controlador arroje sobre la mutacion del ADN
aqui cambia la respuesta segun lo que el controlador arroje sobre la mutacion del ADN
function mutationResult (req, res) { if(Controller.postArgumentValid(req.body.dna) && Controller.validProteins(req.body.dna)){ Controller.hasMutation(req.body.dna) .then((result) => { response.success(req, res, result.text, result.status) }) .catch((err) => { response.error(req, res, err.message, 500) }) } else { response.error(req, res, "La cadena de ADN mandada no cumple con el standard 6 cadenas de 6 proteínas o contiene caracteres fuera de ATCG", 501) } }
[ "function", "mutationResult", "(", "req", ",", "res", ")", "{", "if", "(", "Controller", ".", "postArgumentValid", "(", "req", ".", "body", ".", "dna", ")", "&&", "Controller", ".", "validProteins", "(", "req", ".", "body", ".", "dna", ")", ")", "{", "Controller", ".", "hasMutation", "(", "req", ".", "body", ".", "dna", ")", ".", "then", "(", "(", "result", ")", "=>", "{", "response", ".", "success", "(", "req", ",", "res", ",", "result", ".", "text", ",", "result", ".", "status", ")", "}", ")", ".", "catch", "(", "(", "err", ")", "=>", "{", "response", ".", "error", "(", "req", ",", "res", ",", "err", ".", "message", ",", "500", ")", "}", ")", "}", "else", "{", "response", ".", "error", "(", "req", ",", "res", ",", "\"La cadena de ADN mandada no cumple con el standard 6 cadenas de 6 proteínas o contiene caracteres fuera de ATCG\",", " ", "01)", "", "}", "}" ]
[ 13, 0 ]
[ 26, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setup
()
null
Uso de un arreglo para guardar los valores de altura de la onda
Uso de un arreglo para guardar los valores de altura de la onda
function setup() { createCanvas(710, 400); w = width + 16; dx = (TWO_PI / period) * xspacing; yvalues = new Array(floor(w / xspacing)); }
[ "function", "setup", "(", ")", "{", "createCanvas", "(", "710", ",", "400", ")", ";", "w", "=", "width", "+", "16", ";", "dx", "=", "(", "TWO_PI", "/", "period", ")", "*", "xspacing", ";", "yvalues", "=", "new", "Array", "(", "floor", "(", "w", "/", "xspacing", ")", ")", ";", "}" ]
[ 14, 0 ]
[ 19, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
validarSiNumero
(numero)
null
fin validar si es un numero el imput presupuesto
fin validar si es un numero el imput presupuesto
function validarSiNumero(numero){ if (!/^([0-9])*$/.test(numero)) swal("El valor "+ numero +" no es un numero..!!", "", "error"); $('#presupuesto_A').val(''); document.getElementById("#presupuesto_A").focus(); }
[ "function", "validarSiNumero", "(", "numero", ")", "{", "if", "(", "!", "/", "^([0-9])*$", "/", ".", "test", "(", "numero", ")", ")", "swal", "(", "\"El valor \"", "+", "numero", "+", "\" no es un numero..!!\"", ",", "\"\"", ",", "\"error\"", ")", ";", "$", "(", "'#presupuesto_A'", ")", ".", "val", "(", "''", ")", ";", "document", ".", "getElementById", "(", "\"#presupuesto_A\"", ")", ".", "focus", "(", ")", ";", "}" ]
[ 125, 4 ]
[ 130, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
redactarMail
()
null
funcion que simula un mail enviado por consola
funcion que simula un mail enviado por consola
function redactarMail(){ console.log("Origen: soporte@grupo4.com"); console.log("Destino: ",mailDest); console.log("Asunto: Recuperacion de clave"); console.log("Mensaje: Hola, gracias por comunicarte. Tu contraseña es ", users[0].contraseña); }
[ "function", "redactarMail", "(", ")", "{", "console", ".", "log", "(", "\"Origen: soporte@grupo4.com\"", ")", ";", "console", ".", "log", "(", "\"Destino: \"", ",", "mailDest", ")", ";", "console", ".", "log", "(", "\"Asunto: Recuperacion de clave\"", ")", ";", "console", ".", "log", "(", "\"Mensaje: Hola, gracias por comunicarte. Tu contraseña es \",", " ", "sers[", "0", "]", ".", "c", "ontraseña);", "", "", "}" ]
[ 58, 0 ]
[ 63, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
onClickMarkerStation
(marker)
null
/*FIN Mostrar marcador seleccionado y otro marcador con la estación más cercana ------------------ /*Lo que ocurre si se presiona click en el marcador de una estación. ----------------------
/*FIN Mostrar marcador seleccionado y otro marcador con la estación más cercana ------------------ /*Lo que ocurre si se presiona click en el marcador de una estación. ----------------------
function onClickMarkerStation(marker) { /*Obtengo las opciones agregadas al marcador.*/ let infoStation = marker.options; /*Si ambos reprsentan una estación y son el mismo...*/ if(infoStation.represents === "station" && eventBackup !== null && eventBackup.options.represents === "station" && eventBackup.options.id === infoStation.id) { /*Se deselecciona.*/ eventBackup = null; marker.setIcon(markerStation); paintCollapseByDefault(); } else { /*Se guarda el id para la llamada AJAX por los datos metereológicos.*/ let idStation = infoStation.id; /*LLAMADA AJAX ------------------------------------------------*/ /*Se crea el objeto XMLHttpRequest haciendo controles de compatibilidad.*/ request = makeRequest(); /*En caso de no lograr crear el objeto XMLHttpRequest*/ if (!request) { alert('ERROR : No es posible crear una instancia XMLHTTP'); return false; } else { /*Si se logró crear el objeto XMLHttpRequest*/ /*Se asignan las acciones ante el cambio de estado*/ request.onreadystatechange = function() { if(this.readyState == 4) { /*Si se recibieron los datos.*/ if (this.status == 200) { /*Se recibe la respuesta y se parsea a JSON.*/ let responseJson = JSON.parse(this.responseText); /*Se obtiene el array de datos metereológicos.*/ let lastPosArrayData = responseJson.result.length - 1; let lastData = responseJson.result[lastPosArrayData]; /*Si ningún marcador está activo...*/ if (eventBackup === null) { /*Se cambia el marcador de estación al "activo".*/ marker.setIcon(markerStationActive); /*Se almacena como marcador activo.*/ eventBackup = marker; /*Se pinta el collapse con los datos metereológicos.*/ paintCollapse(infoStation, lastData); } else { /*Si ya hay un marcador activo...*/ /*Si representa una ubicación seleccionada por el usuario...*/ if (eventBackup.options.represents === "click") { /*Se cambia por el marcador de selección del usuario "inactivo".*/ eventBackup.setIcon(markerSelected); /*Se cambia el marcador de estación al "activo".*/ marker.setIcon(markerStationActive); /*Se almacena como marcador activo.*/ eventBackup = marker; /*Se pinta el collapse con los datos metereológicos.*/ paintCollapse(infoStation, lastData); } else if (eventBackup.options.represents === "station") { /*Si representa una estación...*/ /*Se cambia el activo por el marcador de estación "inactivo".*/ eventBackup.setIcon(markerStation); /*Se cambia el marcador de estación al "activo".*/ marker.setIcon(markerStationActive); /*Se almacena como marcador activo.*/ eventBackup = marker; /*Se pinta el collapse con los datos metereológicos.*/ paintCollapse(infoStation, lastData); } } } else { alert('El código de estado fue: ' + this.status); } } } /*Se define URL*/ let fileUrl = '../Controllers/AjaxController.jsp'; let params = '?accion=verDatosDeEstacion&id='+idStation; request.open('GET', fileUrl + params, true); request.send(); } /*FIN LLAMADA AJAX ------------------------------------------------*/ } }
[ "function", "onClickMarkerStation", "(", "marker", ")", "{", "/*Obtengo las opciones agregadas al marcador.*/", "let", "infoStation", "=", "marker", ".", "options", ";", "/*Si ambos reprsentan una estación y son el mismo...*/", "if", "(", "infoStation", ".", "represents", "===", "\"station\"", "&&", "eventBackup", "!==", "null", "&&", "eventBackup", ".", "options", ".", "represents", "===", "\"station\"", "&&", "eventBackup", ".", "options", ".", "id", "===", "infoStation", ".", "id", ")", "{", "/*Se deselecciona.*/", "eventBackup", "=", "null", ";", "marker", ".", "setIcon", "(", "markerStation", ")", ";", "paintCollapseByDefault", "(", ")", ";", "}", "else", "{", "/*Se guarda el id para la llamada AJAX por los datos metereológicos.*/", "let", "idStation", "=", "infoStation", ".", "id", ";", "/*LLAMADA AJAX ------------------------------------------------*/", "/*Se crea el objeto XMLHttpRequest haciendo controles de compatibilidad.*/", "request", "=", "makeRequest", "(", ")", ";", "/*En caso de no lograr crear el objeto XMLHttpRequest*/", "if", "(", "!", "request", ")", "{", "alert", "(", "'ERROR : No es posible crear una instancia XMLHTTP'", ")", ";", "return", "false", ";", "}", "else", "{", "/*Si se logró crear el objeto XMLHttpRequest*/", "/*Se asignan las acciones ante el cambio de estado*/", "request", ".", "onreadystatechange", "=", "function", "(", ")", "{", "if", "(", "this", ".", "readyState", "==", "4", ")", "{", "/*Si se recibieron los datos.*/", "if", "(", "this", ".", "status", "==", "200", ")", "{", "/*Se recibe la respuesta y se parsea a JSON.*/", "let", "responseJson", "=", "JSON", ".", "parse", "(", "this", ".", "responseText", ")", ";", "/*Se obtiene el array de datos metereológicos.*/", "let", "lastPosArrayData", "=", "responseJson", ".", "result", ".", "length", "-", "1", ";", "let", "lastData", "=", "responseJson", ".", "result", "[", "lastPosArrayData", "]", ";", "/*Si ningún marcador está activo...*/", "if", "(", "eventBackup", "===", "null", ")", "{", "/*Se cambia el marcador de estación al \"activo\".*/", "marker", ".", "setIcon", "(", "markerStationActive", ")", ";", "/*Se almacena como marcador activo.*/", "eventBackup", "=", "marker", ";", "/*Se pinta el collapse con los datos metereológicos.*/", "paintCollapse", "(", "infoStation", ",", "lastData", ")", ";", "}", "else", "{", "/*Si ya hay un marcador activo...*/", "/*Si representa una ubicación seleccionada por el usuario...*/", "if", "(", "eventBackup", ".", "options", ".", "represents", "===", "\"click\"", ")", "{", "/*Se cambia por el marcador de selección del usuario \"inactivo\".*/", "eventBackup", ".", "setIcon", "(", "markerSelected", ")", ";", "/*Se cambia el marcador de estación al \"activo\".*/", "marker", ".", "setIcon", "(", "markerStationActive", ")", ";", "/*Se almacena como marcador activo.*/", "eventBackup", "=", "marker", ";", "/*Se pinta el collapse con los datos metereológicos.*/", "paintCollapse", "(", "infoStation", ",", "lastData", ")", ";", "}", "else", "if", "(", "eventBackup", ".", "options", ".", "represents", "===", "\"station\"", ")", "{", "/*Si representa una estación...*/", "/*Se cambia el activo por el marcador de estación \"inactivo\".*/", "eventBackup", ".", "setIcon", "(", "markerStation", ")", ";", "/*Se cambia el marcador de estación al \"activo\".*/", "marker", ".", "setIcon", "(", "markerStationActive", ")", ";", "/*Se almacena como marcador activo.*/", "eventBackup", "=", "marker", ";", "/*Se pinta el collapse con los datos metereológicos.*/", "paintCollapse", "(", "infoStation", ",", "lastData", ")", ";", "}", "}", "}", "else", "{", "alert", "(", "'El código de estado fue: ' ", " ", "his.", "s", "tatus)", ";", "", "}", "}", "}", "/*Se define URL*/", "let", "fileUrl", "=", "'../Controllers/AjaxController.jsp'", ";", "let", "params", "=", "'?accion=verDatosDeEstacion&id='", "+", "idStation", ";", "request", ".", "open", "(", "'GET'", ",", "fileUrl", "+", "params", ",", "true", ")", ";", "request", ".", "send", "(", ")", ";", "}", "/*FIN LLAMADA AJAX ------------------------------------------------*/", "}", "}" ]
[ 70, 0 ]
[ 153, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
markAsDone
({ index })
null
Marcar un todo como hecho y guardar la lista
Marcar un todo como hecho y guardar la lista
async function markAsDone({ index }) { const currentTodos = await readTodoList(); currentTodos.tasks[index - 1].done = true; await saveTodosToFile(currentTodos); }
[ "async", "function", "markAsDone", "(", "{", "index", "}", ")", "{", "const", "currentTodos", "=", "await", "readTodoList", "(", ")", ";", "currentTodos", ".", "tasks", "[", "index", "-", "1", "]", ".", "done", "=", "true", ";", "await", "saveTodosToFile", "(", "currentTodos", ")", ";", "}" ]
[ 105, 0 ]
[ 111, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
usuario
(id_usuario)
null
Editar rol usuario
Editar rol usuario
function usuario(id_usuario) { var id = id_usuario; $.ajax({ type: "GET", url: "ajax/editar_rol_usuario.php?id=" + id, }).done(function(data) { ver_tabla_usuario(); }) }
[ "function", "usuario", "(", "id_usuario", ")", "{", "var", "id", "=", "id_usuario", ";", "$", ".", "ajax", "(", "{", "type", ":", "\"GET\"", ",", "url", ":", "\"ajax/editar_rol_usuario.php?id=\"", "+", "id", ",", "}", ")", ".", "done", "(", "function", "(", "data", ")", "{", "ver_tabla_usuario", "(", ")", ";", "}", ")", "}" ]
[ 151, 0 ]
[ 159, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
alternarManual
()
null
/*Esta function activa y desactiva el MODO MANUAL
/*Esta function activa y desactiva el MODO MANUAL
function alternarManual(){ if (manualCheck==false) { manualCheck=true; document.getElementById("manBotonMan").style.backgroundColor="#ffb84d"; document.getElementById("manAdelante").disabled=false; document.getElementById("manAtras").disabled=false; modoActivo=true; }else{ manualCheck=false; document.getElementById("manBotonMan").style.backgroundColor="#01313a"; document.getElementById("manAdelante").disabled=true; document.getElementById("manAtras").disabled=true; modoActivo=false; } var datos = '\"WEB_1\".BOTON_MANUAL='+manualCheck; $($.ajax({ method:'POST', data:datos, success:function(datos){ console.log("Funciona, los datos enviados son:"+manualCheck); }, error:function(){ console.log("errores"); } })) }
[ "function", "alternarManual", "(", ")", "{", "if", "(", "manualCheck", "==", "false", ")", "{", "manualCheck", "=", "true", ";", "document", ".", "getElementById", "(", "\"manBotonMan\"", ")", ".", "style", ".", "backgroundColor", "=", "\"#ffb84d\"", ";", "document", ".", "getElementById", "(", "\"manAdelante\"", ")", ".", "disabled", "=", "false", ";", "document", ".", "getElementById", "(", "\"manAtras\"", ")", ".", "disabled", "=", "false", ";", "modoActivo", "=", "true", ";", "}", "else", "{", "manualCheck", "=", "false", ";", "document", ".", "getElementById", "(", "\"manBotonMan\"", ")", ".", "style", ".", "backgroundColor", "=", "\"#01313a\"", ";", "document", ".", "getElementById", "(", "\"manAdelante\"", ")", ".", "disabled", "=", "true", ";", "document", ".", "getElementById", "(", "\"manAtras\"", ")", ".", "disabled", "=", "true", ";", "modoActivo", "=", "false", ";", "}", "var", "datos", "=", "'\\\"WEB_1\\\".BOTON_MANUAL='", "+", "manualCheck", ";", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "datos", ",", "success", ":", "function", "(", "datos", ")", "{", "console", ".", "log", "(", "\"Funciona, los datos enviados son:\"", "+", "manualCheck", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "}" ]
[ 7, 0 ]
[ 32, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
cargarImagenes
()
null
Cargan todas las imágenes iguales.
Cargan todas las imágenes iguales.
function cargarImagenes() { let gridPrincipal = document.querySelector("#grid-principal"); gridPrincipal.classList.toggle("cargar-imagenes"); }
[ "function", "cargarImagenes", "(", ")", "{", "let", "gridPrincipal", "=", "document", ".", "querySelector", "(", "\"#grid-principal\"", ")", ";", "gridPrincipal", ".", "classList", ".", "toggle", "(", "\"cargar-imagenes\"", ")", ";", "}" ]
[ 13, 0 ]
[ 16, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
esMovimientoPosible
(miArreglo, ficha)
null
Este es el método que devuelve TRUE o FALSE en caso de que el movimiento se pueda realizar La clave de este método, es que utiliza los valores contenidos dentro de cada ficha.
Este es el método que devuelve TRUE o FALSE en caso de que el movimiento se pueda realizar La clave de este método, es que utiliza los valores contenidos dentro de cada ficha.
function esMovimientoPosible(miArreglo, ficha) { // Se recorre el arreglo de forma ordenada, inicio a fin. for(var i = 0; i < miArreglo.length; i++) { // Valida si encontró el número de la ficha seleccionada dentro del arreglo, no hacerlo sólo sigue el ciclo if(Number(miArreglo[i].textContent) === ficha) { // Cuando se encontró el número de la ficha dentro del arreglo de objetos, se valida si el movimiento // es posible por medio de condiciones, que validan si existe una celda arriba, abajo, izquierda o a // la derecha sin texto. if( // Revisa si el movimiento para arriba es posible (miArreglo[i - nivel] && miArreglo[i - nivel].textContent == 0) || // Revisa si el movimiento para abajo es posible ((miArreglo[i + nivel]) && miArreglo[i + nivel].textContent == 0) || // Revisa el el movimiento para la izquierda es posible ((i % nivel) && miArreglo[i - 1].textContent == 0) || // Revisa el el movimiento para la derecha es posible (((i + 1) % nivel) && miArreglo[i + 1].textContent == 0) ) { // Si alguna de las condiciones se cumplió, significa que sí hay una celda vacía y sí se puede mover return true; } else { // No hay una celda vacía. Se invalida el movimiento return false; } } } }
[ "function", "esMovimientoPosible", "(", "miArreglo", ",", "ficha", ")", "{", "// Se recorre el arreglo de forma ordenada, inicio a fin.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "miArreglo", ".", "length", ";", "i", "++", ")", "{", "// Valida si encontró el número de la ficha seleccionada dentro del arreglo, no hacerlo sólo sigue el ciclo", "if", "(", "Number", "(", "miArreglo", "[", "i", "]", ".", "textContent", ")", "===", "ficha", ")", "{", "// Cuando se encontró el número de la ficha dentro del arreglo de objetos, se valida si el movimiento", "// es posible por medio de condiciones, que validan si existe una celda arriba, abajo, izquierda o a", "// la derecha sin texto.", "if", "(", "// Revisa si el movimiento para arriba es posible", "(", "miArreglo", "[", "i", "-", "nivel", "]", "&&", "miArreglo", "[", "i", "-", "nivel", "]", ".", "textContent", "==", "0", ")", "||", "// Revisa si el movimiento para abajo es posible", "(", "(", "miArreglo", "[", "i", "+", "nivel", "]", ")", "&&", "miArreglo", "[", "i", "+", "nivel", "]", ".", "textContent", "==", "0", ")", "||", "// Revisa el el movimiento para la izquierda es posible", "(", "(", "i", "%", "nivel", ")", "&&", "miArreglo", "[", "i", "-", "1", "]", ".", "textContent", "==", "0", ")", "||", "// Revisa el el movimiento para la derecha es posible", "(", "(", "(", "i", "+", "1", ")", "%", "nivel", ")", "&&", "miArreglo", "[", "i", "+", "1", "]", ".", "textContent", "==", "0", ")", ")", "{", "// Si alguna de las condiciones se cumplió, significa que sí hay una celda vacía y sí se puede mover", "return", "true", ";", "}", "else", "{", "// No hay una celda vacía. Se invalida el movimiento", "return", "false", ";", "}", "}", "}", "}" ]
[ 126, 0 ]
[ 156, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
calcularMediaAritmetica
(lista)
null
* CALCULADORA DEL PROMEDIO DE LOS NUMEROS INGRESADOS
* CALCULADORA DEL PROMEDIO DE LOS NUMEROS INGRESADOS
function calcularMediaAritmetica(lista) { const sumaLista = lista.reduce( function (valorAcumulado = 0, nuevoVal) { return valorAcumulado + nuevoVal; } ) const promedioLista = sumaLista / lista.length; return promedioLista; }
[ "function", "calcularMediaAritmetica", "(", "lista", ")", "{", "const", "sumaLista", "=", "lista", ".", "reduce", "(", "function", "(", "valorAcumulado", "=", "0", ",", "nuevoVal", ")", "{", "return", "valorAcumulado", "+", "nuevoVal", ";", "}", ")", "const", "promedioLista", "=", "sumaLista", "/", "lista", ".", "length", ";", "return", "promedioLista", ";", "}" ]
[ 15, 0 ]
[ 23, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Mostrar
()
null
/*Debemos lograr tomar un dato por 'ID' y luego mostrarlo por 'Alert' al presionar el botón 'MOSTRAR'
/*Debemos lograr tomar un dato por 'ID' y luego mostrarlo por 'Alert' al presionar el botón 'MOSTRAR'
function Mostrar() { var nombre; nombre = document.getElementById("elNombre").value; alert ("Su nombre es: " + nombre); }
[ "function", "Mostrar", "(", ")", "{", "var", "nombre", ";", "nombre", "=", "document", ".", "getElementById", "(", "\"elNombre\"", ")", ".", "value", ";", "alert", "(", "\"Su nombre es: \"", "+", "nombre", ")", ";", "}" ]
[ 2, 0 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
HexAHslvar
(hex, nh, ns, nl)
null
3) Formulas para cambio de colores. Hexadecimal hsl ekiline, recibe Hexadecimal y con variables de luz modifica el tono. @param {*} hex recibe HEX @param {*} nh modificador hue @param {*} ns modificador saturation @param {*} nl modificador lightness @returns Devuelve HEX modificado.
3) Formulas para cambio de colores. Hexadecimal hsl ekiline, recibe Hexadecimal y con variables de luz modifica el tono.
function HexAHslvar(hex, nh, ns, nl) { hex = hex.replace('#', ''); var r = parseInt(hex.substring(0, 2), 16); var g = parseInt(hex.substring(2, 4), 16); var b = parseInt(hex.substring(4, 6), 16); //para mantener la opacidad la extraemos en una variable alternativa var opa = hex.substring(6, 8); r /= 255; g /= 255; b /= 255; var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; if (max == min) { h = s = 0; // achromatic } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch(max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } s = s * 100; s = Math.round(s); l = l * 100; l = Math.round(l); h = Math.round(360 * h); h = h + nh; s = s + ns; l = l + nl; var r2, g2, b2, m, c, x; if (!isFinite(h)) h = 0; if (!isFinite(s)) s = 0; if (!isFinite(l)) l = 0; h /= 60; if (h < 0) h = 6 - (-h % 6); h %= 6; s = Math.max(0, Math.min(1, s / 100)); l = Math.max(0, Math.min(1, l / 100)); c = (1 - Math.abs((2 * l) - 1)) * s; x = c * (1 - Math.abs((h % 2) - 1)); if (h < 1) { r2 = c; g2 = x; b2 = 0; } else if (h < 2) { r2 = x; g2 = c; b2 = 0; } else if (h < 3) { r2 = 0; g2 = c; b2 = x; } else if (h < 4) { r2 = 0; g2 = x; b2 = c; } else if (h < 5) { r2 = x; g2 = 0; b2 = c; } else { r2 = c; g2 = 0; b2 = x; } m = l - c / 2; r2 = Math.round((r2 + m) * 255); g2 = Math.round((g2 + m) * 255); b2 = Math.round((b2 + m) * 255); var fullrgb = [r2, g2, b2]; function hextract(x) { return ('0' + parseInt(x).toString(16)).slice(-2); } return '#' + hextract(fullrgb[0]) + hextract(fullrgb[1]) + hextract(fullrgb[2]) + opa; }
[ "function", "HexAHslvar", "(", "hex", ",", "nh", ",", "ns", ",", "nl", ")", "{", "hex", "=", "hex", ".", "replace", "(", "'#'", ",", "''", ")", ";", "var", "r", "=", "parseInt", "(", "hex", ".", "substring", "(", "0", ",", "2", ")", ",", "16", ")", ";", "var", "g", "=", "parseInt", "(", "hex", ".", "substring", "(", "2", ",", "4", ")", ",", "16", ")", ";", "var", "b", "=", "parseInt", "(", "hex", ".", "substring", "(", "4", ",", "6", ")", ",", "16", ")", ";", "//para mantener la opacidad la extraemos en una variable alternativa", "var", "opa", "=", "hex", ".", "substring", "(", "6", ",", "8", ")", ";", "r", "/=", "255", ";", "g", "/=", "255", ";", "b", "/=", "255", ";", "var", "max", "=", "Math", ".", "max", "(", "r", ",", "g", ",", "b", ")", ",", "min", "=", "Math", ".", "min", "(", "r", ",", "g", ",", "b", ")", ";", "var", "h", ",", "s", ",", "l", "=", "(", "max", "+", "min", ")", "/", "2", ";", "if", "(", "max", "==", "min", ")", "{", "h", "=", "s", "=", "0", ";", "// achromatic", "}", "else", "{", "var", "d", "=", "max", "-", "min", ";", "s", "=", "l", ">", "0.5", "?", "d", "/", "(", "2", "-", "max", "-", "min", ")", ":", "d", "/", "(", "max", "+", "min", ")", ";", "switch", "(", "max", ")", "{", "case", "r", ":", "h", "=", "(", "g", "-", "b", ")", "/", "d", "+", "(", "g", "<", "b", "?", "6", ":", "0", ")", ";", "break", ";", "case", "g", ":", "h", "=", "(", "b", "-", "r", ")", "/", "d", "+", "2", ";", "break", ";", "case", "b", ":", "h", "=", "(", "r", "-", "g", ")", "/", "d", "+", "4", ";", "break", ";", "}", "h", "/=", "6", ";", "}", "s", "=", "s", "*", "100", ";", "s", "=", "Math", ".", "round", "(", "s", ")", ";", "l", "=", "l", "*", "100", ";", "l", "=", "Math", ".", "round", "(", "l", ")", ";", "h", "=", "Math", ".", "round", "(", "360", "*", "h", ")", ";", "h", "=", "h", "+", "nh", ";", "s", "=", "s", "+", "ns", ";", "l", "=", "l", "+", "nl", ";", "var", "r2", ",", "g2", ",", "b2", ",", "m", ",", "c", ",", "x", ";", "if", "(", "!", "isFinite", "(", "h", ")", ")", "h", "=", "0", ";", "if", "(", "!", "isFinite", "(", "s", ")", ")", "s", "=", "0", ";", "if", "(", "!", "isFinite", "(", "l", ")", ")", "l", "=", "0", ";", "h", "/=", "60", ";", "if", "(", "h", "<", "0", ")", "h", "=", "6", "-", "(", "-", "h", "%", "6", ")", ";", "h", "%=", "6", ";", "s", "=", "Math", ".", "max", "(", "0", ",", "Math", ".", "min", "(", "1", ",", "s", "/", "100", ")", ")", ";", "l", "=", "Math", ".", "max", "(", "0", ",", "Math", ".", "min", "(", "1", ",", "l", "/", "100", ")", ")", ";", "c", "=", "(", "1", "-", "Math", ".", "abs", "(", "(", "2", "*", "l", ")", "-", "1", ")", ")", "*", "s", ";", "x", "=", "c", "*", "(", "1", "-", "Math", ".", "abs", "(", "(", "h", "%", "2", ")", "-", "1", ")", ")", ";", "if", "(", "h", "<", "1", ")", "{", "r2", "=", "c", ";", "g2", "=", "x", ";", "b2", "=", "0", ";", "}", "else", "if", "(", "h", "<", "2", ")", "{", "r2", "=", "x", ";", "g2", "=", "c", ";", "b2", "=", "0", ";", "}", "else", "if", "(", "h", "<", "3", ")", "{", "r2", "=", "0", ";", "g2", "=", "c", ";", "b2", "=", "x", ";", "}", "else", "if", "(", "h", "<", "4", ")", "{", "r2", "=", "0", ";", "g2", "=", "x", ";", "b2", "=", "c", ";", "}", "else", "if", "(", "h", "<", "5", ")", "{", "r2", "=", "x", ";", "g2", "=", "0", ";", "b2", "=", "c", ";", "}", "else", "{", "r2", "=", "c", ";", "g2", "=", "0", ";", "b2", "=", "x", ";", "}", "m", "=", "l", "-", "c", "/", "2", ";", "r2", "=", "Math", ".", "round", "(", "(", "r2", "+", "m", ")", "*", "255", ")", ";", "g2", "=", "Math", ".", "round", "(", "(", "g2", "+", "m", ")", "*", "255", ")", ";", "b2", "=", "Math", ".", "round", "(", "(", "b2", "+", "m", ")", "*", "255", ")", ";", "var", "fullrgb", "=", "[", "r2", ",", "g2", ",", "b2", "]", ";", "function", "hextract", "(", "x", ")", "{", "return", "(", "'0'", "+", "parseInt", "(", "x", ")", ".", "toString", "(", "16", ")", ")", ".", "slice", "(", "-", "2", ")", ";", "}", "return", "'#'", "+", "hextract", "(", "fullrgb", "[", "0", "]", ")", "+", "hextract", "(", "fullrgb", "[", "1", "]", ")", "+", "hextract", "(", "fullrgb", "[", "2", "]", ")", "+", "opa", ";", "}" ]
[ 163, 1 ]
[ 276, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
x2
(t)
null
función para cambiar la coordenada x final de la línea
función para cambiar la coordenada x final de la línea
function x2(t){ return sin(t/15)*125+sin(t/25)*125+sin(t/35)*125; }
[ "function", "x2", "(", "t", ")", "{", "return", "sin", "(", "t", "/", "15", ")", "*", "125", "+", "sin", "(", "t", "/", "25", ")", "*", "125", "+", "sin", "(", "t", "/", "35", ")", "*", "125", ";", "}" ]
[ 37, 0 ]
[ 39, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
y2
(t)
null
función para cambiar la coordenada final de la línea
función para cambiar la coordenada final de la línea
function y2(t){ return cos(t/15)*125+cos(t/25)*125+cos(t/35)*125; }
[ "function", "y2", "(", "t", ")", "{", "return", "cos", "(", "t", "/", "15", ")", "*", "125", "+", "cos", "(", "t", "/", "25", ")", "*", "125", "+", "cos", "(", "t", "/", "35", ")", "*", "125", ";", "}" ]
[ 42, 0 ]
[ 44, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
resetGame
()
null
función que resetea el juego
función que resetea el juego
function resetGame() { totalAttempts = 0; humanNumber.value = ""; guessNumber(); }
[ "function", "resetGame", "(", ")", "{", "totalAttempts", "=", "0", ";", "humanNumber", ".", "value", "=", "\"\"", ";", "guessNumber", "(", ")", ";", "}" ]
[ 42, 0 ]
[ 46, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Save
(obj)
null
******** Persistencia no mongo *********
******** Persistencia no mongo *********
function Save(obj){ var lanche = new LancheModel(obj); lanche.save(function(err){ console.log("salvando"); if(err){ console.log("erro ao salvar no mongo"); console.log(err); }else{ console.log("salvo com sucesso"); } }); }
[ "function", "Save", "(", "obj", ")", "{", "var", "lanche", "=", "new", "LancheModel", "(", "obj", ")", ";", "lanche", ".", "save", "(", "function", "(", "err", ")", "{", "console", ".", "log", "(", "\"salvando\"", ")", ";", "if", "(", "err", ")", "{", "console", ".", "log", "(", "\"erro ao salvar no mongo\"", ")", ";", "console", ".", "log", "(", "err", ")", ";", "}", "else", "{", "console", ".", "log", "(", "\"salvo com sucesso\"", ")", ";", "}", "}", ")", ";", "}" ]
[ 45, 0 ]
[ 56, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(form)
null
funcion para agregar producto a mesa por cuenta
funcion para agregar producto a mesa por cuenta
function(form){ $.ajax({ type: "POST", url: "cuenta/addProducto/", data: form, dataType: "json", success: function(response) { showSuccess(); showCuenta(response.data.idmesa); console.log(response.data.idmesa); }, error: function() { alert('Error al agregar producto.'); } }); }
[ "function", "(", "form", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "\"cuenta/addProducto/\"", ",", "data", ":", "form", ",", "dataType", ":", "\"json\"", ",", "success", ":", "function", "(", "response", ")", "{", "showSuccess", "(", ")", ";", "showCuenta", "(", "response", ".", "data", ".", "idmesa", ")", ";", "console", ".", "log", "(", "response", ".", "data", ".", "idmesa", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "alert", "(", "'Error al agregar producto.'", ")", ";", "}", "}", ")", ";", "}" ]
[ 125, 16 ]
[ 140, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
comentar_teacher
(key_msj)
null
funcion para la seccion de comentario del teacher
funcion para la seccion de comentario del teacher
function comentar_teacher(key_msj) { var token = $("#token").val(); var curso_id = $("#course").val(); var section = $("#section").val(); var user_id = $("#user").val(); $.ajax({ url: "../../../../ajax/div_comentar", headers: token, data: { _token: token, key: key_msj, curso: curso_id, seccion: section, usuario: user_id, }, type: "POST", datatype: "json", success: function (data) { //console.log(response); $("#comentar_msj_" + key_msj) .prepend(data) .fadeIn(1000, function () { $("#comentar_msj_" + key_msj).css({ border: "2px solid lightcoral", "border-radius": "5px", }); }); $("#comentar_" + key_msj).hide(); $("#comentario_" + key_msj).focus(); }, error: function (response) { console.log(response); }, }); }
[ "function", "comentar_teacher", "(", "key_msj", ")", "{", "var", "token", "=", "$", "(", "\"#token\"", ")", ".", "val", "(", ")", ";", "var", "curso_id", "=", "$", "(", "\"#course\"", ")", ".", "val", "(", ")", ";", "var", "section", "=", "$", "(", "\"#section\"", ")", ".", "val", "(", ")", ";", "var", "user_id", "=", "$", "(", "\"#user\"", ")", ".", "val", "(", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "\"../../../../ajax/div_comentar\"", ",", "headers", ":", "token", ",", "data", ":", "{", "_token", ":", "token", ",", "key", ":", "key_msj", ",", "curso", ":", "curso_id", ",", "seccion", ":", "section", ",", "usuario", ":", "user_id", ",", "}", ",", "type", ":", "\"POST\"", ",", "datatype", ":", "\"json\"", ",", "success", ":", "function", "(", "data", ")", "{", "//console.log(response);", "$", "(", "\"#comentar_msj_\"", "+", "key_msj", ")", ".", "prepend", "(", "data", ")", ".", "fadeIn", "(", "1000", ",", "function", "(", ")", "{", "$", "(", "\"#comentar_msj_\"", "+", "key_msj", ")", ".", "css", "(", "{", "border", ":", "\"2px solid lightcoral\"", ",", "\"border-radius\"", ":", "\"5px\"", ",", "}", ")", ";", "}", ")", ";", "$", "(", "\"#comentar_\"", "+", "key_msj", ")", ".", "hide", "(", ")", ";", "$", "(", "\"#comentario_\"", "+", "key_msj", ")", ".", "focus", "(", ")", ";", "}", ",", "error", ":", "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "}", ",", "}", ")", ";", "}" ]
[ 600, 0 ]
[ 635, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Es mucho más común acceder a propiedades del objeto, DENTRO DEL MISMO OBJETO, utilizando una palabra reservada "this"
Es mucho más común acceder a propiedades del objeto, DENTRO DEL MISMO OBJETO, utilizando una palabra reservada "this"
function() { return this.apellido + " de " + this.edad + " años de edad está atrapando pokemones" }
[ "function", "(", ")", "{", "return", "this", ".", "apellido", "+", "\" de \"", "+", "this", ".", "edad", "+", "\" años de edad está atrapando pokemones\"", "}" ]
[ 80, 21 ]
[ 82, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
clearForm
()
null
Cancelar edicion/Cadastro
Cancelar edicion/Cadastro
function clearForm(){ if(updatedStatus){ regMode(); } taskform.reset(); }
[ "function", "clearForm", "(", ")", "{", "if", "(", "updatedStatus", ")", "{", "regMode", "(", ")", ";", "}", "taskform", ".", "reset", "(", ")", ";", "}" ]
[ 43, 0 ]
[ 49, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program
insertarBD
(infoContacto)
null
Funcion insertar en la base de datos vía AJAX
Funcion insertar en la base de datos vía AJAX
function insertarBD(infoContacto){ // Llamada a ajax // Crear el objeto const xhr = new XMLHttpRequest(); // Abrie la conexion a ajax xhr.open('POST', 'includes/modelos/modelo-contacto.php', true); // Pasar los datos a ajax xhr.onload = function(){ if(this.status === 200 ){ console.log(JSON.parse(xhr.responseText)); // En php no existe los arreglos asociativos, se llaman objetos //Leemos la respuesta de php - primero convertimos el string Json en objeto para leer const respuesta = JSON.parse( xhr.responseText ); //console.log(respuesta.nombre); // INSERTA UN NUEVO ELEMENTO A LA TABLA const nuevoContacto = document.createElement('tr'); nuevoContacto.innerHTML = ` <td>${respuesta.infoContacto.nombre}</td> <td>${respuesta.infoContacto.email}</td> <td>${respuesta.infoContacto.pass}</td> <td>${respuesta.infoContacto.date}</td> <td>${respuesta.infoContacto.link_perfil}</td> <td>${respuesta.infoContacto.telefono}</td> <td>${respuesta.infoContacto.link_perfil_real}</td> <td>${respuesta.infoContacto.pais}</td> `; // Crea el contenedor para los botones const contenedorAcciones = document.createElement('td'); contenedorAcciones.classList.add('acciones'); // Creacion del icono de editar const iconoEditar = document.createElement('i'); iconoEditar.classList.add('fas', 'fa-pen-square'); // Crear el enlace para editar const btnEditar = document.createElement('a'); btnEditar.appendChild(iconoEditar); btnEditar.href = `editar-perfil.php=${respuesta.infoContacto.id_insertado}`; btnEditar.classList.add('btn', 'btn-editar'); // Lo agregamos al padre contenedorAcciones.appendChild(btnEditar); /***////////*/*////*///*//*//*///*///////// */ */ */ // Crear el icono de eliminar const iconoEliminar = document.createElement('i'); iconoEliminar.classList.add('fas', 'fa-trash'); // Crear el enlace para editar const btnEliminar = document.createElement('button'); btnEliminar.appendChild(iconoEliminar); btnEliminar.setAttribute('data-id', respuesta.infoContacto.id_insertado); btnEliminar.classList.add('btn', 'btn-borrar'); // Lo agregamos al padre contenedorAcciones.appendChild(btnEliminar); // Agregarlo al tr para mostrarlo en la página nuevoContacto.appendChild(contenedorAcciones); /* Agregamos a la lista de perfiles que se muestra en pantalla */ listadoPerfiles.appendChild(nuevoContacto); /* RESETEAR EL FORMULARIO DESPUÉS DE AGREGAR LA INFO */ document.querySelector('form').reset(); /* MOSTRAR LA NOTIFICACIÓN AL AGREGAR UN PERFIL NUEVO */ mostrarNotificaciones('Perfil creado correctamente', 'exito'); // Actualizar contador de perfiles numeroContactos(); } } // Enviar los datos a ajax xhr.send(infoContacto); }
[ "function", "insertarBD", "(", "infoContacto", ")", "{", "// Llamada a ajax", "// Crear el objeto", "const", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ";", "// Abrie la conexion a ajax", "xhr", ".", "open", "(", "'POST'", ",", "'includes/modelos/modelo-contacto.php'", ",", "true", ")", ";", "// Pasar los datos a ajax", "xhr", ".", "onload", "=", "function", "(", ")", "{", "if", "(", "this", ".", "status", "===", "200", ")", "{", "console", ".", "log", "(", "JSON", ".", "parse", "(", "xhr", ".", "responseText", ")", ")", ";", "// En php no existe los arreglos asociativos, se llaman objetos", "//Leemos la respuesta de php - primero convertimos el string Json en objeto para leer", "const", "respuesta", "=", "JSON", ".", "parse", "(", "xhr", ".", "responseText", ")", ";", "//console.log(respuesta.nombre);", "// INSERTA UN NUEVO ELEMENTO A LA TABLA ", "const", "nuevoContacto", "=", "document", ".", "createElement", "(", "'tr'", ")", ";", "nuevoContacto", ".", "innerHTML", "=", "`", "${", "respuesta", ".", "infoContacto", ".", "nombre", "}", "${", "respuesta", ".", "infoContacto", ".", "email", "}", "${", "respuesta", ".", "infoContacto", ".", "pass", "}", "${", "respuesta", ".", "infoContacto", ".", "date", "}", "${", "respuesta", ".", "infoContacto", ".", "link_perfil", "}", "${", "respuesta", ".", "infoContacto", ".", "telefono", "}", "${", "respuesta", ".", "infoContacto", ".", "link_perfil_real", "}", "${", "respuesta", ".", "infoContacto", ".", "pais", "}", "`", ";", "// Crea el contenedor para los botones", "const", "contenedorAcciones", "=", "document", ".", "createElement", "(", "'td'", ")", ";", "contenedorAcciones", ".", "classList", ".", "add", "(", "'acciones'", ")", ";", "// Creacion del icono de editar", "const", "iconoEditar", "=", "document", ".", "createElement", "(", "'i'", ")", ";", "iconoEditar", ".", "classList", ".", "add", "(", "'fas'", ",", "'fa-pen-square'", ")", ";", "// Crear el enlace para editar", "const", "btnEditar", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "btnEditar", ".", "appendChild", "(", "iconoEditar", ")", ";", "btnEditar", ".", "href", "=", "`", "${", "respuesta", ".", "infoContacto", ".", "id_insertado", "}", "`", ";", "btnEditar", ".", "classList", ".", "add", "(", "'btn'", ",", "'btn-editar'", ")", ";", "// Lo agregamos al padre", "contenedorAcciones", ".", "appendChild", "(", "btnEditar", ")", ";", "/***/", "///////*/*////*///*//*//*///*///////// */ */ */", "// Crear el icono de eliminar ", "const", "iconoEliminar", "=", "document", ".", "createElement", "(", "'i'", ")", ";", "iconoEliminar", ".", "classList", ".", "add", "(", "'fas'", ",", "'fa-trash'", ")", ";", "// Crear el enlace para editar", "const", "btnEliminar", "=", "document", ".", "createElement", "(", "'button'", ")", ";", "btnEliminar", ".", "appendChild", "(", "iconoEliminar", ")", ";", "btnEliminar", ".", "setAttribute", "(", "'data-id'", ",", "respuesta", ".", "infoContacto", ".", "id_insertado", ")", ";", "btnEliminar", ".", "classList", ".", "add", "(", "'btn'", ",", "'btn-borrar'", ")", ";", "// Lo agregamos al padre", "contenedorAcciones", ".", "appendChild", "(", "btnEliminar", ")", ";", "// Agregarlo al tr para mostrarlo en la página", "nuevoContacto", ".", "appendChild", "(", "contenedorAcciones", ")", ";", "/* Agregamos a la lista de perfiles que se muestra en pantalla */", "listadoPerfiles", ".", "appendChild", "(", "nuevoContacto", ")", ";", "/* RESETEAR EL FORMULARIO DESPUÉS DE AGREGAR LA INFO */", "document", ".", "querySelector", "(", "'form'", ")", ".", "reset", "(", ")", ";", "/* MOSTRAR LA NOTIFICACIÓN AL AGREGAR UN PERFIL NUEVO */ ", "mostrarNotificaciones", "(", "'Perfil creado correctamente'", ",", "'exito'", ")", ";", "// Actualizar contador de perfiles", "numeroContactos", "(", ")", ";", "}", "}", "// Enviar los datos a ajax", "xhr", ".", "send", "(", "infoContacto", ")", ";", "}" ]
[ 76, 0 ]
[ 165, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
div7
(x)
null
Key Scenario 2
Key Scenario 2
function div7(x) { x = x | 0; return ((x | 0) / 7) | 0; }
[ "function", "div7", "(", "x", ")", "{", "x", "=", "x", "|", "0", ";", "return", "(", "(", "x", "|", "0", ")", "/", "7", ")", "|", "0", ";", "}" ]
[ 31, 4 ]
[ 31, 63 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
variableEllipse
(x, y, px, py)
null
El método simple variableEllipse () fue creado específicamente para este programa. Calcula la velocidad del mouse y dibuja una pequeña elipse si el mouse se mueve lentamente y dibuja una elipse grande si el mouse se mueve rápidamente
El método simple variableEllipse () fue creado específicamente para este programa. Calcula la velocidad del mouse y dibuja una pequeña elipse si el mouse se mueve lentamente y dibuja una elipse grande si el mouse se mueve rápidamente
function variableEllipse(x, y, px, py) { let speed = abs(x - px) + abs(y - py); stroke(speed); ellipse(x, y, speed, speed); }
[ "function", "variableEllipse", "(", "x", ",", "y", ",", "px", ",", "py", ")", "{", "let", "speed", "=", "abs", "(", "x", "-", "px", ")", "+", "abs", "(", "y", "-", "py", ")", ";", "stroke", "(", "speed", ")", ";", "ellipse", "(", "x", ",", "y", ",", "speed", ",", "speed", ")", ";", "}" ]
[ 21, 0 ]
[ 25, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
render
(graph)
null
numero ancho enlace
numero ancho enlace
function render(graph) { var svg = d3.select("svg"); svg_ = svg_ == null ? svg : svg_; svg = svg_; svg.selectAll("*").remove(); svg.style("height", window.screen.height * 0.75 + 'px'); var width = $("#svgXXX").width(); var height = window.screen.height * 0.75;//+svg.attr("height"); var simulation = d3.layout.force() .gravity(0.5). linkDistance(function (d) { console.log(d); return distanceCalc(d.distance); }) .charge(-2500) .size([width, height]); function coauthorFactor(coauthor) { if (coauthor == "true") { return Math.sqrt(20); } else { return Math.sqrt(1); } } ; function distanceCalc(distance) { if (distance < 100) { return parseInt(distance) + 100; } else if (distance > 500) { return parseInt(400); } else { return parseInt(distance); } } function showPopover(d) { console.log("OVER"); $(this).popover({ placement: 'auto', animation: false, container: 'body', trigger: 'manual', html: true, content: function () { return "<b>Author:</b> " + d.label + "<br />" + "<b>Keywords:</b> " + d.subject + "<br />"; //"<b>Title:</b> " + d.title + "<br />" + // "<b>Cluster:</b> " + d.clusterName + "<br />"; } }); $(this).popover('show') } function removePopovers() { $('.popover').each(function () { $(this).remove(); }); } for (var g in graph.links) { graph.links[g].source = 0; graph.links[g].target = parseInt(g) + 1; // console.log(graph.links[g].source ); } simulation .nodes(graph.nodes) .links(graph.links) .start(); var link = svg.append("g") .attr("class", "links") .selectAll("line") .data(graph.links) .enter().append("line") .attr("stroke-width", function (d) { return coauthorFactor(d.coauthor); }); link.append("title") .text(function (d) { return d.coauthor ? "coauthor" : ""; }); var node = svg.append("g") .attr("class", "nodes") .selectAll("g") .data(graph.nodes) .enter().append("g") .call(simulation.drag); var circles = node.append("circle") .attr("r", 26) .attr("fill", function (d) { return orgcolor(d.group); }); node.append("clipPath") .attr("id", "clipCircle") .append("circle") .attr("r", 22); var imagen = node.append("image") .attr("xlink:href", function (d) { if (d.img != "") { return d.img } else { return "wkhome/images/author-borderless.png"; } }) .attr("class", "node") .attr("x", "-30px") .attr("y", "-30px") .attr("width", function (d) { return 60 }) .attr("height", function (d) { return 60 }) .attr("clip-path", "url(#clipCircle)") .on("mouseover", function (d) { showPopover.call(this, d); }) .on("mouseout", function (d) { removePopovers(); }).on("dblclick", function (d) { removePopovers(d); $window.location.hash = '/author/profile/' + d.id; }); var lables = node.append("text") .text(function (d) { return d.lastname.split(" ")[0].split(",")[0].toUpperCase(); }) .attr('x', -20) .attr('y', 40); simulation.on("tick", function () { link.attr("x1", function (d) { return d.source.x; }) .attr("y1", function (d) { return d.source.y; }) .attr("x2", function (d) { return d.target.x; }) .attr("y2", function (d) { return d.target.y; }); node.attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; }); }); // }); function dragstarted(d) { if (!d3.event.active) simulation.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; } function dragged(d) { d.fx = d3.event.x; d.fy = d3.event.y; } function dragended(d) { if (!d3.event.active) simulation.alphaTarget(0); d.fx = null; d.fy = null; } }
[ "function", "render", "(", "graph", ")", "{", "var", "svg", "=", "d3", ".", "select", "(", "\"svg\"", ")", ";", "svg_", "=", "svg_", "==", "null", "?", "svg", ":", "svg_", ";", "svg", "=", "svg_", ";", "svg", ".", "selectAll", "(", "\"*\"", ")", ".", "remove", "(", ")", ";", "svg", ".", "style", "(", "\"height\"", ",", "window", ".", "screen", ".", "height", "*", "0.75", "+", "'px'", ")", ";", "var", "width", "=", "$", "(", "\"#svgXXX\"", ")", ".", "width", "(", ")", ";", "var", "height", "=", "window", ".", "screen", ".", "height", "*", "0.75", ";", "//+svg.attr(\"height\");", "var", "simulation", "=", "d3", ".", "layout", ".", "force", "(", ")", ".", "gravity", "(", "0.5", ")", ".", "linkDistance", "(", "function", "(", "d", ")", "{", "console", ".", "log", "(", "d", ")", ";", "return", "distanceCalc", "(", "d", ".", "distance", ")", ";", "}", ")", ".", "charge", "(", "-", "2500", ")", ".", "size", "(", "[", "width", ",", "height", "]", ")", ";", "function", "coauthorFactor", "(", "coauthor", ")", "{", "if", "(", "coauthor", "==", "\"true\"", ")", "{", "return", "Math", ".", "sqrt", "(", "20", ")", ";", "}", "else", "{", "return", "Math", ".", "sqrt", "(", "1", ")", ";", "}", "}", ";", "function", "distanceCalc", "(", "distance", ")", "{", "if", "(", "distance", "<", "100", ")", "{", "return", "parseInt", "(", "distance", ")", "+", "100", ";", "}", "else", "if", "(", "distance", ">", "500", ")", "{", "return", "parseInt", "(", "400", ")", ";", "}", "else", "{", "return", "parseInt", "(", "distance", ")", ";", "}", "}", "function", "showPopover", "(", "d", ")", "{", "console", ".", "log", "(", "\"OVER\"", ")", ";", "$", "(", "this", ")", ".", "popover", "(", "{", "placement", ":", "'auto'", ",", "animation", ":", "false", ",", "container", ":", "'body'", ",", "trigger", ":", "'manual'", ",", "html", ":", "true", ",", "content", ":", "function", "(", ")", "{", "return", "\"<b>Author:</b> \"", "+", "d", ".", "label", "+", "\"<br />\"", "+", "\"<b>Keywords:</b> \"", "+", "d", ".", "subject", "+", "\"<br />\"", ";", "//\"<b>Title:</b> \" + d.title + \"<br />\" +", "// \"<b>Cluster:</b> \" + d.clusterName + \"<br />\";", "}", "}", ")", ";", "$", "(", "this", ")", ".", "popover", "(", "'show'", ")", "}", "function", "removePopovers", "(", ")", "{", "$", "(", "'.popover'", ")", ".", "each", "(", "function", "(", ")", "{", "$", "(", "this", ")", ".", "remove", "(", ")", ";", "}", ")", ";", "}", "for", "(", "var", "g", "in", "graph", ".", "links", ")", "{", "graph", ".", "links", "[", "g", "]", ".", "source", "=", "0", ";", "graph", ".", "links", "[", "g", "]", ".", "target", "=", "parseInt", "(", "g", ")", "+", "1", ";", "// console.log(graph.links[g].source );", "}", "simulation", ".", "nodes", "(", "graph", ".", "nodes", ")", ".", "links", "(", "graph", ".", "links", ")", ".", "start", "(", ")", ";", "var", "link", "=", "svg", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"links\"", ")", ".", "selectAll", "(", "\"line\"", ")", ".", "data", "(", "graph", ".", "links", ")", ".", "enter", "(", ")", ".", "append", "(", "\"line\"", ")", ".", "attr", "(", "\"stroke-width\"", ",", "function", "(", "d", ")", "{", "return", "coauthorFactor", "(", "d", ".", "coauthor", ")", ";", "}", ")", ";", "link", ".", "append", "(", "\"title\"", ")", ".", "text", "(", "function", "(", "d", ")", "{", "return", "d", ".", "coauthor", "?", "\"coauthor\"", ":", "\"\"", ";", "}", ")", ";", "var", "node", "=", "svg", ".", "append", "(", "\"g\"", ")", ".", "attr", "(", "\"class\"", ",", "\"nodes\"", ")", ".", "selectAll", "(", "\"g\"", ")", ".", "data", "(", "graph", ".", "nodes", ")", ".", "enter", "(", ")", ".", "append", "(", "\"g\"", ")", ".", "call", "(", "simulation", ".", "drag", ")", ";", "var", "circles", "=", "node", ".", "append", "(", "\"circle\"", ")", ".", "attr", "(", "\"r\"", ",", "26", ")", ".", "attr", "(", "\"fill\"", ",", "function", "(", "d", ")", "{", "return", "orgcolor", "(", "d", ".", "group", ")", ";", "}", ")", ";", "node", ".", "append", "(", "\"clipPath\"", ")", ".", "attr", "(", "\"id\"", ",", "\"clipCircle\"", ")", ".", "append", "(", "\"circle\"", ")", ".", "attr", "(", "\"r\"", ",", "22", ")", ";", "var", "imagen", "=", "node", ".", "append", "(", "\"image\"", ")", ".", "attr", "(", "\"xlink:href\"", ",", "function", "(", "d", ")", "{", "if", "(", "d", ".", "img", "!=", "\"\"", ")", "{", "return", "d", ".", "img", "}", "else", "{", "return", "\"wkhome/images/author-borderless.png\"", ";", "}", "}", ")", ".", "attr", "(", "\"class\"", ",", "\"node\"", ")", ".", "attr", "(", "\"x\"", ",", "\"-30px\"", ")", ".", "attr", "(", "\"y\"", ",", "\"-30px\"", ")", ".", "attr", "(", "\"width\"", ",", "function", "(", "d", ")", "{", "return", "60", "}", ")", ".", "attr", "(", "\"height\"", ",", "function", "(", "d", ")", "{", "return", "60", "}", ")", ".", "attr", "(", "\"clip-path\"", ",", "\"url(#clipCircle)\"", ")", ".", "on", "(", "\"mouseover\"", ",", "function", "(", "d", ")", "{", "showPopover", ".", "call", "(", "this", ",", "d", ")", ";", "}", ")", ".", "on", "(", "\"mouseout\"", ",", "function", "(", "d", ")", "{", "removePopovers", "(", ")", ";", "}", ")", ".", "on", "(", "\"dblclick\"", ",", "function", "(", "d", ")", "{", "removePopovers", "(", "d", ")", ";", "$window", ".", "location", ".", "hash", "=", "'/author/profile/'", "+", "d", ".", "id", ";", "}", ")", ";", "var", "lables", "=", "node", ".", "append", "(", "\"text\"", ")", ".", "text", "(", "function", "(", "d", ")", "{", "return", "d", ".", "lastname", ".", "split", "(", "\" \"", ")", "[", "0", "]", ".", "split", "(", "\",\"", ")", "[", "0", "]", ".", "toUpperCase", "(", ")", ";", "}", ")", ".", "attr", "(", "'x'", ",", "-", "20", ")", ".", "attr", "(", "'y'", ",", "40", ")", ";", "simulation", ".", "on", "(", "\"tick\"", ",", "function", "(", ")", "{", "link", ".", "attr", "(", "\"x1\"", ",", "function", "(", "d", ")", "{", "return", "d", ".", "source", ".", "x", ";", "}", ")", ".", "attr", "(", "\"y1\"", ",", "function", "(", "d", ")", "{", "return", "d", ".", "source", ".", "y", ";", "}", ")", ".", "attr", "(", "\"x2\"", ",", "function", "(", "d", ")", "{", "return", "d", ".", "target", ".", "x", ";", "}", ")", ".", "attr", "(", "\"y2\"", ",", "function", "(", "d", ")", "{", "return", "d", ".", "target", ".", "y", ";", "}", ")", ";", "node", ".", "attr", "(", "\"transform\"", ",", "function", "(", "d", ")", "{", "return", "\"translate(\"", "+", "d", ".", "x", "+", "\",\"", "+", "d", ".", "y", "+", "\")\"", ";", "}", ")", ";", "}", ")", ";", "// });", "function", "dragstarted", "(", "d", ")", "{", "if", "(", "!", "d3", ".", "event", ".", "active", ")", "simulation", ".", "alphaTarget", "(", "0.3", ")", ".", "restart", "(", ")", ";", "d", ".", "fx", "=", "d", ".", "x", ";", "d", ".", "fy", "=", "d", ".", "y", ";", "}", "function", "dragged", "(", "d", ")", "{", "d", ".", "fx", "=", "d3", ".", "event", ".", "x", ";", "d", ".", "fy", "=", "d3", ".", "event", ".", "y", ";", "}", "function", "dragended", "(", "d", ")", "{", "if", "(", "!", "d3", ".", "event", ".", "active", ")", "simulation", ".", "alphaTarget", "(", "0", ")", ";", "d", ".", "fx", "=", "null", ";", "d", ".", "fy", "=", "null", ";", "}", "}" ]
[ 201, 6 ]
[ 390, 7 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
round
(num, decimales )
null
Función para redondear al número de decimales que se desee Recibe como parametros el número que se desea redondear y el número de decimales que se desea
Función para redondear al número de decimales que se desee Recibe como parametros el número que se desea redondear y el número de decimales que se desea
function round(num, decimales ) { var signo = (num >= 0 ? 1 : -1); num = num * signo; if (decimales === 0) //con 0 decimales return signo * Math.round(num); // round(x * 10 ^ decimales) num = num.toString().split('e'); num = Math.round(+(num[0] + 'e' + (num[1] ? (+num[1] + decimales) : decimales))); // x * 10 ^ (-decimales) num = num.toString().split('e'); return signo * (num[0] + 'e' + (num[1] ? (+num[1] - decimales) : -decimales)); }
[ "function", "round", "(", "num", ",", "decimales", ")", "{", "var", "signo", "=", "(", "num", ">=", "0", "?", "1", ":", "-", "1", ")", ";", "num", "=", "num", "*", "signo", ";", "if", "(", "decimales", "===", "0", ")", "//con 0 decimales", "return", "signo", "*", "Math", ".", "round", "(", "num", ")", ";", "// round(x * 10 ^ decimales)", "num", "=", "num", ".", "toString", "(", ")", ".", "split", "(", "'e'", ")", ";", "num", "=", "Math", ".", "round", "(", "+", "(", "num", "[", "0", "]", "+", "'e'", "+", "(", "num", "[", "1", "]", "?", "(", "+", "num", "[", "1", "]", "+", "decimales", ")", ":", "decimales", ")", ")", ")", ";", "// x * 10 ^ (-decimales)", "num", "=", "num", ".", "toString", "(", ")", ".", "split", "(", "'e'", ")", ";", "return", "signo", "*", "(", "num", "[", "0", "]", "+", "'e'", "+", "(", "num", "[", "1", "]", "?", "(", "+", "num", "[", "1", "]", "-", "decimales", ")", ":", "-", "decimales", ")", ")", ";", "}" ]
[ 137, 0 ]
[ 148, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
alternarMM
()
null
/*Activa o desactiva el modo MM
/*Activa o desactiva el modo MM
function alternarMM(){ if (mmCheck==false) { mmCheck=true; enviarDatos(); document.getElementById("submit").style.backgroundColor="#ffb84d"; document.getElementById("mm_empaquetar").disabled=false; document.getElementById("mm_sellar").disabled=false; modoActivo=true; } else{ mmCheck=false; document.getElementById("submit").style.backgroundColor="#01313a"; document.getElementById("mm_empaquetar").disabled=true; document.getElementById("mm_sellar").disabled=true; modoActivo=false; } var datosx = '\"WEB_1\".BOTON_MM='+mmCheck; $($.ajax({ method:'POST', data:datosx, success:function(){ console.log("funciona, los datos que se han enviado son: "+'\"WEB_1\".BOTON_MM='+mmCheck); }, error:function(){ console.log("errores"); } })) }
[ "function", "alternarMM", "(", ")", "{", "if", "(", "mmCheck", "==", "false", ")", "{", "mmCheck", "=", "true", ";", "enviarDatos", "(", ")", ";", "document", ".", "getElementById", "(", "\"submit\"", ")", ".", "style", ".", "backgroundColor", "=", "\"#ffb84d\"", ";", "document", ".", "getElementById", "(", "\"mm_empaquetar\"", ")", ".", "disabled", "=", "false", ";", "document", ".", "getElementById", "(", "\"mm_sellar\"", ")", ".", "disabled", "=", "false", ";", "modoActivo", "=", "true", ";", "}", "else", "{", "mmCheck", "=", "false", ";", "document", ".", "getElementById", "(", "\"submit\"", ")", ".", "style", ".", "backgroundColor", "=", "\"#01313a\"", ";", "document", ".", "getElementById", "(", "\"mm_empaquetar\"", ")", ".", "disabled", "=", "true", ";", "document", ".", "getElementById", "(", "\"mm_sellar\"", ")", ".", "disabled", "=", "true", ";", "modoActivo", "=", "false", ";", "}", "var", "datosx", "=", "'\\\"WEB_1\\\".BOTON_MM='", "+", "mmCheck", ";", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "datosx", ",", "success", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"funciona, los datos que se han enviado son: \"", "+", "'\\\"WEB_1\\\".BOTON_MM='", "+", "mmCheck", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "}" ]
[ 35, 0 ]
[ 62, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
dibujarCarta
(suit, number)
null
Dibujo la carta, agrego divs y clases
Dibujo la carta, agrego divs y clases
function dibujarCarta(suit, number) { let card = document.createElement("div"); card.classList.add("card"); let suitsup = document.createElement("div"); suitsup.classList.add("suit"); suitsup.innerHTML = suit; let numero = document.createElement("div"); numero.classList.add("number"); if (number == 1) { number = "A"; } if (number == 11) { number = "J"; } if (number == 12) { number = "Q"; } if (number == 13) { number = "K"; } numero.innerHTML = number; let suitinf = document.createElement("div"); suitinf.classList.add("suitinf"); suitinf.innerHTML = suit; if (suit === "♦" || suit === "♥") { suitsup.style.color = "red"; suitinf.style.color = "red"; } //Agrego a elemento card card.appendChild(suitsup); card.appendChild(numero); card.appendChild(suitinf); return card; }
[ "function", "dibujarCarta", "(", "suit", ",", "number", ")", "{", "let", "card", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "card", ".", "classList", ".", "add", "(", "\"card\"", ")", ";", "let", "suitsup", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "suitsup", ".", "classList", ".", "add", "(", "\"suit\"", ")", ";", "suitsup", ".", "innerHTML", "=", "suit", ";", "let", "numero", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "numero", ".", "classList", ".", "add", "(", "\"number\"", ")", ";", "if", "(", "number", "==", "1", ")", "{", "number", "=", "\"A\"", ";", "}", "if", "(", "number", "==", "11", ")", "{", "number", "=", "\"J\"", ";", "}", "if", "(", "number", "==", "12", ")", "{", "number", "=", "\"Q\"", ";", "}", "if", "(", "number", "==", "13", ")", "{", "number", "=", "\"K\"", ";", "}", "numero", ".", "innerHTML", "=", "number", ";", "let", "suitinf", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "suitinf", ".", "classList", ".", "add", "(", "\"suitinf\"", ")", ";", "suitinf", ".", "innerHTML", "=", "suit", ";", "if", "(", "suit", "===", "\"♦\" |", " s", "it =", "= \"", "\") {", "", "", "suitsup", ".", "style", ".", "color", "=", "\"red\"", ";", "suitinf", ".", "style", ".", "color", "=", "\"red\"", ";", "}", "//Agrego a elemento card", "card", ".", "appendChild", "(", "suitsup", ")", ";", "card", ".", "appendChild", "(", "numero", ")", ";", "card", ".", "appendChild", "(", "suitinf", ")", ";", "return", "card", ";", "}" ]
[ 13, 0 ]
[ 52, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
guardad
()
null
funciones de los botones agregar documentos una subcoleccion
funciones de los botones agregar documentos una subcoleccion
function guardad(){ var nombre=document.getElementById('nombre').value; var apellido=document.getElementById('apellido').value; var fecha=document.getElementById('fecha').value; db.collection("users").doc(`${idmayor}`).set({ first: nombre, last: apellido, born: fecha }) .then(() => { console.log("Document written with ID: ",); document.getElementById('nombre').value=''; document.getElementById('apellido').value=''; document.getElementById('fecha').value=''; }) .catch((error) => { console.error("Error adding document: ", error); }); }
[ "function", "guardad", "(", ")", "{", "var", "nombre", "=", "document", ".", "getElementById", "(", "'nombre'", ")", ".", "value", ";", "var", "apellido", "=", "document", ".", "getElementById", "(", "'apellido'", ")", ".", "value", ";", "var", "fecha", "=", "document", ".", "getElementById", "(", "'fecha'", ")", ".", "value", ";", "db", ".", "collection", "(", "\"users\"", ")", ".", "doc", "(", "`", "${", "idmayor", "}", "`", ")", ".", "set", "(", "{", "first", ":", "nombre", ",", "last", ":", "apellido", ",", "born", ":", "fecha", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "console", ".", "log", "(", "\"Document written with ID: \"", ",", ")", ";", "document", ".", "getElementById", "(", "'nombre'", ")", ".", "value", "=", "''", ";", "document", ".", "getElementById", "(", "'apellido'", ")", ".", "value", "=", "''", ";", "document", ".", "getElementById", "(", "'fecha'", ")", ".", "value", "=", "''", ";", "}", ")", ".", "catch", "(", "(", "error", ")", "=>", "{", "console", ".", "error", "(", "\"Error adding document: \"", ",", "error", ")", ";", "}", ")", ";", "}" ]
[ 93, 0 ]
[ 113, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
desplazarMe
(titulo)
null
Desplazamiento
Desplazamiento
function desplazarMe(titulo){ $('html, body').animate({scrollTop: $('#'+titulo).offset().top},2000) }
[ "function", "desplazarMe", "(", "titulo", ")", "{", "$", "(", "'html, body'", ")", ".", "animate", "(", "{", "scrollTop", ":", "$", "(", "'#'", "+", "titulo", ")", ".", "offset", "(", ")", ".", "top", "}", ",", "2000", ")", "}" ]
[ 365, 0 ]
[ 367, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program
segmento
(x, y, a)
null
una función de fabricación propia para dibujar segmentos
una función de fabricación propia para dibujar segmentos
function segmento(x, y, a) { translate(x, y); rotate(a); line(0, 0, largoSegmento, 0); }
[ "function", "segmento", "(", "x", ",", "y", ",", "a", ")", "{", "translate", "(", "x", ",", "y", ")", ";", "rotate", "(", "a", ")", ";", "line", "(", "0", ",", "0", ",", "largoSegmento", ",", "0", ")", ";", "}" ]
[ 43, 0 ]
[ 47, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setTotal
()
null
Función para calcular el total de la compra
Función para calcular el total de la compra
function setTotal(){ if($('#unitcost').val()!=''){ if($('input[name="checkiva"]').prop('checked')){ $('#total').val(round(parseFloat($('#subtotal').val())+parseFloat($('#iva').val()),2)); if($("#total").val().indexOf('.',0)<0){ $("#total").val($("#total").val().concat(".00")); } }else{ $('#total').val(parseFloat($('#subtotal').val())); if($("#total").val().indexOf('.',0)<0){ $("#total").val($("#total").val().concat(".00")); } } } if(parseFloat($('input[name="budget"]').val())-parseFloat($('input[name="reserved"]').val())<parseFloat($('#total').val())){ Swal.fire( 'Rechazado!', 'No hay suficiente presupuesto para está compra.', 'warning' ) } }
[ "function", "setTotal", "(", ")", "{", "if", "(", "$", "(", "'#unitcost'", ")", ".", "val", "(", ")", "!=", "''", ")", "{", "if", "(", "$", "(", "'input[name=\"checkiva\"]'", ")", ".", "prop", "(", "'checked'", ")", ")", "{", "$", "(", "'#total'", ")", ".", "val", "(", "round", "(", "parseFloat", "(", "$", "(", "'#subtotal'", ")", ".", "val", "(", ")", ")", "+", "parseFloat", "(", "$", "(", "'#iva'", ")", ".", "val", "(", ")", ")", ",", "2", ")", ")", ";", "if", "(", "$", "(", "\"#total\"", ")", ".", "val", "(", ")", ".", "indexOf", "(", "'.'", ",", "0", ")", "<", "0", ")", "{", "$", "(", "\"#total\"", ")", ".", "val", "(", "$", "(", "\"#total\"", ")", ".", "val", "(", ")", ".", "concat", "(", "\".00\"", ")", ")", ";", "}", "}", "else", "{", "$", "(", "'#total'", ")", ".", "val", "(", "parseFloat", "(", "$", "(", "'#subtotal'", ")", ".", "val", "(", ")", ")", ")", ";", "if", "(", "$", "(", "\"#total\"", ")", ".", "val", "(", ")", ".", "indexOf", "(", "'.'", ",", "0", ")", "<", "0", ")", "{", "$", "(", "\"#total\"", ")", ".", "val", "(", "$", "(", "\"#total\"", ")", ".", "val", "(", ")", ".", "concat", "(", "\".00\"", ")", ")", ";", "}", "}", "}", "if", "(", "parseFloat", "(", "$", "(", "'input[name=\"budget\"]'", ")", ".", "val", "(", ")", ")", "-", "parseFloat", "(", "$", "(", "'input[name=\"reserved\"]'", ")", ".", "val", "(", ")", ")", "<", "parseFloat", "(", "$", "(", "'#total'", ")", ".", "val", "(", ")", ")", ")", "{", "Swal", ".", "fire", "(", "'Rechazado!'", ",", "'No hay suficiente presupuesto para está compra.',", "", "'warning'", ")", "}", "}" ]
[ 93, 0 ]
[ 115, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Ajax Cargar los datos
Ajax Cargar los datos
function(){ var urlCarga = '/ajax/listar/todo/ficha/' + this.MAP_F_IdFicha; axios.get(urlCarga).then( response => { if(response.data.status == 'ERROR'){ swal({ title: "¡ADVERTENCIA!", text: "Ocurrio un error al detectar la unidad recaudadora que esta utilizando,debe selecionarla nuevamente", type: "warning" }, function() { window.location = response.data.route; }); }else{ this.participaciones = response.data[0]; this.zonas = response.data[1]; this.areas = response.data[2]; this.instituciones = response.data[3]; this.capillas = response.data[4]; this.nuevaParticipacion.MAP_I_INCodigo = response.data[3][0].INCodigo; this.nuevaParticipacion.MAP_Z_IdZona = response.data[1][0].IdZona; this.Defecto_I_INCodigo = response.data[3][0].INCodigo; this.Defecto_Z_IdZona = response.data[1][0].IdZona; } }); }
[ "function", "(", ")", "{", "var", "urlCarga", "=", "'/ajax/listar/todo/ficha/'", "+", "this", ".", "MAP_F_IdFicha", ";", "axios", ".", "get", "(", "urlCarga", ")", ".", "then", "(", "response", "=>", "{", "if", "(", "response", ".", "data", ".", "status", "==", "'ERROR'", ")", "{", "swal", "(", "{", "title", ":", "\"¡ADVERTENCIA!\",", "", "text", ":", "\"Ocurrio un error al detectar la unidad recaudadora que esta utilizando,debe selecionarla nuevamente\"", ",", "type", ":", "\"warning\"", "}", ",", "function", "(", ")", "{", "window", ".", "location", "=", "response", ".", "data", ".", "route", ";", "}", ")", ";", "}", "else", "{", "this", ".", "participaciones", "=", "response", ".", "data", "[", "0", "]", ";", "this", ".", "zonas", "=", "response", ".", "data", "[", "1", "]", ";", "this", ".", "areas", "=", "response", ".", "data", "[", "2", "]", ";", "this", ".", "instituciones", "=", "response", ".", "data", "[", "3", "]", ";", "this", ".", "capillas", "=", "response", ".", "data", "[", "4", "]", ";", "this", ".", "nuevaParticipacion", ".", "MAP_I_INCodigo", "=", "response", ".", "data", "[", "3", "]", "[", "0", "]", ".", "INCodigo", ";", "this", ".", "nuevaParticipacion", ".", "MAP_Z_IdZona", "=", "response", ".", "data", "[", "1", "]", "[", "0", "]", ".", "IdZona", ";", "this", ".", "Defecto_I_INCodigo", "=", "response", ".", "data", "[", "3", "]", "[", "0", "]", ".", "INCodigo", ";", "this", ".", "Defecto_Z_IdZona", "=", "response", ".", "data", "[", "1", "]", "[", "0", "]", ".", "IdZona", ";", "}", "}", ")", ";", "}" ]
[ 69, 20 ]
[ 95, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
makeSurfaceVertexData
(f, scene)
null
------------------------------------------ una mesh completamente custom ------------------------------------------
------------------------------------------ una mesh completamente custom ------------------------------------------
function makeSurfaceVertexData(f, scene) { let nx = 30, nz = 30; let vd = new BABYLON.VertexData(); vd.positions = []; vd.indices = []; for(let iz=0;iz<nz;iz++) { let z = -1+2*iz/(nz-1); for(let ix=0;ix<nx;ix++) { let x = -1+2*ix/(nx-1); y = f(x,z); vd.positions.push(x,y,z); } } for(let iz=0;iz+1<nz;iz++) { for(let ix=0;ix+1<nx;ix++) { let k = iz*nx+ix; vd.indices.push(k,k+1,k+1+nx, k,k+1+nx,k+nx); } } vd.normals = []; BABYLON.VertexData.ComputeNormals( vd.positions, vd.indices, vd.normals); mesh = new BABYLON.Mesh('surface', scene); vd.applyToMesh(mesh); return mesh; }
[ "function", "makeSurfaceVertexData", "(", "f", ",", "scene", ")", "{", "let", "nx", "=", "30", ",", "nz", "=", "30", ";", "let", "vd", "=", "new", "BABYLON", ".", "VertexData", "(", ")", ";", "vd", ".", "positions", "=", "[", "]", ";", "vd", ".", "indices", "=", "[", "]", ";", "for", "(", "let", "iz", "=", "0", ";", "iz", "<", "nz", ";", "iz", "++", ")", "{", "let", "z", "=", "-", "1", "+", "2", "*", "iz", "/", "(", "nz", "-", "1", ")", ";", "for", "(", "let", "ix", "=", "0", ";", "ix", "<", "nx", ";", "ix", "++", ")", "{", "let", "x", "=", "-", "1", "+", "2", "*", "ix", "/", "(", "nx", "-", "1", ")", ";", "y", "=", "f", "(", "x", ",", "z", ")", ";", "vd", ".", "positions", ".", "push", "(", "x", ",", "y", ",", "z", ")", ";", "}", "}", "for", "(", "let", "iz", "=", "0", ";", "iz", "+", "1", "<", "nz", ";", "iz", "++", ")", "{", "for", "(", "let", "ix", "=", "0", ";", "ix", "+", "1", "<", "nx", ";", "ix", "++", ")", "{", "let", "k", "=", "iz", "*", "nx", "+", "ix", ";", "vd", ".", "indices", ".", "push", "(", "k", ",", "k", "+", "1", ",", "k", "+", "1", "+", "nx", ",", "k", ",", "k", "+", "1", "+", "nx", ",", "k", "+", "nx", ")", ";", "}", "}", "vd", ".", "normals", "=", "[", "]", ";", "BABYLON", ".", "VertexData", ".", "ComputeNormals", "(", "vd", ".", "positions", ",", "vd", ".", "indices", ",", "vd", ".", "normals", ")", ";", "mesh", "=", "new", "BABYLON", ".", "Mesh", "(", "'surface'", ",", "scene", ")", ";", "vd", ".", "applyToMesh", "(", "mesh", ")", ";", "return", "mesh", ";", "}" ]
[ 222, 4 ]
[ 249, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
calcularPerimetroCuadrado
()
null
Aqui interactuamos con el HTML
Aqui interactuamos con el HTML
function calcularPerimetroCuadrado() { // Lectura de todo el elemento HTML const input = document.getElementById("InputCuadrado"); // Obtenemos solo el valor de la etiqueta 'input' const value = input.value; // Calculo del perímetro del cuadrado const perimetro = perimetroCuadrado(value); alert(perimetro); }
[ "function", "calcularPerimetroCuadrado", "(", ")", "{", "// Lectura de todo el elemento HTML", "const", "input", "=", "document", ".", "getElementById", "(", "\"InputCuadrado\"", ")", ";", "// Obtenemos solo el valor de la etiqueta 'input'", "const", "value", "=", "input", ".", "value", ";", "// Calculo del perímetro del cuadrado", "const", "perimetro", "=", "perimetroCuadrado", "(", "value", ")", ";", "alert", "(", "perimetro", ")", ";", "}" ]
[ 93, 0 ]
[ 101, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
comprobarC6
()
null
palabra Cansancio color cafe
palabra Cansancio color cafe
function comprobarC6(){ c6 = document.getElementById('celdaC6').style.color="brown"; }
[ "function", "comprobarC6", "(", ")", "{", "c6", "=", "document", ".", "getElementById", "(", "'celdaC6'", ")", ".", "style", ".", "color", "=", "\"brown\"", ";", "}" ]
[ 49, 0 ]
[ 51, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
reverse
(str)
null
Si una palabra es palindromo, se intercalan las letras de esa palabra entre mayusculas y minusculas.
Si una palabra es palindromo, se intercalan las letras de esa palabra entre mayusculas y minusculas.
function reverse(str) { return str.split('').reverse().join(''); }
[ "function", "reverse", "(", "str", ")", "{", "return", "str", ".", "split", "(", "''", ")", ".", "reverse", "(", ")", ".", "join", "(", "''", ")", ";", "}" ]
[ 25, 15 ]
[ 27, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
(xhr, settings)
null
Permite la busqueda autorixando el CSRFToken
Permite la busqueda autorixando el CSRFToken
function(xhr, settings) { console.log(getCookie('csrftoken')); if(settings.type == "POST") { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); } }
[ "function", "(", "xhr", ",", "settings", ")", "{", "console", ".", "log", "(", "getCookie", "(", "'csrftoken'", ")", ")", ";", "if", "(", "settings", ".", "type", "==", "\"POST\"", ")", "{", "xhr", ".", "setRequestHeader", "(", "\"X-CSRFToken\"", ",", "getCookie", "(", "'csrftoken'", ")", ")", ";", "}", "}" ]
[ 69, 36 ]
[ 75, 25 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
(indexItem, indexItem2)
null
lo deshabilitamos en el juego
lo deshabilitamos en el juego
function (indexItem, indexItem2) { return false }
[ "function", "(", "indexItem", ",", "indexItem2", ")", "{", "return", "false", "}" ]
[ 562, 11 ]
[ 564, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
operar
(valor)
null
Esta función realiza las distintas operaciones aritméticas en función del botón pulsado
Esta función realiza las distintas operaciones aritméticas en función del botón pulsado
function operar(valor){ if (num1 == 0){ num1 = parseFloat(document.getElementById("valor_numero").value); } num2 = parseFloat(num1); num1= 0; opera = valor; }
[ "function", "operar", "(", "valor", ")", "{", "if", "(", "num1", "==", "0", ")", "{", "num1", "=", "parseFloat", "(", "document", ".", "getElementById", "(", "\"valor_numero\"", ")", ".", "value", ")", ";", "}", "num2", "=", "parseFloat", "(", "num1", ")", ";", "num1", "=", "0", ";", "opera", "=", "valor", ";", "}" ]
[ 34, 8 ]
[ 41, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mousePressed
()
null
cuando el usuario hace click
cuando el usuario hace click
function mousePressed() { // revisar si el ratón está dentro del círculo let d = dist(mouseX, mouseY, 360, 200); if (d < 100) { // escoger nuevos colores aleatorios r = random(255); g = random(255); b = random(255); } }
[ "function", "mousePressed", "(", ")", "{", "// revisar si el ratón está dentro del círculo", "let", "d", "=", "dist", "(", "mouseX", ",", "mouseY", ",", "360", ",", "200", ")", ";", "if", "(", "d", "<", "100", ")", "{", "// escoger nuevos colores aleatorios", "r", "=", "random", "(", "255", ")", ";", "g", "=", "random", "(", "255", ")", ";", "b", "=", "random", "(", "255", ")", ";", "}", "}" ]
[ 27, 0 ]
[ 36, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
seccionActivo
(id)
null
/*funcion que cambia de colores los botones del menú
/*funcion que cambia de colores los botones del menú
function seccionActivo(id){ var activo = id; if (activo === "seccion_0") { $("#seccion_c").removeClass("submenuActivo"); $("#seccion_p").removeClass("submenuActivo"); $("#seccion_n").removeClass("submenuActivo"); $("#seccion_b").removeClass("submenuActivo"); $("#seccion_s").removeClass("submenuActivo"); }else if (activo === "seccion_n") { $("#seccion_n").addClass("submenuActivo"); $("#seccion_p").removeClass("submenuActivo"); $("#seccion_s").removeClass("submenuActivo"); $("#seccion_b").removeClass("submenuActivo"); $("#seccion_c").removeClass("submenuActivo"); } else if (activo === "seccion_p") { $("#seccion_p").addClass("submenuActivo"); $("#seccion_n").removeClass("submenuActivo"); $("#seccion_s").removeClass("submenuActivo"); $("#seccion_b").removeClass("submenuActivo"); $("#seccion_c").removeClass("submenuActivo"); } else if (activo === "seccion_s") { $("#seccion_s").addClass("submenuActivo"); $("#seccion_n").removeClass("submenuActivo"); $("#seccion_p").removeClass("submenuActivo"); $("#seccion_b").removeClass("submenuActivo"); $("#seccion_c").removeClass("submenuActivo"); } else if (activo === "seccion_b") { $("#seccion_b").addClass("submenuActivo"); $("#seccion_n").removeClass("submenuActivo"); $("#seccion_s").removeClass("submenuActivo"); $("#seccion_p").removeClass("submenuActivo"); $("#seccion_c").removeClass("submenuActivo"); } else{ $("#seccion_c").addClass("submenuActivo"); $("#seccion_n").removeClass("submenuActivo"); $("#seccion_s").removeClass("submenuActivo"); $("#seccion_b").removeClass("submenuActivo"); $("#seccion_p").removeClass("submenuActivo"); } }
[ "function", "seccionActivo", "(", "id", ")", "{", "var", "activo", "=", "id", ";", "if", "(", "activo", "===", "\"seccion_0\"", ")", "{", "$", "(", "\"#seccion_c\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_p\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_n\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_b\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_s\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "else", "if", "(", "activo", "===", "\"seccion_n\"", ")", "{", "$", "(", "\"#seccion_n\"", ")", ".", "addClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_p\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_s\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_b\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_c\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "else", "if", "(", "activo", "===", "\"seccion_p\"", ")", "{", "$", "(", "\"#seccion_p\"", ")", ".", "addClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_n\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_s\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_b\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_c\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "else", "if", "(", "activo", "===", "\"seccion_s\"", ")", "{", "$", "(", "\"#seccion_s\"", ")", ".", "addClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_n\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_p\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_b\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_c\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "else", "if", "(", "activo", "===", "\"seccion_b\"", ")", "{", "$", "(", "\"#seccion_b\"", ")", ".", "addClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_n\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_s\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_p\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_c\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "else", "{", "$", "(", "\"#seccion_c\"", ")", ".", "addClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_n\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_s\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_b\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "$", "(", "\"#seccion_p\"", ")", ".", "removeClass", "(", "\"submenuActivo\"", ")", ";", "}", "}" ]
[ 87, 0 ]
[ 127, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
pintarDatos
(data)
null
Hago una función aparte para la lógica de pintar los datos
Hago una función aparte para la lógica de pintar los datos
function pintarDatos(data) { const allItems = [] // voy a iterar cada elemento del arreglo que llega como parametro for(let i of data){ // Creando imágen y su contenido const img = document.createElement("img") img.src = `${baseUrl}${i.image}` img.className = "h-16 w-16 md:h-24 md:w-24 rounded-full mx-auto md:mx-0 md:mr-6" // Creando titulo y su contenido const title = document.createElement("h2") title.textContent = i.name title.className = 'text-lg' // Creando precio y su contenido const price = document.createElement("p") price.textContent = formatPrice(i.price) price.className = 'text-gray-600' //Wrap price & title const priceAndTitle = document.createElement('div') priceAndTitle.className = 'text-center md:text-left' priceAndTitle.append(title, price) // Contenedor separador de cada card const card = document.createElement("div") card.className = "md:flex bg-white rounded-lg p-6 hover:bg-gray-300 widt50" card.append(img, priceAndTitle) allItems.push(card) } nodeApp.append(...allItems) }
[ "function", "pintarDatos", "(", "data", ")", "{", "const", "allItems", "=", "[", "]", "// voy a iterar cada elemento del arreglo que llega como parametro", "for", "(", "let", "i", "of", "data", ")", "{", "// Creando imágen y su contenido", "const", "img", "=", "document", ".", "createElement", "(", "\"img\"", ")", "img", ".", "src", "=", "`", "${", "baseUrl", "}", "${", "i", ".", "image", "}", "`", "img", ".", "className", "=", "\"h-16 w-16 md:h-24 md:w-24 rounded-full mx-auto md:mx-0 md:mr-6\"", "// Creando titulo y su contenido", "const", "title", "=", "document", ".", "createElement", "(", "\"h2\"", ")", "title", ".", "textContent", "=", "i", ".", "name", "title", ".", "className", "=", "'text-lg'", "// Creando precio y su contenido", "const", "price", "=", "document", ".", "createElement", "(", "\"p\"", ")", "price", ".", "textContent", "=", "formatPrice", "(", "i", ".", "price", ")", "price", ".", "className", "=", "'text-gray-600'", "//Wrap price & title", "const", "priceAndTitle", "=", "document", ".", "createElement", "(", "'div'", ")", "priceAndTitle", ".", "className", "=", "'text-center md:text-left'", "priceAndTitle", ".", "append", "(", "title", ",", "price", ")", "// Contenedor separador de cada card", "const", "card", "=", "document", ".", "createElement", "(", "\"div\"", ")", "card", ".", "className", "=", "\"md:flex bg-white rounded-lg p-6 hover:bg-gray-300 widt50\"", "card", ".", "append", "(", "img", ",", "priceAndTitle", ")", "allItems", ".", "push", "(", "card", ")", "}", "nodeApp", ".", "append", "(", "...", "allItems", ")", "}" ]
[ 86, 0 ]
[ 119, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getRandomAnimal
()
null
Creamos un animal de tipo aleatorio
Creamos un animal de tipo aleatorio
function getRandomAnimal() { if (Math.round(Math.random())) { return new Fox(); } else { return new Chicken(); } }
[ "function", "getRandomAnimal", "(", ")", "{", "if", "(", "Math", ".", "round", "(", "Math", ".", "random", "(", ")", ")", ")", "{", "return", "new", "Fox", "(", ")", ";", "}", "else", "{", "return", "new", "Chicken", "(", ")", ";", "}", "}" ]
[ 90, 0 ]
[ 96, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(idmesa)
null
Funcion para obtener detalle de cuentas por mesa
Funcion para obtener detalle de cuentas por mesa
function(idmesa){ $('#contenido').html(''); $.ajax({ url : 'cuenta/mesa/'+idmesa, dataType: 'json', success : function(response) { var cuenta = JSON.parse(response.cuenta); var detalle = JSON.parse(response.detalle); var cliente = ""; var usuario = ""; var html = ""; var prod = ""; var idcta = 0; var cant = 0; var prec = 0; var monto = 0; var total = 0; if(cuenta.length > 0) { for(c in cuenta) { total = 0; idcta = cuenta[c].id; mesa = cuenta[c].mesa.nombre.replace(/[""]+/g,''); cliente = cuenta[c].cliente.nombre.replace(/[""]+/g,''); usuario = cuenta[c].usuario.nombre.replace(/[""]+/g,''); html = '<details open>'; html += '<summary class="btn-primary">'; html += mesa + ' - '; html += 'Cuenta: #'; html += idcta + ' - '; html += cliente; html += ' (' + usuario +')'; html += '</summary>'; html += '<table class="table">'; for(d in detalle){ if (detalle[d].cuenta.id==idcta){ prod = detalle[d].producto.nombre.replace(/[""]+/g,''); cant = detalle[d].cantidad;//.toFixed(2); cant = detalle[d].cantidad.toFixed(2); monto = detalle[d].precio*cant;//* (60/100); monto = formatearMonto(monto); prec = formatearMonto(detalle[d].precio,2); html += '<tr>'; html += '<td>'+prod; if (detalle[d].producto.tipoProducto=='Tiempo') html += '<td>'+convertToTime(cant); else html += '<td>'+cant; html += '<td>'+prec; if (detalle[d].tipoPrecio=='P') html += ' * '; html += '<td align="right">'+monto; total = total +(detalle[d].precio*cant);// * (60/100); } }//end for detalle total = formatearMonto(total,2); html += '<tr>'; html += '<td><b>Total</b>'; html += '<td>'; html += '<td>'; html += '<td align="right">'+ total; html += '</tr>'; html += '</tr>'; html += '</table>'; html += buttonsCuentas(idcta,idmesa); html += '</details>'; $('#contenido').append(html); }//end for cuentas }else{//end if html += '<h4>'; html += '<div class="alert alert-info">'; html += 'Esta mesa no posee cuentas activas. Haga click para abrir una nueva Cuenta.'; html += '</div>'; html += '</h4>'; html += buttonsCuentas(0,idmesa); $('#contenido').append(html); }//end else if },//end success });//end ajax }
[ "function", "(", "idmesa", ")", "{", "$", "(", "'#contenido'", ")", ".", "html", "(", "''", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "'cuenta/mesa/'", "+", "idmesa", ",", "dataType", ":", "'json'", ",", "success", ":", "function", "(", "response", ")", "{", "var", "cuenta", "=", "JSON", ".", "parse", "(", "response", ".", "cuenta", ")", ";", "var", "detalle", "=", "JSON", ".", "parse", "(", "response", ".", "detalle", ")", ";", "var", "cliente", "=", "\"\"", ";", "var", "usuario", "=", "\"\"", ";", "var", "html", "=", "\"\"", ";", "var", "prod", "=", "\"\"", ";", "var", "idcta", "=", "0", ";", "var", "cant", "=", "0", ";", "var", "prec", "=", "0", ";", "var", "monto", "=", "0", ";", "var", "total", "=", "0", ";", "if", "(", "cuenta", ".", "length", ">", "0", ")", "{", "for", "(", "c", "in", "cuenta", ")", "{", "total", "=", "0", ";", "idcta", "=", "cuenta", "[", "c", "]", ".", "id", ";", "mesa", "=", "cuenta", "[", "c", "]", ".", "mesa", ".", "nombre", ".", "replace", "(", "/", "[\"\"]+", "/", "g", ",", "''", ")", ";", "cliente", "=", "cuenta", "[", "c", "]", ".", "cliente", ".", "nombre", ".", "replace", "(", "/", "[\"\"]+", "/", "g", ",", "''", ")", ";", "usuario", "=", "cuenta", "[", "c", "]", ".", "usuario", ".", "nombre", ".", "replace", "(", "/", "[\"\"]+", "/", "g", ",", "''", ")", ";", "html", "=", "'<details open>'", ";", "html", "+=", "'<summary class=\"btn-primary\">'", ";", "html", "+=", "mesa", "+", "' - '", ";", "html", "+=", "'Cuenta: #'", ";", "html", "+=", "idcta", "+", "' - '", ";", "html", "+=", "cliente", ";", "html", "+=", "' ('", "+", "usuario", "+", "')'", ";", "html", "+=", "'</summary>'", ";", "html", "+=", "'<table class=\"table\">'", ";", "for", "(", "d", "in", "detalle", ")", "{", "if", "(", "detalle", "[", "d", "]", ".", "cuenta", ".", "id", "==", "idcta", ")", "{", "prod", "=", "detalle", "[", "d", "]", ".", "producto", ".", "nombre", ".", "replace", "(", "/", "[\"\"]+", "/", "g", ",", "''", ")", ";", "cant", "=", "detalle", "[", "d", "]", ".", "cantidad", ";", "//.toFixed(2); ", "cant", "=", "detalle", "[", "d", "]", ".", "cantidad", ".", "toFixed", "(", "2", ")", ";", "monto", "=", "detalle", "[", "d", "]", ".", "precio", "*", "cant", ";", "//* (60/100); ", "monto", "=", "formatearMonto", "(", "monto", ")", ";", "prec", "=", "formatearMonto", "(", "detalle", "[", "d", "]", ".", "precio", ",", "2", ")", ";", "html", "+=", "'<tr>'", ";", "html", "+=", "'<td>'", "+", "prod", ";", "if", "(", "detalle", "[", "d", "]", ".", "producto", ".", "tipoProducto", "==", "'Tiempo'", ")", "html", "+=", "'<td>'", "+", "convertToTime", "(", "cant", ")", ";", "else", "html", "+=", "'<td>'", "+", "cant", ";", "html", "+=", "'<td>'", "+", "prec", ";", "if", "(", "detalle", "[", "d", "]", ".", "tipoPrecio", "==", "'P'", ")", "html", "+=", "' * '", ";", "html", "+=", "'<td align=\"right\">'", "+", "monto", ";", "total", "=", "total", "+", "(", "detalle", "[", "d", "]", ".", "precio", "*", "cant", ")", ";", "// * (60/100);", "}", "}", "//end for detalle", "total", "=", "formatearMonto", "(", "total", ",", "2", ")", ";", "html", "+=", "'<tr>'", ";", "html", "+=", "'<td><b>Total</b>'", ";", "html", "+=", "'<td>'", ";", "html", "+=", "'<td>'", ";", "html", "+=", "'<td align=\"right\">'", "+", "total", ";", "html", "+=", "'</tr>'", ";", "html", "+=", "'</tr>'", ";", "html", "+=", "'</table>'", ";", "html", "+=", "buttonsCuentas", "(", "idcta", ",", "idmesa", ")", ";", "html", "+=", "'</details>'", ";", "$", "(", "'#contenido'", ")", ".", "append", "(", "html", ")", ";", "}", "//end for cuentas", "}", "else", "{", "//end if ", "html", "+=", "'<h4>'", ";", "html", "+=", "'<div class=\"alert alert-info\">'", ";", "html", "+=", "'Esta mesa no posee cuentas activas. Haga click para abrir una nueva Cuenta.'", ";", "html", "+=", "'</div>'", ";", "html", "+=", "'</h4>'", ";", "html", "+=", "buttonsCuentas", "(", "0", ",", "idmesa", ")", ";", "$", "(", "'#contenido'", ")", ".", "append", "(", "html", ")", ";", "}", "//end else if ", "}", ",", "//end success", "}", ")", ";", "//end ajax", "}" ]
[ 28, 15 ]
[ 108, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
perimetroTrianguloConF
(lado_A, lado_B, lado_C)
null
Codigo del Triangulo - con valores dinamicos a travez de una funsion
Codigo del Triangulo - con valores dinamicos a travez de una funsion
function perimetroTrianguloConF (lado_A, lado_B, lado_C) { return `El perimetro de este triangulo es igual a ${lado_A + lado_B + lado_C} cm`; }
[ "function", "perimetroTrianguloConF", "(", "lado_A", ",", "lado_B", ",", "lado_C", ")", "{", "return", "`", "${", "lado_A", "+", "lado_B", "+", "lado_C", "}", "`", ";", "}" ]
[ 64, 8 ]
[ 66, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
buscaRoles
(ids)
null
Recupera el html de los roles en base a sus id @param {string[]} ids
Recupera el html de los roles en base a sus id
async function buscaRoles(ids) { let html = ""; if (ids && ids.length > 0) { for (const id of ids) { const doc = await daoRol. doc(id). get(); /** * @type { import("./tipos.js").Rol} */ const data = doc.data(); html += /* html */ `<em>${cod(doc.id)}</em> <br> ${cod(data.descripción)} <br>`; } return html; } else { return "-- Sin Roles --"; } }
[ "async", "function", "buscaRoles", "(", "ids", ")", "{", "let", "html", "=", "\"\"", ";", "if", "(", "ids", "&&", "ids", ".", "length", ">", "0", ")", "{", "for", "(", "const", "id", "of", "ids", ")", "{", "const", "doc", "=", "await", "daoRol", ".", "doc", "(", "id", ")", ".", "get", "(", ")", ";", "/**\n * @type {\n import(\"./tipos.js\").Rol} */", "const", "data", "=", "doc", ".", "data", "(", ")", ";", "html", "+=", "/* html */", "`", "${", "cod", "(", "doc", ".", "id", ")", "}", "${", "cod", "(", "data", ".", "descripción)", "}", "", "`", ";", "}", "return", "html", ";", "}", "else", "{", "return", "\"-- Sin Roles --\"", ";", "}", "}" ]
[ 142, 0 ]
[ 163, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
search_position
(position,device)
null
Devuelve si un pelotero ya fue seleccionado
Devuelve si un pelotero ya fue seleccionado
function search_position(position,device){ var select_position; var result = 0; //select_position_D = position+'ADD'; select_position_D = 'player'+position+' #salario'; select_position_M = 'player'+position+'M .divsala'; //alert($('#playerPAM .litableup .litabblock').html()); if(device=='D'){ // Version Desktop //alert('desktop'); if(position == 'PA'){ // Selecciona Pitcher if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el pitcher antes de seleccionar otro !!'); return result; } } if(position == 'C'){ // Selecciona Catcher if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el Catcher antes de seleccionar otro !!'); return result; } } if(position == '1B'){ // Selecciona Primera Base if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 1B antes de seleccionar otro !!'); return result; } } if(position == '2B'){ // Selecciona Segunda Base if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 2B antes de seleccionar otro !!'); return result; } } if(position == '3B'){ // Selecciona Tercera Base if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 3B antes de seleccionar otro !!'); return result; } } if(position == 'SS'){ // Selecciona shortstop if(!$('#'+select_position_D).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 3B antes de seleccionar otro !!'); return result; } } if(position == 'OF'){ // Selecciona shortstop if((!$('#playerOF1 #salario').is(':empty')) && (!$('#playerOF2 #salario').is(':empty')) && (!$('#playerOF3 #salario').is(':empty'))){ result = 1; $('#aprove').val('1'); alert('Debe eliminar algun OF antes de seleccionar otro !!'); return result; } } }else if(device=='M'){ // Version Movil if(position == 'PA'){ // Selecciona Pitcher if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el pitcher antes de seleccionar otro !!'); return result; } } if(position == 'C'){ // Selecciona Catcher if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el Catcher antes de seleccionar otro !!'); return result; } } if(position == '1B'){ // Selecciona Primera Base if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 1B antes de seleccionar otro !!'); return result; } } if(position == '2B'){ // Selecciona Segunda Base if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 2B antes de seleccionar otro !!'); return result; } } if(position == '3B'){ // Selecciona Tercera Base if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 3B antes de seleccionar otro !!'); return result; } } if(position == 'SS'){ // Selecciona shortstop if(!$('#'+select_position_M).is(':empty')){ result = 1; $('#aprove').val('1'); alert('Debe eliminar el 3B antes de seleccionar otro !!'); return result; } } if(position == 'OF'){ // Selecciona shortstop //alert($('#playerOF1M #salario').is(':empty')); if((!$('#playerOF1M .divsala').is(':empty')) && (!$('#playerOF2M .divsala').is(':empty')) && (!$('#playerOF3M .divsala').is(':empty'))){ result = 1; $('#aprove').val('1'); alert('Debe eliminar algun OF antes de seleccionar otro !!'); return result; } } } return result; }
[ "function", "search_position", "(", "position", ",", "device", ")", "{", "var", "select_position", ";", "var", "result", "=", "0", ";", "//select_position_D = position+'ADD';", "select_position_D", "=", "'player'", "+", "position", "+", "' #salario'", ";", "select_position_M", "=", "'player'", "+", "position", "+", "'M .divsala'", ";", "//alert($('#playerPAM .litableup .litabblock').html());", "if", "(", "device", "==", "'D'", ")", "{", "// Version Desktop", "//alert('desktop');", "if", "(", "position", "==", "'PA'", ")", "{", "// Selecciona Pitcher", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el pitcher antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'C'", ")", "{", "// Selecciona Catcher", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el Catcher antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'1B'", ")", "{", "// Selecciona Primera Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 1B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'2B'", ")", "{", "// Selecciona Segunda Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 2B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'3B'", ")", "{", "// Selecciona Tercera Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 3B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'SS'", ")", "{", "// Selecciona shortstop", "if", "(", "!", "$", "(", "'#'", "+", "select_position_D", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 3B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'OF'", ")", "{", "// Selecciona shortstop", "if", "(", "(", "!", "$", "(", "'#playerOF1 #salario'", ")", ".", "is", "(", "':empty'", ")", ")", "&&", "(", "!", "$", "(", "'#playerOF2 #salario'", ")", ".", "is", "(", "':empty'", ")", ")", "&&", "(", "!", "$", "(", "'#playerOF3 #salario'", ")", ".", "is", "(", "':empty'", ")", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar algun OF antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "}", "else", "if", "(", "device", "==", "'M'", ")", "{", "// Version Movil", "if", "(", "position", "==", "'PA'", ")", "{", "// Selecciona Pitcher", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el pitcher antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'C'", ")", "{", "// Selecciona Catcher", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el Catcher antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'1B'", ")", "{", "// Selecciona Primera Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 1B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'2B'", ")", "{", "// Selecciona Segunda Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 2B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'3B'", ")", "{", "// Selecciona Tercera Base", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 3B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'SS'", ")", "{", "// Selecciona shortstop", "if", "(", "!", "$", "(", "'#'", "+", "select_position_M", ")", ".", "is", "(", "':empty'", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar el 3B antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "if", "(", "position", "==", "'OF'", ")", "{", "// Selecciona shortstop", "//alert($('#playerOF1M #salario').is(':empty'));", "if", "(", "(", "!", "$", "(", "'#playerOF1M .divsala'", ")", ".", "is", "(", "':empty'", ")", ")", "&&", "(", "!", "$", "(", "'#playerOF2M .divsala'", ")", ".", "is", "(", "':empty'", ")", ")", "&&", "(", "!", "$", "(", "'#playerOF3M .divsala'", ")", ".", "is", "(", "':empty'", ")", ")", ")", "{", "result", "=", "1", ";", "$", "(", "'#aprove'", ")", ".", "val", "(", "'1'", ")", ";", "alert", "(", "'Debe eliminar algun OF antes de seleccionar otro !!'", ")", ";", "return", "result", ";", "}", "}", "}", "return", "result", ";", "}" ]
[ 834, 0 ]
[ 981, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
ERROR
enviarSennalxx
(nomVar,val)
null
/*Esta funcion envia los datos de las variables al pulsar los botones empaquetar y sellar
/*Esta funcion envia los datos de las variables al pulsar los botones empaquetar y sellar
function enviarSennalxx(nomVar,val){ var datos = '\"WEB_1\".'+nomVar+"="+val; /*Enviar la señal inicial*/ $($.ajax({ method:'POST', data:datos, success:function(datos){ console.log("funciona, el dato que se ha enviado es "+'\"WEB_1\".'+nomVar+"="+val); }, error: function(){ console.log("errores"); } })) /*Devolver false para hacer efecto de On/Off*/ var altern = '\"WEB_1\".'+nomVar+"="+!val; setTimeout(function(){ $($.ajax({ method:'POST', data:altern, success:function(altern){ console.log("funciona, el valor enviado es "+'\"WEB_1\".'+nomVar+"="+!val); }, error: function(){ console.log("errores"); } })) },1000); }
[ "function", "enviarSennalxx", "(", "nomVar", ",", "val", ")", "{", "var", "datos", "=", "'\\\"WEB_1\\\".'", "+", "nomVar", "+", "\"=\"", "+", "val", ";", "/*Enviar la señal inicial*/", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "datos", ",", "success", ":", "function", "(", "datos", ")", "{", "console", ".", "log", "(", "\"funciona, el dato que se ha enviado es \"", "+", "'\\\"WEB_1\\\".'", "+", "nomVar", "+", "\"=\"", "+", "val", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "/*Devolver false para hacer efecto de On/Off*/", "var", "altern", "=", "'\\\"WEB_1\\\".'", "+", "nomVar", "+", "\"=\"", "+", "!", "val", ";", "setTimeout", "(", "function", "(", ")", "{", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "altern", ",", "success", ":", "function", "(", "altern", ")", "{", "console", ".", "log", "(", "\"funciona, el valor enviado es \"", "+", "'\\\"WEB_1\\\".'", "+", "nomVar", "+", "\"=\"", "+", "!", "val", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "}", ",", "1000", ")", ";", "}" ]
[ 64, 0 ]
[ 92, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
cargarArrayGlobal
(listadoArticulos)
null
Creo el JSON y lo guardo en arreglo global.
Creo el JSON y lo guardo en arreglo global.
function cargarArrayGlobal(listadoArticulos) { for (let i = 0; i < listadoArticulos.length; i++) { let articulo = { "href": `http://localhost:3000/html/detalle_producto.html?categoria=${categoriaIdAString(listadoArticulos[i].idCategoria)}&index=${listadoArticulos[i].idArticulo}`, "nombre": cortarNombre(listadoArticulos[i].nombre), "precio": listadoArticulos[i].precio, "financiacion": listadoArticulos[i].financiacion, "detalle": listadoArticulos[i].detalle, "tipo": listadoArticulos[i].tipo, "stock": listadoArticulos[i].stock, "imagenes": listadoArticulos[i].imagen_articulo } arrArticulos.push(articulo); } }
[ "function", "cargarArrayGlobal", "(", "listadoArticulos", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "listadoArticulos", ".", "length", ";", "i", "++", ")", "{", "let", "articulo", "=", "{", "\"href\"", ":", "`", "${", "categoriaIdAString", "(", "listadoArticulos", "[", "i", "]", ".", "idCategoria", ")", "}", "${", "listadoArticulos", "[", "i", "]", ".", "idArticulo", "}", "`", ",", "\"nombre\"", ":", "cortarNombre", "(", "listadoArticulos", "[", "i", "]", ".", "nombre", ")", ",", "\"precio\"", ":", "listadoArticulos", "[", "i", "]", ".", "precio", ",", "\"financiacion\"", ":", "listadoArticulos", "[", "i", "]", ".", "financiacion", ",", "\"detalle\"", ":", "listadoArticulos", "[", "i", "]", ".", "detalle", ",", "\"tipo\"", ":", "listadoArticulos", "[", "i", "]", ".", "tipo", ",", "\"stock\"", ":", "listadoArticulos", "[", "i", "]", ".", "stock", ",", "\"imagenes\"", ":", "listadoArticulos", "[", "i", "]", ".", "imagen_articulo", "}", "arrArticulos", ".", "push", "(", "articulo", ")", ";", "}", "}" ]
[ 22, 0 ]
[ 37, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
notiConfig
(obj)
null
Obtener ajustes de notificaciones /*$.ajax({ type: "POST", url: core.SYS_URL + "sys/inic/inic-slid/settings-notificacion/", data: { axn: 'noti_settings' }, cache: false, global: false, success: function (result) { if (!result.data) { return; } for (var i = 0; i < result.data.length; i++) { var object = result.data[i]; $('.noti_settings').append('<li class="list-group-item"> <div class="pull-right margin-top-5">' + '<input type="checkbox" onchange="notiConfig(this);" class="js-switch-small" id="' + object['skTipoNotificacion'] + '" data-plugin="switchery" data-size="small" ' + object['val'] + '/>' + '</div><h5>' + object['sNombre'] + '</h5> <p>' + object['sDescripcion'] + '</h5></li>'); var mySwitch = new Switchery($('#' + object['skTipoNotificacion'])[0], { size: "small", color: '#0D74E9' }); } }, error: function (error) { console.log(error); } });
Obtener ajustes de notificaciones /*$.ajax({ type: "POST", url: core.SYS_URL + "sys/inic/inic-slid/settings-notificacion/", data: { axn: 'noti_settings' }, cache: false, global: false, success: function (result) {
function notiConfig(obj) { var estatus = $('#' + obj.id).prop('checked'); var id = obj.id; $.ajax({ type: "POST", url: core.SYS_URL + "sys/inic/inic-slid/settings-notificacion/", data: { axn: 'notiConfig', id: id, estatus: estatus }, cache: false, global: false, success: function (result) { $.each( result.res, function( key, channel ) { if (estatus){ pusher.subscribe(channel); }else { pusher.unsubscribe(channel); } }); if (!result) { toastr.error('Ha Ocurrido Un Error'); if (estatus) { $('#' + obj.id).prop('checked', false); } else { $('#' + obj.id).prop('checked', true); } } }, error: function (error) { toastr.error('Ha Ocurrido Un Error'); if (estatus) { $('#' + obj.id).prop('checked', false); } else { $('#' + obj.id).prop('checked', true); } } }); }
[ "function", "notiConfig", "(", "obj", ")", "{", "var", "estatus", "=", "$", "(", "'#'", "+", "obj", ".", "id", ")", ".", "prop", "(", "'checked'", ")", ";", "var", "id", "=", "obj", ".", "id", ";", "$", ".", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "core", ".", "SYS_URL", "+", "\"sys/inic/inic-slid/settings-notificacion/\"", ",", "data", ":", "{", "axn", ":", "'notiConfig'", ",", "id", ":", "id", ",", "estatus", ":", "estatus", "}", ",", "cache", ":", "false", ",", "global", ":", "false", ",", "success", ":", "function", "(", "result", ")", "{", "$", ".", "each", "(", "result", ".", "res", ",", "function", "(", "key", ",", "channel", ")", "{", "if", "(", "estatus", ")", "{", "pusher", ".", "subscribe", "(", "channel", ")", ";", "}", "else", "{", "pusher", ".", "unsubscribe", "(", "channel", ")", ";", "}", "}", ")", ";", "if", "(", "!", "result", ")", "{", "toastr", ".", "error", "(", "'Ha Ocurrido Un Error'", ")", ";", "if", "(", "estatus", ")", "{", "$", "(", "'#'", "+", "obj", ".", "id", ")", ".", "prop", "(", "'checked'", ",", "false", ")", ";", "}", "else", "{", "$", "(", "'#'", "+", "obj", ".", "id", ")", ".", "prop", "(", "'checked'", ",", "true", ")", ";", "}", "}", "}", ",", "error", ":", "function", "(", "error", ")", "{", "toastr", ".", "error", "(", "'Ha Ocurrido Un Error'", ")", ";", "if", "(", "estatus", ")", "{", "$", "(", "'#'", "+", "obj", ".", "id", ")", ".", "prop", "(", "'checked'", ",", "false", ")", ";", "}", "else", "{", "$", "(", "'#'", "+", "obj", ".", "id", ")", ".", "prop", "(", "'checked'", ",", "true", ")", ";", "}", "}", "}", ")", ";", "}" ]
[ 280, 0 ]
[ 322, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
showMenuContent
(size)
null
/* muestra el contenido del menú
/* muestra el contenido del menú
function showMenuContent(size) { // console.log(size); var htmlMenu = ''; var htmlSubMenu = ''; switch(size) { case 'pp': // console.log('pantalla pequeña'); $("#menu-webpage").removeClass('text-center'); $("#menu-webpage").addClass('text-right'); htmlMenu += '<div class="col-xs-2 col-xs-offset-10 no-padding item-menu-webpage-icono text-center" style="height: 9vh; padding-top: 2vh !important;" onclick="mostrarOcultarSubmenu(\'submenu-webpage\')"><label class="col-xs-12 no-padding glyphicon glyphicon-menu-hamburger"></label></div>'; htmlSubMenu += '<a class="col-xs-12 no-padding item-submenu" href="/config">Configuración</a>'; htmlSubMenu += '<a class="col-xs-12 no-padding item-submenu" href="/finanzas">Finanzas</a>'; htmlSubMenu += '<a class="col-xs-12 no-padding item-submenu" href="/locativos">Locativos</a>'; htmlSubMenu += '<a class="col-xs-12 no-padding item-submenu" href="/eventos">Eventos</a>'; break; case 'pnp': // console.log('pantalla NO pequeña'); $("#menu-webpage").removeClass('text-right'); $("#menu-webpage").addClass('text-center'); htmlMenu += '<div class="col-xs-3 no-padding item-menu-webpage" style="height: 9vh; padding-top: 2vh !important;"><a id="menu-configuracion" class="col-xs-12 no-padding" href="/config" style="font-size: 2.5vh; text-decoration: none;">Configuración</a></div>'; htmlMenu += '<div class="col-xs-3 no-padding item-menu-webpage" style="height: 9vh; padding-top: 2vh !important;"><a id="menu-finanzas" class="col-xs-12 no-padding" href="/finanzas" style="font-size: 2.5vh; text-decoration: none;">Finanzas</a></div>'; htmlMenu += '<div class="col-xs-3 no-padding item-menu-webpage" style="height: 9vh; padding-top: 2vh !important;"><a id="menu-locativos" class="col-xs-12 no-padding" href="/locativos" style="font-size: 2.5vh; text-decoration: none;">Locativos</a></div>'; htmlMenu += '<div class="col-xs-3 no-padding item-menu-webpage" style="height: 9vh; padding-top: 2vh !important;"><a id="menu-eventos" class="col-xs-12 no-padding" href="/eventos" style="font-size: 2.5vh; text-decoration: none;">Eventos</a></div>'; htmlSubMenu = ''; break; // case 'pm': // console.log('pantalla mediana'); // break; // case 'pg': // console.log('pantalla grande'); // break; // case 'pgg': // console.log('pantalla muy grande'); // break; default: console.log('Size Screen???'); alert('Size Screen???'); } $("#menu-webpage").html(htmlMenu); $("#submenu-webpage").html(htmlSubMenu); }
[ "function", "showMenuContent", "(", "size", ")", "{", "// console.log(size);", "var", "htmlMenu", "=", "''", ";", "var", "htmlSubMenu", "=", "''", ";", "switch", "(", "size", ")", "{", "case", "'pp'", ":", "// console.log('pantalla pequeña');", "$", "(", "\"#menu-webpage\"", ")", ".", "removeClass", "(", "'text-center'", ")", ";", "$", "(", "\"#menu-webpage\"", ")", ".", "addClass", "(", "'text-right'", ")", ";", "htmlMenu", "+=", "'<div class=\"col-xs-2 col-xs-offset-10 no-padding item-menu-webpage-icono text-center\" style=\"height: 9vh; padding-top: 2vh !important;\" onclick=\"mostrarOcultarSubmenu(\\'submenu-webpage\\')\"><label class=\"col-xs-12 no-padding glyphicon glyphicon-menu-hamburger\"></label></div>'", ";", "htmlSubMenu", "+=", "'<a class=\"col-xs-12 no-padding item-submenu\" href=\"/config\">Configuración</a>';", "", "htmlSubMenu", "+=", "'<a class=\"col-xs-12 no-padding item-submenu\" href=\"/finanzas\">Finanzas</a>'", ";", "htmlSubMenu", "+=", "'<a class=\"col-xs-12 no-padding item-submenu\" href=\"/locativos\">Locativos</a>'", ";", "htmlSubMenu", "+=", "'<a class=\"col-xs-12 no-padding item-submenu\" href=\"/eventos\">Eventos</a>'", ";", "break", ";", "case", "'pnp'", ":", "// console.log('pantalla NO pequeña');", "$", "(", "\"#menu-webpage\"", ")", ".", "removeClass", "(", "'text-right'", ")", ";", "$", "(", "\"#menu-webpage\"", ")", ".", "addClass", "(", "'text-center'", ")", ";", "htmlMenu", "+=", "'<div class=\"col-xs-3 no-padding item-menu-webpage\" style=\"height: 9vh; padding-top: 2vh !important;\"><a id=\"menu-configuracion\" class=\"col-xs-12 no-padding\" href=\"/config\" style=\"font-size: 2.5vh; text-decoration: none;\">Configuración</a></div>';", "", "htmlMenu", "+=", "'<div class=\"col-xs-3 no-padding item-menu-webpage\" style=\"height: 9vh; padding-top: 2vh !important;\"><a id=\"menu-finanzas\" class=\"col-xs-12 no-padding\" href=\"/finanzas\" style=\"font-size: 2.5vh; text-decoration: none;\">Finanzas</a></div>'", ";", "htmlMenu", "+=", "'<div class=\"col-xs-3 no-padding item-menu-webpage\" style=\"height: 9vh; padding-top: 2vh !important;\"><a id=\"menu-locativos\" class=\"col-xs-12 no-padding\" href=\"/locativos\" style=\"font-size: 2.5vh; text-decoration: none;\">Locativos</a></div>'", ";", "htmlMenu", "+=", "'<div class=\"col-xs-3 no-padding item-menu-webpage\" style=\"height: 9vh; padding-top: 2vh !important;\"><a id=\"menu-eventos\" class=\"col-xs-12 no-padding\" href=\"/eventos\" style=\"font-size: 2.5vh; text-decoration: none;\">Eventos</a></div>'", ";", "htmlSubMenu", "=", "''", ";", "break", ";", "// case 'pm':", "// \tconsole.log('pantalla mediana');", "// \tbreak;", "// case 'pg':", "// \tconsole.log('pantalla grande');", "// \tbreak;", "// case 'pgg':", "// \tconsole.log('pantalla muy grande');", "// \tbreak;", "default", ":", "console", ".", "log", "(", "'Size Screen???'", ")", ";", "alert", "(", "'Size Screen???'", ")", ";", "}", "$", "(", "\"#menu-webpage\"", ")", ".", "html", "(", "htmlMenu", ")", ";", "$", "(", "\"#submenu-webpage\"", ")", ".", "html", "(", "htmlSubMenu", ")", ";", "}" ]
[ 2, 0 ]
[ 43, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
registrar_nuevasnotas
()
null
/* Funcion que REGISTRA las notas de una materia, de un determinado estudiante
/* Funcion que REGISTRA las notas de una materia, de un determinado estudiante
function registrar_nuevasnotas(){ var materia_numareas = document.getElementById('materia_numareasgen').value; var materiaasig_id = document.getElementById('materiaasig_id').value; if(materia_numareas == 0 || materia_numareas == "" || materia_numareas == null){ alert("No hay limite de notas para esta materia"); }else{ var lasnotas = []; for (var i = 0; i < materia_numareas; i++) { var numnota = i+1; lasnotas.push($("#nota_pond"+numnota+"_mat").val()); } var base_url = document.getElementById('base_url').value; var controlador = base_url+"kardex_academico/generar_notas/"; $.ajax({url: controlador, type:"POST", data:{materia_numareas:materia_numareas, lasnotas:lasnotas, materiaasig_id:materiaasig_id}, success:function(respuesta){ if(respuesta != null){ location.reload(); }else{ alert("posiblemente no tenga permisos de generar notas, consulte con su administrador!."); } }, error: function(respuesta){ } }); } }
[ "function", "registrar_nuevasnotas", "(", ")", "{", "var", "materia_numareas", "=", "document", ".", "getElementById", "(", "'materia_numareasgen'", ")", ".", "value", ";", "var", "materiaasig_id", "=", "document", ".", "getElementById", "(", "'materiaasig_id'", ")", ".", "value", ";", "if", "(", "materia_numareas", "==", "0", "||", "materia_numareas", "==", "\"\"", "||", "materia_numareas", "==", "null", ")", "{", "alert", "(", "\"No hay limite de notas para esta materia\"", ")", ";", "}", "else", "{", "var", "lasnotas", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "materia_numareas", ";", "i", "++", ")", "{", "var", "numnota", "=", "i", "+", "1", ";", "lasnotas", ".", "push", "(", "$", "(", "\"#nota_pond\"", "+", "numnota", "+", "\"_mat\"", ")", ".", "val", "(", ")", ")", ";", "}", "var", "base_url", "=", "document", ".", "getElementById", "(", "'base_url'", ")", ".", "value", ";", "var", "controlador", "=", "base_url", "+", "\"kardex_academico/generar_notas/\"", ";", "$", ".", "ajax", "(", "{", "url", ":", "controlador", ",", "type", ":", "\"POST\"", ",", "data", ":", "{", "materia_numareas", ":", "materia_numareas", ",", "lasnotas", ":", "lasnotas", ",", "materiaasig_id", ":", "materiaasig_id", "}", ",", "success", ":", "function", "(", "respuesta", ")", "{", "if", "(", "respuesta", "!=", "null", ")", "{", "location", ".", "reload", "(", ")", ";", "}", "else", "{", "alert", "(", "\"posiblemente no tenga permisos de generar notas, consulte con su administrador!.\"", ")", ";", "}", "}", ",", "error", ":", "function", "(", "respuesta", ")", "{", "}", "}", ")", ";", "}", "}" ]
[ 79, 0 ]
[ 106, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
barchart
()
null
Para la vista generals de los host La idea es que la grafica se organice
Para la vista generals de los host La idea es que la grafica se organice
function barchart(){ let w = 500 let h = 300 var svg = d3.select('div') .append('svg') .attr("width", w) .attr("height", h); svg.selectAll('rect') .data(dataM) .enter().append('rect') .attr('class','rect_svg') .attr("width", 10) .attr("height", 500) .attr("x", function(d,i){ return i*10 + 15; }) .attr("height", function(d){ return d; }) .attr("y", function(d){ return h - d; }) }
[ "function", "barchart", "(", ")", "{", "let", "w", "=", "500", "let", "h", "=", "300", "var", "svg", "=", "d3", ".", "select", "(", "'div'", ")", ".", "append", "(", "'svg'", ")", ".", "attr", "(", "\"width\"", ",", "w", ")", ".", "attr", "(", "\"height\"", ",", "h", ")", ";", "svg", ".", "selectAll", "(", "'rect'", ")", ".", "data", "(", "dataM", ")", ".", "enter", "(", ")", ".", "append", "(", "'rect'", ")", ".", "attr", "(", "'class'", ",", "'rect_svg'", ")", ".", "attr", "(", "\"width\"", ",", "10", ")", ".", "attr", "(", "\"height\"", ",", "500", ")", ".", "attr", "(", "\"x\"", ",", "function", "(", "d", ",", "i", ")", "{", "return", "i", "*", "10", "+", "15", ";", "}", ")", ".", "attr", "(", "\"height\"", ",", "function", "(", "d", ")", "{", "return", "d", ";", "}", ")", ".", "attr", "(", "\"y\"", ",", "function", "(", "d", ")", "{", "return", "h", "-", "d", ";", "}", ")", "}" ]
[ 20, 0 ]
[ 42, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
obtenerVisita
()
null
para buscar la persona
para buscar la persona
function obtenerVisita (){ const valorDocumento = documento.value; const visita = personas.find(persona => persona.documento === valorDocumento); return visita; }
[ "function", "obtenerVisita", "(", ")", "{", "const", "valorDocumento", "=", "documento", ".", "value", ";", "const", "visita", "=", "personas", ".", "find", "(", "persona", "=>", "persona", ".", "documento", "===", "valorDocumento", ")", ";", "return", "visita", ";", "}" ]
[ 88, 0 ]
[ 92, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
handleSerie
(event)
null
//////////////////////////////////////////// Funciones para escuchar y guardar favoritos
//////////////////////////////////////////// Funciones para escuchar y guardar favoritos
function handleSerie(event) { //añado clase para que destaque la sección de favoritas en los resultados event.currentTarget.classList.toggle("fav"); //creo un nuevo array de las selecionadas parseando datos de string a número const selectedSerie = parseInt(event.currentTarget.id); //busco el objeto que contiene el elemento clicado en dataSeries(datos del json) const objectClicked = dataSeries.find((serie) => { return serie.show.id === selectedSerie; }); // busco si la seleccionada está en el array de favoritos. const favoritesFound = favorites.findIndex((fav) => { return fav.show.id === selectedSerie; }); //si la paleta no está en favoritos findIndex me ha devuelto -1 if (favoritesFound === -1) { // añado al array de favoritos favorites.push(objectClicked); // si el findIndex me ha devuelto un número mayor o igual a 0 es que sí está en el array de favoritos // quiero sacarlo de array de favoritos // para utilizar splice necesito el índice del elemento que quiero borrar // y quiero borrar un solo elemento por eso colocamos 1 } else { favorites.splice(favoritesFound, 1); } renderFavourite(); setInLocalStorage(); }
[ "function", "handleSerie", "(", "event", ")", "{", "//añado clase para que destaque la sección de favoritas en los resultados", "event", ".", "currentTarget", ".", "classList", ".", "toggle", "(", "\"fav\"", ")", ";", "//creo un nuevo array de las selecionadas parseando datos de string a número", "const", "selectedSerie", "=", "parseInt", "(", "event", ".", "currentTarget", ".", "id", ")", ";", "//busco el objeto que contiene el elemento clicado en dataSeries(datos del json)", "const", "objectClicked", "=", "dataSeries", ".", "find", "(", "(", "serie", ")", "=>", "{", "return", "serie", ".", "show", ".", "id", "===", "selectedSerie", ";", "}", ")", ";", "// busco si la seleccionada está en el array de favoritos.", "const", "favoritesFound", "=", "favorites", ".", "findIndex", "(", "(", "fav", ")", "=>", "{", "return", "fav", ".", "show", ".", "id", "===", "selectedSerie", ";", "}", ")", ";", "//si la paleta no está en favoritos findIndex me ha devuelto -1", "if", "(", "favoritesFound", "===", "-", "1", ")", "{", "// añado al array de favoritos", "favorites", ".", "push", "(", "objectClicked", ")", ";", "// si el findIndex me ha devuelto un número mayor o igual a 0 es que sí está en el array de favoritos", "// quiero sacarlo de array de favoritos", "// para utilizar splice necesito el índice del elemento que quiero borrar", "// y quiero borrar un solo elemento por eso colocamos 1", "}", "else", "{", "favorites", ".", "splice", "(", "favoritesFound", ",", "1", ")", ";", "}", "renderFavourite", "(", ")", ";", "setInLocalStorage", "(", ")", ";", "}" ]
[ 81, 0 ]
[ 107, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
comprobar1
()
null
palabra TEMBLOR color rojo
palabra TEMBLOR color rojo
function comprobar1(){ a1 = document.getElementById('celda1').style.color="red"; }
[ "function", "comprobar1", "(", ")", "{", "a1", "=", "document", ".", "getElementById", "(", "'celda1'", ")", ".", "style", ".", "color", "=", "\"red\"", ";", "}" ]
[ 7, 0 ]
[ 9, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
deleteOne
(req, res)
null
Delete User Se requiere estar logeado y que el usuario que se desea eliminar sea el mismo de la sesion
Delete User Se requiere estar logeado y que el usuario que se desea eliminar sea el mismo de la sesion
function deleteOne(req, res) { const idUser = req.user._id Controller.deleteUser(idUser, req.body) .then((user) => { response.success(req, res, user.body, 200) }) .catch((err) => { response.error(req, res, err, 404) }) }
[ "function", "deleteOne", "(", "req", ",", "res", ")", "{", "const", "idUser", "=", "req", ".", "user", ".", "_id", "Controller", ".", "deleteUser", "(", "idUser", ",", "req", ".", "body", ")", ".", "then", "(", "(", "user", ")", "=>", "{", "response", ".", "success", "(", "req", ",", "res", ",", "user", ".", "body", ",", "200", ")", "}", ")", ".", "catch", "(", "(", "err", ")", "=>", "{", "response", ".", "error", "(", "req", ",", "res", ",", "err", ",", "404", ")", "}", ")", "}" ]
[ 72, 0 ]
[ 81, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
panelCarrito
(abrir, recarga, quitarRelleno)
null
/* Mantiene el carrito abierto al recargar la página y quita o pone "No hay nada en tu carrito" cuando se añaden elementos o se compra
/* Mantiene el carrito abierto al recargar la página y quita o pone "No hay nada en tu carrito" cuando se añaden elementos o se compra
function panelCarrito(abrir, recarga, quitarRelleno) { if (localStorage.getItem("carritoAbierto") == "true") { document.getElementById("panelCarrito").classList.add("mostrarPanel"); localStorage.setItem("carritoAbierto", true); } else if (abrir == true) { document.getElementById("panelCarrito").classList.add("mostrarPanel"); localStorage.setItem("carritoAbierto", true); } if (abrir == false && recarga != true) { document.getElementById("panelCarrito").classList.remove("mostrarPanel"); localStorage.setItem("carritoAbierto", false); } if (quitarRelleno == true || localStorage.getItem("quitarRelleno") == "true") { document.getElementById("relleno").style.display = "none"; localStorage.setItem("quitarRelleno", true); } else { document.getElementById("relleno").style.display = "block"; } }
[ "function", "panelCarrito", "(", "abrir", ",", "recarga", ",", "quitarRelleno", ")", "{", "if", "(", "localStorage", ".", "getItem", "(", "\"carritoAbierto\"", ")", "==", "\"true\"", ")", "{", "document", ".", "getElementById", "(", "\"panelCarrito\"", ")", ".", "classList", ".", "add", "(", "\"mostrarPanel\"", ")", ";", "localStorage", ".", "setItem", "(", "\"carritoAbierto\"", ",", "true", ")", ";", "}", "else", "if", "(", "abrir", "==", "true", ")", "{", "document", ".", "getElementById", "(", "\"panelCarrito\"", ")", ".", "classList", ".", "add", "(", "\"mostrarPanel\"", ")", ";", "localStorage", ".", "setItem", "(", "\"carritoAbierto\"", ",", "true", ")", ";", "}", "if", "(", "abrir", "==", "false", "&&", "recarga", "!=", "true", ")", "{", "document", ".", "getElementById", "(", "\"panelCarrito\"", ")", ".", "classList", ".", "remove", "(", "\"mostrarPanel\"", ")", ";", "localStorage", ".", "setItem", "(", "\"carritoAbierto\"", ",", "false", ")", ";", "}", "if", "(", "quitarRelleno", "==", "true", "||", "localStorage", ".", "getItem", "(", "\"quitarRelleno\"", ")", "==", "\"true\"", ")", "{", "document", ".", "getElementById", "(", "\"relleno\"", ")", ".", "style", ".", "display", "=", "\"none\"", ";", "localStorage", ".", "setItem", "(", "\"quitarRelleno\"", ",", "true", ")", ";", "}", "else", "{", "document", ".", "getElementById", "(", "\"relleno\"", ")", ".", "style", ".", "display", "=", "\"block\"", ";", "}", "}" ]
[ 1, 0 ]
[ 19, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
datos
(criterio)
null
Funcion de busqueda con criterio
Funcion de busqueda con criterio
function datos(criterio){ //obtenemos la url y le concatenamos /create , //esta es la funcion del controlador donde retornamos los datos var url = window.location+'/create'; if (url.indexOf('showBanner') > 1) { $.ajax({ url: url,//en el elemento url colocamos la variable antes definida type: "get",//usamos el metodo get dataType:"html",//el tipo de dato de respuesta es html ya que en el conrtolador estamos c //concatenando etiquetas html data: {criterio:criterio},//aqui enviamos los datos a la url, ejemplo nombreVariable:variable success: function(data){//Si el envio de datos fue satisfactorio utilizamos la variable de respuesta //en este caso data $("tbody").html(data);//imprimimos en el cuerpo de las tablas la varible de respuesta $(".mensajes").html(data);//Este caso es especial ya que no es una tabla,este elemento es un div } }); return false; } //comenzamos ajax $.ajax({ url: url,//en el elemento url colocamos la variable antes definida type: "get",//usamos el metodo get dataType:"html",//el tipo de dato de respuesta es html ya que en el conrtolador estamos c //concatenando etiquetas html data: {criterio:criterio},//aqui enviamos los datos a la url, ejemplo nombreVariable:variable success: function(data){//Si el envio de datos fue satisfactorio utilizamos la variable de respuesta //en este caso data $("tbody").html(data);//imprimimos en el cuerpo de las tablas la varible de respuesta $(".mensajes").html(data);//Este caso es especial ya que no es una tabla,este elemento es un div } }); }
[ "function", "datos", "(", "criterio", ")", "{", "//obtenemos la url y le concatenamos /create ,", "//esta es la funcion del controlador donde retornamos los datos", "var", "url", "=", "window", ".", "location", "+", "'/create'", ";", "if", "(", "url", ".", "indexOf", "(", "'showBanner'", ")", ">", "1", ")", "{", "$", ".", "ajax", "(", "{", "url", ":", "url", ",", "//en el elemento url colocamos la variable antes definida", "type", ":", "\"get\"", ",", "//usamos el metodo get", "dataType", ":", "\"html\"", ",", "//el tipo de dato de respuesta es html ya que en el conrtolador estamos c", "//concatenando etiquetas html ", "data", ":", "{", "criterio", ":", "criterio", "}", ",", "//aqui enviamos los datos a la url, ejemplo nombreVariable:variable", "success", ":", "function", "(", "data", ")", "{", "//Si el envio de datos fue satisfactorio utilizamos la variable de respuesta", "//en este caso data", "$", "(", "\"tbody\"", ")", ".", "html", "(", "data", ")", ";", "//imprimimos en el cuerpo de las tablas la varible de respuesta", "$", "(", "\".mensajes\"", ")", ".", "html", "(", "data", ")", ";", "//Este caso es especial ya que no es una tabla,este elemento es un div", "}", "}", ")", ";", "return", "false", ";", "}", "//comenzamos ajax", "$", ".", "ajax", "(", "{", "url", ":", "url", ",", "//en el elemento url colocamos la variable antes definida", "type", ":", "\"get\"", ",", "//usamos el metodo get", "dataType", ":", "\"html\"", ",", "//el tipo de dato de respuesta es html ya que en el conrtolador estamos c", "//concatenando etiquetas html ", "data", ":", "{", "criterio", ":", "criterio", "}", ",", "//aqui enviamos los datos a la url, ejemplo nombreVariable:variable", "success", ":", "function", "(", "data", ")", "{", "//Si el envio de datos fue satisfactorio utilizamos la variable de respuesta", "//en este caso data", "$", "(", "\"tbody\"", ")", ".", "html", "(", "data", ")", ";", "//imprimimos en el cuerpo de las tablas la varible de respuesta", "$", "(", "\".mensajes\"", ")", ".", "html", "(", "data", ")", ";", "//Este caso es especial ya que no es una tabla,este elemento es un div", "}", "}", ")", ";", "}" ]
[ 389, 0 ]
[ 421, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setup
()
null
variable de tiempo
variable de tiempo
function setup() { createCanvas(600, 600); noStroke(); fill(40, 200, 40); }
[ "function", "setup", "(", ")", "{", "createCanvas", "(", "600", ",", "600", ")", ";", "noStroke", "(", ")", ";", "fill", "(", "40", ",", "200", ",", "40", ")", ";", "}" ]
[ 9, 0 ]
[ 13, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
ver_tabla_usuario
()
null
Ver tabla usuario
Ver tabla usuario
function ver_tabla_usuario() { $.ajax({ type: "GET", url: "ajax/ver_tabla_usuario.php", }).done(function(msg) { $("#ver_tabla_usuario").html(msg); }) }
[ "function", "ver_tabla_usuario", "(", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "\"GET\"", ",", "url", ":", "\"ajax/ver_tabla_usuario.php\"", ",", "}", ")", ".", "done", "(", "function", "(", "msg", ")", "{", "$", "(", "\"#ver_tabla_usuario\"", ")", ".", "html", "(", "msg", ")", ";", "}", ")", "}" ]
[ 20, 0 ]
[ 27, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
buscaAlumno
(id)
null
Recupera el html de un pasatiempo en base a su id. @param {string} id
Recupera el html de un pasatiempo en base a su id.
async function buscaAlumno(id) { if (id) { const doc = await daoAlumno. doc(id). get(); if (doc.exists) { /** * @type {import( "./tipos.js"). Alumno} */ const data = doc.data(); return (/* html */ `${cod(data.nombre)}`); } } return " "; }
[ "async", "function", "buscaAlumno", "(", "id", ")", "{", "if", "(", "id", ")", "{", "const", "doc", "=", "await", "daoAlumno", ".", "doc", "(", "id", ")", ".", "get", "(", ")", ";", "if", "(", "doc", ".", "exists", ")", "{", "/**\n * @type {import(\n \"./tipos.js\").\n Alumno} */", "const", "data", "=", "doc", ".", "data", "(", ")", ";", "return", "(", "/* html */", "`", "${", "cod", "(", "data", ".", "nombre", ")", "}", "`", ")", ";", "}", "}", "return", "\" \"", ";", "}" ]
[ 119, 0 ]
[ 137, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
obtenerPersonaje
(id, callback)
null
/*#2 esta funcion la recortamos y la ejecutamos como anonima en $.get() const onPeopleResponse = function (persona){ console.log(`Hola, yo soy ${persona.name}`) } /*#1 haremos que esta funcion acepte un segundo parametro callback o cb o fn
/*#2 esta funcion la recortamos y la ejecutamos como anonima en $.get()
function obtenerPersonaje(id, callback) { const url = `${API_URL}${PEOPLE_URL.replace(':id', id)}` /* #3 */ $.get(url, opts, function (persona){ console.log(`Hola, yo soy ${persona.name}`) /* #4 */ if (callback) { callback() } }) }
[ "function", "obtenerPersonaje", "(", "id", ",", "callback", ")", "{", "const", "url", "=", "`", "${", "API_URL", "}", "${", "PEOPLE_URL", ".", "replace", "(", "':id'", ",", "id", ")", "}", "`", "/* #3 */", "$", ".", "get", "(", "url", ",", "opts", ",", "function", "(", "persona", ")", "{", "console", ".", "log", "(", "`", "${", "persona", ".", "name", "}", "`", ")", "/* #4 */", "if", "(", "callback", ")", "{", "callback", "(", ")", "}", "}", ")", "}" ]
[ 15, 0 ]
[ 27, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(a,b)
null
Cuando no se incluye el () al final de la funcion, la funcion 'anonima2' podra invocarse N veces haciendo referencia a la funcion
Cuando no se incluye el () al final de la funcion, la funcion 'anonima2' podra invocarse N veces haciendo referencia a la funcion
function(a,b){ return a+b; }
[ "function", "(", "a", ",", "b", ")", "{", "return", "a", "+", "b", ";", "}" ]
[ 11, 15 ]
[ 13, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
desarmar
(org,tb,tt)
null
descomponente en un numero de bolques par para iniciar el cifrado
descomponente en un numero de bolques par para iniciar el cifrado
function desarmar(org,tb,tt){ var Vec = new Array() var i = Math.floor(tt / tb); //cantidad de bloques var llave=0; var sw=false; if(tt-(i*tb) > 0){ i=i+1; llave=(i*tb)-tt } if(i %2 == 1){ i=i+1; sw=true } var n_aux1=0; var n_aux2=tb for(var j=0; j < i; j++){ Vec[j]=org.substr(n_aux1,n_aux2); n_aux1=n_aux1+tb; n_aux2=n_aux2+tb; if(j== i-1 && !sw){ for(var l=0; l < llave ;l++){ Vec[j]=Vec[j]+' '; } } if(j== i-2&&sw){ for(var l=0; l < llave ;l++){ Vec[j]=Vec[j]+' ' } } if(j== i-1&&sw){ for(var l=0; l < tb ;l++){ Vec[j]=Vec[j]+' '; } } } return Vec }
[ "function", "desarmar", "(", "org", ",", "tb", ",", "tt", ")", "{", "var", "Vec", "=", "new", "Array", "(", ")", "var", "i", "=", "Math", ".", "floor", "(", "tt", "/", "tb", ")", ";", "//cantidad de bloques", "var", "llave", "=", "0", ";", "var", "sw", "=", "false", ";", "if", "(", "tt", "-", "(", "i", "*", "tb", ")", ">", "0", ")", "{", "i", "=", "i", "+", "1", ";", "llave", "=", "(", "i", "*", "tb", ")", "-", "tt", "}", "if", "(", "i", "%", "2", "==", "1", ")", "{", "i", "=", "i", "+", "1", ";", "sw", "=", "true", "}", "var", "n_aux1", "=", "0", ";", "var", "n_aux2", "=", "tb", "for", "(", "var", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "Vec", "[", "j", "]", "=", "org", ".", "substr", "(", "n_aux1", ",", "n_aux2", ")", ";", "n_aux1", "=", "n_aux1", "+", "tb", ";", "n_aux2", "=", "n_aux2", "+", "tb", ";", "if", "(", "j", "==", "i", "-", "1", "&&", "!", "sw", ")", "{", "for", "(", "var", "l", "=", "0", ";", "l", "<", "llave", ";", "l", "++", ")", "{", "Vec", "[", "j", "]", "=", "Vec", "[", "j", "]", "+", "' '", ";", "}", "}", "if", "(", "j", "==", "i", "-", "2", "&&", "sw", ")", "{", "for", "(", "var", "l", "=", "0", ";", "l", "<", "llave", ";", "l", "++", ")", "{", "Vec", "[", "j", "]", "=", "Vec", "[", "j", "]", "+", "' '", "}", "}", "if", "(", "j", "==", "i", "-", "1", "&&", "sw", ")", "{", "for", "(", "var", "l", "=", "0", ";", "l", "<", "tb", ";", "l", "++", ")", "{", "Vec", "[", "j", "]", "=", "Vec", "[", "j", "]", "+", "' '", ";", "}", "}", "}", "return", "Vec", "}" ]
[ 187, 0 ]
[ 234, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
usePageTitle
(title)
null
Se utiliza en páginas
Se utiliza en páginas
function usePageTitle(title) { useEffect(() => { document.title = `Rick & Morty App ${title ? `| ${title}` : ''}`; }, []); }
[ "function", "usePageTitle", "(", "title", ")", "{", "useEffect", "(", "(", ")", "=>", "{", "document", ".", "title", "=", "`", "${", "title", "?", "`", "${", "title", "}", "`", ":", "''", "}", "`", ";", "}", ",", "[", "]", ")", ";", "}" ]
[ 3, 0 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mostrarCaja
()
null
/* Mustra el elemento sidebar y login o perfil. Solo se usa en vista de movil
/* Mustra el elemento sidebar y login o perfil. Solo se usa en vista de movil
function mostrarCaja() { document.getElementById('box').classList.add("abrirlogin"); document.getElementById("sidebar").classList.add("abrirlogin"); document.getElementById("main").style.display = "none"; document.getElementById("topTemas").style.display = "none"; document.getElementById("link").onclick = ocultarCaja; }
[ "function", "mostrarCaja", "(", ")", "{", "document", ".", "getElementById", "(", "'box'", ")", ".", "classList", ".", "add", "(", "\"abrirlogin\"", ")", ";", "document", ".", "getElementById", "(", "\"sidebar\"", ")", ".", "classList", ".", "add", "(", "\"abrirlogin\"", ")", ";", "document", ".", "getElementById", "(", "\"main\"", ")", ".", "style", ".", "display", "=", "\"none\"", ";", "document", ".", "getElementById", "(", "\"topTemas\"", ")", ".", "style", ".", "display", "=", "\"none\"", ";", "document", ".", "getElementById", "(", "\"link\"", ")", ".", "onclick", "=", "ocultarCaja", ";", "}" ]
[ 1, 0 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
phoneCheck
(str)
null
Valida si el numero de telefono es validdo para EU
Valida si el numero de telefono es validdo para EU
function phoneCheck(str) { var exp = /^(1\s?)?(\(\d{3}\)|\d{3})[\s\-]?\d{3}[\s\-]?\d{4}$/; return exp.test(str); }
[ "function", "phoneCheck", "(", "str", ")", "{", "var", "exp", "=", "/", "^(1\\s?)?(\\(\\d{3}\\)|\\d{3})[\\s\\-]?\\d{3}[\\s\\-]?\\d{4}$", "/", ";", "return", "exp", ".", "test", "(", "str", ")", ";", "}" ]
[ 3, 0 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
redrawAll
()
null
Pintar el grafo *
Pintar el grafo *
function redrawAll() { var container = document.getElementById('mynetwork'); var data = { nodes: nodes, edges: edges }; var options = { autoResize: true, width: '100%', height: '99%', nodes: { borderWidth: 1, shape: 'dot', scaling: { min:3, max: 40, label: { enabled: true, min: 10, max: 25, drawThreshold: 5, maxVisible: 20 } }, font: { face: 'Tahoma' } }, edges: { width: 0.15, color: {inherit: 'from'}, smooth: { type: 'continuous' } }, groups:{ useDefaultGroups: true }, interaction: { hideEdgesOnDrag: true, multiselect: true }, physics: { barnesHut: { gravitationalConstant: -4000, springConstant: 0.01, springLength: 200 }, forceAtlas2Based: { gravitationalConstant: -26, centralGravity: 0.005, springLength: 230, springConstant: 0.18 }, maxVelocity: 100, solver: 'barnesHut', timestep: 0.35, stabilization: { enabled:true, iterations:4000, updateInterval:25 } } }; network = new vis.Network(container, data, options); // Obtener copia de los nodos para marcar vecinos allNodes = nodes.get({returnType:"Object"}); network.on("stabilizationProgress", function(params) { var maxWidth = 496; var minWidth = 20; var widthFactor = params.iterations/params.total; var width = Math.max(minWidth,maxWidth * widthFactor); document.getElementById('bar').style.width = width + 'px'; document.getElementById('text').innerHTML = Math.round(widthFactor*100) + '%'; }); network.once("stabilizationIterationsDone", function() { document.getElementById('text').innerHTML = '100%'; document.getElementById('bar').style.width = '496px'; document.getElementById('loadingBar').style.opacity = 0; // really clean the dom element setTimeout(function () {document.getElementById('loadingBar').style.display = 'none';}, 500); }); }
[ "function", "redrawAll", "(", ")", "{", "var", "container", "=", "document", ".", "getElementById", "(", "'mynetwork'", ")", ";", "var", "data", "=", "{", "nodes", ":", "nodes", ",", "edges", ":", "edges", "}", ";", "var", "options", "=", "{", "autoResize", ":", "true", ",", "width", ":", "'100%'", ",", "height", ":", "'99%'", ",", "nodes", ":", "{", "borderWidth", ":", "1", ",", "shape", ":", "'dot'", ",", "scaling", ":", "{", "min", ":", "3", ",", "max", ":", "40", ",", "label", ":", "{", "enabled", ":", "true", ",", "min", ":", "10", ",", "max", ":", "25", ",", "drawThreshold", ":", "5", ",", "maxVisible", ":", "20", "}", "}", ",", "font", ":", "{", "face", ":", "'Tahoma'", "}", "}", ",", "edges", ":", "{", "width", ":", "0.15", ",", "color", ":", "{", "inherit", ":", "'from'", "}", ",", "smooth", ":", "{", "type", ":", "'continuous'", "}", "}", ",", "groups", ":", "{", "useDefaultGroups", ":", "true", "}", ",", "interaction", ":", "{", "hideEdgesOnDrag", ":", "true", ",", "multiselect", ":", "true", "}", ",", "physics", ":", "{", "barnesHut", ":", "{", "gravitationalConstant", ":", "-", "4000", ",", "springConstant", ":", "0.01", ",", "springLength", ":", "200", "}", ",", "forceAtlas2Based", ":", "{", "gravitationalConstant", ":", "-", "26", ",", "centralGravity", ":", "0.005", ",", "springLength", ":", "230", ",", "springConstant", ":", "0.18", "}", ",", "maxVelocity", ":", "100", ",", "solver", ":", "'barnesHut'", ",", "timestep", ":", "0.35", ",", "stabilization", ":", "{", "enabled", ":", "true", ",", "iterations", ":", "4000", ",", "updateInterval", ":", "25", "}", "}", "}", ";", "network", "=", "new", "vis", ".", "Network", "(", "container", ",", "data", ",", "options", ")", ";", "// Obtener copia de los nodos para marcar vecinos", "allNodes", "=", "nodes", ".", "get", "(", "{", "returnType", ":", "\"Object\"", "}", ")", ";", "network", ".", "on", "(", "\"stabilizationProgress\"", ",", "function", "(", "params", ")", "{", "var", "maxWidth", "=", "496", ";", "var", "minWidth", "=", "20", ";", "var", "widthFactor", "=", "params", ".", "iterations", "/", "params", ".", "total", ";", "var", "width", "=", "Math", ".", "max", "(", "minWidth", ",", "maxWidth", "*", "widthFactor", ")", ";", "document", ".", "getElementById", "(", "'bar'", ")", ".", "style", ".", "width", "=", "width", "+", "'px'", ";", "document", ".", "getElementById", "(", "'text'", ")", ".", "innerHTML", "=", "Math", ".", "round", "(", "widthFactor", "*", "100", ")", "+", "'%'", ";", "}", ")", ";", "network", ".", "once", "(", "\"stabilizationIterationsDone\"", ",", "function", "(", ")", "{", "document", ".", "getElementById", "(", "'text'", ")", ".", "innerHTML", "=", "'100%'", ";", "document", ".", "getElementById", "(", "'bar'", ")", ".", "style", ".", "width", "=", "'496px'", ";", "document", ".", "getElementById", "(", "'loadingBar'", ")", ".", "style", ".", "opacity", "=", "0", ";", "// really clean the dom element", "setTimeout", "(", "function", "(", ")", "{", "document", ".", "getElementById", "(", "'loadingBar'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", ",", "500", ")", ";", "}", ")", ";", "}" ]
[ 61, 0 ]
[ 147, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
sendMultipleMessage
(id_users, subject, body)
null
id_users: es el campo players del match sacado de la BD
id_users: es el campo players del match sacado de la BD
function sendMultipleMessage(id_users, subject, body) { var match_players = id_users.map(function (x) { return x.user }); conectados.forEach(conectado => { if (match_players.includes(conectado.id_user)) conectado.socket.emit(subject, body) }); }
[ "function", "sendMultipleMessage", "(", "id_users", ",", "subject", ",", "body", ")", "{", "var", "match_players", "=", "id_users", ".", "map", "(", "function", "(", "x", ")", "{", "return", "x", ".", "user", "}", ")", ";", "conectados", ".", "forEach", "(", "conectado", "=>", "{", "if", "(", "match_players", ".", "includes", "(", "conectado", ".", "id_user", ")", ")", "conectado", ".", "socket", ".", "emit", "(", "subject", ",", "body", ")", "}", ")", ";", "}" ]
[ 135, 0 ]
[ 143, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
busca
()
null
Busca y muestra los datos que corresponden al id recibido.
Busca y muestra los datos que corresponden al id recibido.
async function busca() { try { const doc = await daoAlumno. doc(id). get(); if (doc.exists) { /** * @type { import("./tipos.js"). Alumno} */ const data = doc.data(); forma.matricula.value = data.matricula; forma.nombre.value = data.nombre; forma.telefono.value = data.telefono; forma.grupo.value = data.grupo; forma.fecha.value = data.fecha; data.nombre || ""; forma.addEventListener( "submit", guarda); forma.eliminar. addEventListener( "click", elimina); } else { throw new Error( "No se encontró."); } } catch (e) { muestraError(e); muestraAlumnos(); } }
[ "async", "function", "busca", "(", ")", "{", "try", "{", "const", "doc", "=", "await", "daoAlumno", ".", "doc", "(", "id", ")", ".", "get", "(", ")", ";", "if", "(", "doc", ".", "exists", ")", "{", "/**\n * @type {\n import(\"./tipos.js\").\n Alumno} */", "const", "data", "=", "doc", ".", "data", "(", ")", ";", "forma", ".", "matricula", ".", "value", "=", "data", ".", "matricula", ";", "forma", ".", "nombre", ".", "value", "=", "data", ".", "nombre", ";", "forma", ".", "telefono", ".", "value", "=", "data", ".", "telefono", ";", "forma", ".", "grupo", ".", "value", "=", "data", ".", "grupo", ";", "forma", ".", "fecha", ".", "value", "=", "data", ".", "fecha", ";", "data", ".", "nombre", "||", "\"\"", ";", "forma", ".", "addEventListener", "(", "\"submit\"", ",", "guarda", ")", ";", "forma", ".", "eliminar", ".", "addEventListener", "(", "\"click\"", ",", "elimina", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"No se encontró.\")", ";", "", "}", "}", "catch", "(", "e", ")", "{", "muestraError", "(", "e", ")", ";", "muestraAlumnos", "(", ")", ";", "}", "}" ]
[ 40, 0 ]
[ 71, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
felicitar
(id)
null
funcion para felicitar a los estudiantes de excelencia academica
funcion para felicitar a los estudiantes de excelencia academica
function felicitar(id) { var token = $("#token").val(); $.ajax({ url: 'ajax/felicitaciones', headers: token, data: { _id: id, _token: token }, type: 'POST', datatype: 'json', success: function (data) { //console.log(response); $('#button_'+id).html(data); $('#button_a_'+id).attr("disabled", "disabled"); }, error: function (response) { console.log(response); } }); }
[ "function", "felicitar", "(", "id", ")", "{", "var", "token", "=", "$", "(", "\"#token\"", ")", ".", "val", "(", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "'ajax/felicitaciones'", ",", "headers", ":", "token", ",", "data", ":", "{", "_id", ":", "id", ",", "_token", ":", "token", "}", ",", "type", ":", "'POST'", ",", "datatype", ":", "'json'", ",", "success", ":", "function", "(", "data", ")", "{", "//console.log(response);", "$", "(", "'#button_'", "+", "id", ")", ".", "html", "(", "data", ")", ";", "$", "(", "'#button_a_'", "+", "id", ")", ".", "attr", "(", "\"disabled\"", ",", "\"disabled\"", ")", ";", "}", ",", "error", ":", "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "}", "}", ")", ";", "}" ]
[ 1, 0 ]
[ 22, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
processFiles
(files)
null
Guarda la informacion del archivo en archivo_de_entrada
Guarda la informacion del archivo en archivo_de_entrada
function processFiles(files) { let file = files[0]; let reader = new FileReader(); reader.readAsText(file); reader.onload = function (e) { archivo_de_entrada = JSON.parse(e.target.result); }; }
[ "function", "processFiles", "(", "files", ")", "{", "let", "file", "=", "files", "[", "0", "]", ";", "let", "reader", "=", "new", "FileReader", "(", ")", ";", "reader", ".", "readAsText", "(", "file", ")", ";", "reader", ".", "onload", "=", "function", "(", "e", ")", "{", "archivo_de_entrada", "=", "JSON", ".", "parse", "(", "e", ".", "target", ".", "result", ")", ";", "}", ";", "}" ]
[ 329, 0 ]
[ 338, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
obtener_planacademico
(carrera_id)
null
/* Obtiene los planes academicos de una determinada Carrera
/* Obtiene los planes academicos de una determinada Carrera
function obtener_planacademico(carrera_id){ var base_url = document.getElementById('base_url').value; var controlador = base_url+'plan_academico/get_plan_acadcarrera'; if(carrera_id >0){ document.getElementById('loader').style.display = 'block'; $.ajax({url: controlador, type:"POST", data:{carrera_id:carrera_id}, success:function(respuesta){ var registros = JSON.parse(respuesta); var html1 = ""; if (registros != null){ var n = registros.length; //tamaño del arreglo de la consulta html1 = ""; html1 += "<b><select name='planacad_id' class='btn btn-warning btn-sm form-control' onchange='obtener_niveles(this.value)' id='planacad_id' required>"; html1 += "<option value=''>- PLAN ACADEMICO -</option>"; for (var i = 0; i < n ; i++){ html1 += "<option value='"+registros[i]['planacad_id']+"' "+seleccionado+">"+registros[i]['planacad_nombre']+"</option>"; } html1 += "</select></b>"; $("#elegirplanacad").html(html1); $("#carrera_nivel").val("-"); $("#carrera_tiempoestudio").val("-"); $("#carrera_codigo").val("-"); $("#carrera_modalidad").val("-"); $("#carrera_plan").val("-"); $("#carrera_matricula").val("0.00"); $("#carrera_mensualidad").val("0.00"); $("#carrera_nummeses").val("0"); $("#pagar_mensualidad").empty(); $("#pagar_mensualidad").html("<option value='0'>- NINGUNA -</option>"); $("#nivel_id").empty(); $("#nivel_id").html("<option value='0'>- NIVEL -</option>"); $("#tabla_materia").html(""); $('#pagar_matricula').find('option:first').attr('selected', 'selected').parent('select'); document.getElementById('loader').style.display = 'none'; } document.getElementById('loader').style.display = 'none'; }, error:function(respuesta){ // alert("Algo salio mal...!!!"); html = ""; $("#elegirplanacad").html(""); }, complete: function (jqXHR, textStatus) { document.getElementById('loader').style.display = 'none'; } }); }else{ var htmln = ""; htmln += "<select name='planacad_id' class='form-control' id='planacad_id' required>"; htmln += "<option value=''>- PLAN ACADEMICO -</option>"; htmln += "</select>"; $("#elegirplanacad").html(htmln); document.getElementById('nuevo_plan').style.display = 'none'; } }
[ "function", "obtener_planacademico", "(", "carrera_id", ")", "{", "var", "base_url", "=", "document", ".", "getElementById", "(", "'base_url'", ")", ".", "value", ";", "var", "controlador", "=", "base_url", "+", "'plan_academico/get_plan_acadcarrera'", ";", "if", "(", "carrera_id", ">", "0", ")", "{", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'block'", ";", "$", ".", "ajax", "(", "{", "url", ":", "controlador", ",", "type", ":", "\"POST\"", ",", "data", ":", "{", "carrera_id", ":", "carrera_id", "}", ",", "success", ":", "function", "(", "respuesta", ")", "{", "var", "registros", "=", "JSON", ".", "parse", "(", "respuesta", ")", ";", "var", "html1", "=", "\"\"", ";", "if", "(", "registros", "!=", "null", ")", "{", "var", "n", "=", "registros", ".", "length", ";", "//tamaño del arreglo de la consulta", "html1", "=", "\"\"", ";", "html1", "+=", "\"<b><select name='planacad_id' class='btn btn-warning btn-sm form-control' onchange='obtener_niveles(this.value)' id='planacad_id' required>\"", ";", "html1", "+=", "\"<option value=''>- PLAN ACADEMICO -</option>\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "html1", "+=", "\"<option value='\"", "+", "registros", "[", "i", "]", "[", "'planacad_id'", "]", "+", "\"' \"", "+", "seleccionado", "+", "\">\"", "+", "registros", "[", "i", "]", "[", "'planacad_nombre'", "]", "+", "\"</option>\"", ";", "}", "html1", "+=", "\"</select></b>\"", ";", "$", "(", "\"#elegirplanacad\"", ")", ".", "html", "(", "html1", ")", ";", "$", "(", "\"#carrera_nivel\"", ")", ".", "val", "(", "\"-\"", ")", ";", "$", "(", "\"#carrera_tiempoestudio\"", ")", ".", "val", "(", "\"-\"", ")", ";", "$", "(", "\"#carrera_codigo\"", ")", ".", "val", "(", "\"-\"", ")", ";", "$", "(", "\"#carrera_modalidad\"", ")", ".", "val", "(", "\"-\"", ")", ";", "$", "(", "\"#carrera_plan\"", ")", ".", "val", "(", "\"-\"", ")", ";", "$", "(", "\"#carrera_matricula\"", ")", ".", "val", "(", "\"0.00\"", ")", ";", "$", "(", "\"#carrera_mensualidad\"", ")", ".", "val", "(", "\"0.00\"", ")", ";", "$", "(", "\"#carrera_nummeses\"", ")", ".", "val", "(", "\"0\"", ")", ";", "$", "(", "\"#pagar_mensualidad\"", ")", ".", "empty", "(", ")", ";", "$", "(", "\"#pagar_mensualidad\"", ")", ".", "html", "(", "\"<option value='0'>- NINGUNA -</option>\"", ")", ";", "$", "(", "\"#nivel_id\"", ")", ".", "empty", "(", ")", ";", "$", "(", "\"#nivel_id\"", ")", ".", "html", "(", "\"<option value='0'>- NIVEL -</option>\"", ")", ";", "$", "(", "\"#tabla_materia\"", ")", ".", "html", "(", "\"\"", ")", ";", "$", "(", "'#pagar_matricula'", ")", ".", "find", "(", "'option:first'", ")", ".", "attr", "(", "'selected'", ",", "'selected'", ")", ".", "parent", "(", "'select'", ")", ";", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", ",", "error", ":", "function", "(", "respuesta", ")", "{", "// alert(\"Algo salio mal...!!!\");", "html", "=", "\"\"", ";", "$", "(", "\"#elegirplanacad\"", ")", ".", "html", "(", "\"\"", ")", ";", "}", ",", "complete", ":", "function", "(", "jqXHR", ",", "textStatus", ")", "{", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "}", ")", ";", "}", "else", "{", "var", "htmln", "=", "\"\"", ";", "htmln", "+=", "\"<select name='planacad_id' class='form-control' id='planacad_id' required>\"", ";", "htmln", "+=", "\"<option value=''>- PLAN ACADEMICO -</option>\"", ";", "htmln", "+=", "\"</select>\"", ";", "$", "(", "\"#elegirplanacad\"", ")", ".", "html", "(", "htmln", ")", ";", "document", ".", "getElementById", "(", "'nuevo_plan'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "}" ]
[ 176, 0 ]
[ 242, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
/* Buscar por filtros
/* Buscar por filtros
function() { var inputs = $('#form-filters .filter'); inputs.each( function(i) { datatable.column( i+1 ).search( $(this).val() ).draw(); }); }
[ "function", "(", ")", "{", "var", "inputs", "=", "$", "(", "'#form-filters .filter'", ")", ";", "inputs", ".", "each", "(", "function", "(", "i", ")", "{", "datatable", ".", "column", "(", "i", "+", "1", ")", ".", "search", "(", "$", "(", "this", ")", ".", "val", "(", ")", ")", ".", "draw", "(", ")", ";", "}", ")", ";", "}" ]
[ 87, 26 ]
[ 95, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator