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
addTodo
({ text, priority })
null
Meter un todo al principio de la lista y guardarla
Meter un todo al principio de la lista y guardarla
async function addTodo({ text, priority }) { const currentTodos = await readTodoList(); const newTask = { text, added: new Date(), priority: priority ? "high" : "normal", done: false, }; currentTodos.tasks = [newTask, ...currentTodos.tasks]; await saveTodosToFile(currentTodos); }
[ "async", "function", "addTodo", "(", "{", "text", ",", "priority", "}", ")", "{", "const", "currentTodos", "=", "await", "readTodoList", "(", ")", ";", "const", "newTask", "=", "{", "text", ",", "added", ":", "new", "Date", "(", ")", ",", "priority", ":", "priority", "?", "\"high\"", ":", "\"normal\"", ",", "done", ":", "false", ",", "}", ";", "currentTodos", ".", "tasks", "=", "[", "newTask", ",", "...", "currentTodos", ".", "tasks", "]", ";", "await", "saveTodosToFile", "(", "currentTodos", ")", ";", "}" ]
[ 56, 0 ]
[ 69, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mouseDragged
()
null
Añade un nuevo boid al sistema
Añade un nuevo boid al sistema
function mouseDragged() { flock.addBoid(new Boid(mouseX, mouseY)); }
[ "function", "mouseDragged", "(", ")", "{", "flock", ".", "addBoid", "(", "new", "Boid", "(", "mouseX", ",", "mouseY", ")", ")", ";", "}" ]
[ 32, 0 ]
[ 34, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
limpiarCamposContactoSusc
()
null
Limpiar formulario de suscripción
Limpiar formulario de suscripción
function limpiarCamposContactoSusc() { nombreSusc.value = ''; correoSusc.value = ''; errorDivNomSusc.style.display = 'none'; nombreSusc.style.border = 'none'; errorDivCorSusc.style.display = 'none'; correoSusc.style.border = 'none'; }
[ "function", "limpiarCamposContactoSusc", "(", ")", "{", "nombreSusc", ".", "value", "=", "''", ";", "correoSusc", ".", "value", "=", "''", ";", "errorDivNomSusc", ".", "style", ".", "display", "=", "'none'", ";", "nombreSusc", ".", "style", ".", "border", "=", "'none'", ";", "errorDivCorSusc", ".", "style", ".", "display", "=", "'none'", ";", "correoSusc", ".", "style", ".", "border", "=", "'none'", ";", "}" ]
[ 405, 8 ]
[ 415, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
list
(req, res, next)
null
implenetacion de funciones
implenetacion de funciones
function list(req, res, next){ controller.list() .then((lista) => { response.success(req, res,lista,200) }).catch(next) }
[ "function", "list", "(", "req", ",", "res", ",", "next", ")", "{", "controller", ".", "list", "(", ")", ".", "then", "(", "(", "lista", ")", "=>", "{", "response", ".", "success", "(", "req", ",", "res", ",", "lista", ",", "200", ")", "}", ")", ".", "catch", "(", "next", ")", "}" ]
[ 14, 0 ]
[ 19, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
deletePublication
(req, res)
null
Eliminar una publicación
Eliminar una publicación
function deletePublication(req, res){ var publicationId = req.params.id; Publication.find({user: req.user.sub, '_id': publicationId}).remove(err => { if(err) return res.status(500).send({message: 'Error al borrar la publicación.'}); return res.status(200).send({publication: 'Publicación eliminada correctamente'}); }); }
[ "function", "deletePublication", "(", "req", ",", "res", ")", "{", "var", "publicationId", "=", "req", ".", "params", ".", "id", ";", "Publication", ".", "find", "(", "{", "user", ":", "req", ".", "user", ".", "sub", ",", "'_id'", ":", "publicationId", "}", ")", ".", "remove", "(", "err", "=>", "{", "if", "(", "err", ")", "return", "res", ".", "status", "(", "500", ")", ".", "send", "(", "{", "message", ":", "'Error al borrar la publicación.'}", ")", ";", "", "return", "res", ".", "status", "(", "200", ")", ".", "send", "(", "{", "publication", ":", "'Publicación eliminada correctamente'}", ")", ";", "", "}", ")", ";", "}" ]
[ 74, 0 ]
[ 80, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
borrar_cache
()
null
Borramos el cache
Borramos el cache
function borrar_cache(){ if (localStorage.getItem("eltitulo")) { localStorage.removeItem("eltitulo"); localStorage.removeItem("la_categoria"); localStorage.removeItem("la_descripcion"); localStorage.removeItem("highlight"); localStorage.removeItem("urgente"); } }
[ "function", "borrar_cache", "(", ")", "{", "if", "(", "localStorage", ".", "getItem", "(", "\"eltitulo\"", ")", ")", "{", "localStorage", ".", "removeItem", "(", "\"eltitulo\"", ")", ";", "localStorage", ".", "removeItem", "(", "\"la_categoria\"", ")", ";", "localStorage", ".", "removeItem", "(", "\"la_descripcion\"", ")", ";", "localStorage", ".", "removeItem", "(", "\"highlight\"", ")", ";", "localStorage", ".", "removeItem", "(", "\"urgente\"", ")", ";", "}", "}" ]
[ 62, 0 ]
[ 74, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
preload
()
null
1. Cargar el video
1. Cargar el video
function preload() { classifier = ml5.soundClassifier(modelURL + 'model.json'); }
[ "function", "preload", "(", ")", "{", "classifier", "=", "ml5", ".", "soundClassifier", "(", "modelURL", "+", "'model.json'", ")", ";", "}" ]
[ 6, 0 ]
[ 8, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getPublication
(req, res)
null
Devolver una publicación
Devolver una publicación
function getPublication(req, res){ var publicationId = req.params.id; Publication.findById(publicationId, (err, publication) => { if(err) return res.status(500).send({message: 'Error al devolver la publicación.'}); if(!publication) return res.status(404).send({message: 'La publicación no existe.'}); return res.status(200).send({publication}); }); }
[ "function", "getPublication", "(", "req", ",", "res", ")", "{", "var", "publicationId", "=", "req", ".", "params", ".", "id", ";", "Publication", ".", "findById", "(", "publicationId", ",", "(", "err", ",", "publication", ")", "=>", "{", "if", "(", "err", ")", "return", "res", ".", "status", "(", "500", ")", ".", "send", "(", "{", "message", ":", "'Error al devolver la publicación.'}", ")", ";", "", "if", "(", "!", "publication", ")", "return", "res", ".", "status", "(", "404", ")", ".", "send", "(", "{", "message", ":", "'La publicación no existe.'}", ")", ";", "", "return", "res", ".", "status", "(", "200", ")", ".", "send", "(", "{", "publication", "}", ")", ";", "}", ")", ";", "}" ]
[ 64, 0 ]
[ 71, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getFirstCard
(rule, deck)
null
Función para tomar el index de una carta que cumpla con la regla
Función para tomar el index de una carta que cumpla con la regla
function getFirstCard(rule, deck) { var first_card_validity = false; while (!(first_card_validity)) { if (rule[0] == 0) { index = Math.floor(Math.random() * (deck.length)); var card = deck[index]; var card_symbol = card.getSymbol(); first_card_validity = verify_First(rule, card_symbol); } else { index = Math.floor(Math.random() * (deck.length)); var card = deck[index]; var card_number = card.getValue(); first_card_validity = verify_First(rule, card_number); } } return index; }
[ "function", "getFirstCard", "(", "rule", ",", "deck", ")", "{", "var", "first_card_validity", "=", "false", ";", "while", "(", "!", "(", "first_card_validity", ")", ")", "{", "if", "(", "rule", "[", "0", "]", "==", "0", ")", "{", "index", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "deck", ".", "length", ")", ")", ";", "var", "card", "=", "deck", "[", "index", "]", ";", "var", "card_symbol", "=", "card", ".", "getSymbol", "(", ")", ";", "first_card_validity", "=", "verify_First", "(", "rule", ",", "card_symbol", ")", ";", "}", "else", "{", "index", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "deck", ".", "length", ")", ")", ";", "var", "card", "=", "deck", "[", "index", "]", ";", "var", "card_number", "=", "card", ".", "getValue", "(", ")", ";", "first_card_validity", "=", "verify_First", "(", "rule", ",", "card_number", ")", ";", "}", "}", "return", "index", ";", "}" ]
[ 339, 0 ]
[ 356, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setup
()
null
presionar el ratón cambiará el estado de grabar, a parar y a reproducir
presionar el ratón cambiará el estado de grabar, a parar y a reproducir
function setup() { createCanvas(400, 400); background(200); fill(0); text('Enable mic and click the mouse to begin recording', 20, 20); // crear una entrada de audio mic = new p5.AudioIn(); // los usuarios deben manualmente permitir en su navegador que el micrófono funcione para que la grabación funcione de manera correcta mic.start(); // crear un nuevo grabador de sonido recorder = new p5.SoundRecorder(); // conectar el micrófono al grabador recorder.setInput(mic); // crear un archivo de audio vacío que será usado para la reproducción de la grabación soundFile = new p5.SoundFile(); }
[ "function", "setup", "(", ")", "{", "createCanvas", "(", "400", ",", "400", ")", ";", "background", "(", "200", ")", ";", "fill", "(", "0", ")", ";", "text", "(", "'Enable mic and click the mouse to begin recording'", ",", "20", ",", "20", ")", ";", "// crear una entrada de audio", "mic", "=", "new", "p5", ".", "AudioIn", "(", ")", ";", "// los usuarios deben manualmente permitir en su navegador que el micrófono funcione para que la grabación funcione de manera correcta", "mic", ".", "start", "(", ")", ";", "// crear un nuevo grabador de sonido", "recorder", "=", "new", "p5", ".", "SoundRecorder", "(", ")", ";", "// conectar el micrófono al grabador", "recorder", ".", "setInput", "(", "mic", ")", ";", "// crear un archivo de audio vacío que será usado para la reproducción de la grabación", "soundFile", "=", "new", "p5", ".", "SoundFile", "(", ")", ";", "}" ]
[ 15, 0 ]
[ 35, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
format
( d )
null
Para llevar el control de peticiones ajax en el action del button statistics /* --- Extra functions ---
Para llevar el control de peticiones ajax en el action del button statistics /* --- Extra functions ---
function format ( d ){ var rows = ''; d.forEach(function (item, index, array) { var packet_information = '<tr><td><b>Tag</b>:</td><td>'+item['Tag']+'</td><td><b>Description</b>:</td><td>'+item['Description']+'</td><td><b>Value</b>:</td><td>'+item['Value']+'</td></tr>'; rows = rows + packet_information; }); return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;" width=100%>'+ rows+ '</table>'; }
[ "function", "format", "(", "d", ")", "{", "var", "rows", "=", "''", ";", "d", ".", "forEach", "(", "function", "(", "item", ",", "index", ",", "array", ")", "{", "var", "packet_information", "=", "'<tr><td><b>Tag</b>:</td><td>'", "+", "item", "[", "'Tag'", "]", "+", "'</td><td><b>Description</b>:</td><td>'", "+", "item", "[", "'Description'", "]", "+", "'</td><td><b>Value</b>:</td><td>'", "+", "item", "[", "'Value'", "]", "+", "'</td></tr>'", ";", "rows", "=", "rows", "+", "packet_information", ";", "}", ")", ";", "return", "'<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" style=\"padding-left:50px;\" width=100%>'", "+", "rows", "+", "'</table>'", ";", "}" ]
[ 5, 0 ]
[ 17, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
loadMessages
(callback)
null
Carga de mensajes desde servidor
Carga de mensajes desde servidor
function loadMessages(callback) { $.ajax({ url: '/messages' }).done(function (message) { callback(message); }) }
[ "function", "loadMessages", "(", "callback", ")", "{", "$", ".", "ajax", "(", "{", "url", ":", "'/messages'", "}", ")", ".", "done", "(", "function", "(", "message", ")", "{", "callback", "(", "message", ")", ";", "}", ")", "}" ]
[ 1, 0 ]
[ 7, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
sendDocument
(msg, document, name, replyTo=false)
null
TODO: Cambiar gestión de nombre Sends document to a Telegram chat represented in msg object @param {object} msg Telegram API message resource @param {File} document Google Drive File object of the document to send @param {string} name Name of the document to send @param {boolean} replyTo True if the message to send is a reply to the provided message @return {object} JSON response returned by Telegram API
TODO: Cambiar gestión de nombre Sends document to a Telegram chat represented in msg object
function sendDocument(msg, document, name, replyTo=false) { let payload = { 'method': 'sendDocument', 'chat_id': String(msg['chat']['id']), 'document': document.getBlob().setName(name) } if(replyTo) { payload['reply_to_message_id'] = String(msg['message_id']); } let data = { 'method': 'POST', 'payload': payload, 'muteHttpExceptions': true } return JSON.parse(UrlFetchApp.fetch(apiTelegramBotBaseUrl + apiToken + '/', data).getContentText()); }
[ "function", "sendDocument", "(", "msg", ",", "document", ",", "name", ",", "replyTo", "=", "false", ")", "{", "let", "payload", "=", "{", "'method'", ":", "'sendDocument'", ",", "'chat_id'", ":", "String", "(", "msg", "[", "'chat'", "]", "[", "'id'", "]", ")", ",", "'document'", ":", "document", ".", "getBlob", "(", ")", ".", "setName", "(", "name", ")", "}", "if", "(", "replyTo", ")", "{", "payload", "[", "'reply_to_message_id'", "]", "=", "String", "(", "msg", "[", "'message_id'", "]", ")", ";", "}", "let", "data", "=", "{", "'method'", ":", "'POST'", ",", "'payload'", ":", "payload", ",", "'muteHttpExceptions'", ":", "true", "}", "return", "JSON", ".", "parse", "(", "UrlFetchApp", ".", "fetch", "(", "apiTelegramBotBaseUrl", "+", "apiToken", "+", "'/'", ",", "data", ")", ".", "getContentText", "(", ")", ")", ";", "}" ]
[ 147, 0 ]
[ 165, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
clearScreen
()
null
Función para limpiar la pantalla
Función para limpiar la pantalla
function clearScreen() { background(127); }
[ "function", "clearScreen", "(", ")", "{", "background", "(", "127", ")", ";", "}" ]
[ 40, 0 ]
[ 42, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(data)
null
aqui enviamos los datos a la url, ejemplo nombreVariable:variable
aqui enviamos los datos a la url, ejemplo nombreVariable:variable
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", "(", "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", "}" ]
[ 400, 21 ]
[ 404, 13 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
readTodoList
()
null
Devolver un objecto con la todoList guardada o si no hay un objecto inicial
Devolver un objecto con la todoList guardada o si no hay un objecto inicial
async function readTodoList() { try { await fs.ensureFile(todoFile); const currentTodos = await fs.readFile(todoFile, "utf-8"); if (currentTodos) { return JSON.parse(currentTodos); } return { tasks: [], }; console.log("Current", currentTodos); } catch (error) { console.error(error); } }
[ "async", "function", "readTodoList", "(", ")", "{", "try", "{", "await", "fs", ".", "ensureFile", "(", "todoFile", ")", ";", "const", "currentTodos", "=", "await", "fs", ".", "readFile", "(", "todoFile", ",", "\"utf-8\"", ")", ";", "if", "(", "currentTodos", ")", "{", "return", "JSON", ".", "parse", "(", "currentTodos", ")", ";", "}", "return", "{", "tasks", ":", "[", "]", ",", "}", ";", "console", ".", "log", "(", "\"Current\"", ",", "currentTodos", ")", ";", "}", "catch", "(", "error", ")", "{", "console", ".", "error", "(", "error", ")", ";", "}", "}" ]
[ 34, 0 ]
[ 52, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(c)
null
c = Socket que representa la conexión con el cliente
c = Socket que representa la conexión con el cliente
function (c) { // Connection listener console.log('Server connected'); c.on('end', () => console.log('Cliente desconectado')); c.on('error', () => console.log('Error de conexión')); c.on('data', function (data) { console.log('Datos del cliente: ' + data.toString()); c.write(data); } ); }
[ "function", "(", "c", ")", "{", "// Connection listener ", "console", ".", "log", "(", "'Server connected'", ")", ";", "c", ".", "on", "(", "'end'", ",", "(", ")", "=>", "console", ".", "log", "(", "'Cliente desconectado'", ")", ")", ";", "c", ".", "on", "(", "'error'", ",", "(", ")", "=>", "console", ".", "log", "(", "'Error de conexión')", ")", ";", "", "c", ".", "on", "(", "'data'", ",", "function", "(", "data", ")", "{", "console", ".", "log", "(", "'Datos del cliente: '", "+", "data", ".", "toString", "(", ")", ")", ";", "c", ".", "write", "(", "data", ")", ";", "}", ")", ";", "}" ]
[ 6, 4 ]
[ 16, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
arguments
reset
()
null
Reiniciar todos los objetos Mover aleatoriamente
Reiniciar todos los objetos Mover aleatoriamente
function reset() { for (let i = 0; i < 9; i++) { movers[i] = new Mover(random(0.5, 3), 40 + i * 70, 0); } }
[ "function", "reset", "(", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "9", ";", "i", "++", ")", "{", "movers", "[", "i", "]", "=", "new", "Mover", "(", "random", "(", "0.5", ",", "3", ")", ",", "40", "+", "i", "*", "70", ",", "0", ")", ";", "}", "}" ]
[ 58, 0 ]
[ 62, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
ruta
(ruta, form)
null
/* carga la ruta enviada; si "form" está definida envia mediante Post el contenido del formulario: form
/* carga la ruta enviada; si "form" está definida envia mediante Post el contenido del formulario: form
function ruta(ruta, form) { var data_post; $('#content').html('<div align="center"><img src="'+ baseurl + 'assets/img/tenor.gif" alt="loading" style="margin-top: 100px"/></div>'); if(valor_variable(form)){ data_post = $('#' + form).serialize(); } $.ajax({ cache: false, url: php_baseurl + ruta, type: 'POST', data: data_post, success: function (response) { $('#content').html(response); } }); }
[ "function", "ruta", "(", "ruta", ",", "form", ")", "{", "var", "data_post", ";", "$", "(", "'#content'", ")", ".", "html", "(", "'<div align=\"center\"><img src=\"'", "+", "baseurl", "+", "'assets/img/tenor.gif\" alt=\"loading\" style=\"margin-top: 100px\"/></div>'", ")", ";", "if", "(", "valor_variable", "(", "form", ")", ")", "{", "data_post", "=", "$", "(", "'#'", "+", "form", ")", ".", "serialize", "(", ")", ";", "}", "$", ".", "ajax", "(", "{", "cache", ":", "false", ",", "url", ":", "php_baseurl", "+", "ruta", ",", "type", ":", "'POST'", ",", "data", ":", "data_post", ",", "success", ":", "function", "(", "response", ")", "{", "$", "(", "'#content'", ")", ".", "html", "(", "response", ")", ";", "}", "}", ")", ";", "}" ]
[ 84, 0 ]
[ 99, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
cambiarUnidades
(id, what, howmuch, min)
null
Suma o resta unidades totales en el carrito y la chapa del icono del carrito, en caso de no superar el minimo o no haber productos, esconde los objetos creados al añadir un producto
Suma o resta unidades totales en el carrito y la chapa del icono del carrito, en caso de no superar el minimo o no haber productos, esconde los objetos creados al añadir un producto
function cambiarUnidades(id, what, howmuch, min) { var cambio = "#cambiar" + id; if (what == 0) { let numProd = Number.parseInt($(cambio).text() - howmuch); if (numProd >= min) { $(cambio).text(numProd); let totalProductos = Number.parseInt($('#numeroProductosCarrito').text(), 10) - howmuch; $("#numeroProductosCarrito").replaceWith("<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>" + totalProductos + "</span>"); } else { let totalProductos = Number.parseInt($('#numeroProductosCarrito').text(), 10) - (numProd + howmuch); $("#numeroProductosCarrito").replaceWith("<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>" + totalProductos + "</span>"); $("#eliminar" + id).remove(); if ($("#numeroProductosCarrito").text() <= 0) { $("#carritoLista").append("<li id='noProductos' class='p-4 list-group-item item-deparation' style='border: none!important;'>No tienes ningun producto</li>"); $("#carritoLista").addClass("card"); $("#carritobtn").hide(); $('#scroller').fadeOut("slow"); } } } else { $(cambio).text(Number.parseInt($(cambio).text()) + Number.parseInt(howmuch)); let totalProductos = Number.parseInt($('#numeroProductosCarrito').text(), 10) + Number.parseInt(howmuch); $("#numeroProductosCarrito").replaceWith("<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>" + totalProductos + "</span>"); } actualizarCookie(); }
[ "function", "cambiarUnidades", "(", "id", ",", "what", ",", "howmuch", ",", "min", ")", "{", "var", "cambio", "=", "\"#cambiar\"", "+", "id", ";", "if", "(", "what", "==", "0", ")", "{", "let", "numProd", "=", "Number", ".", "parseInt", "(", "$", "(", "cambio", ")", ".", "text", "(", ")", "-", "howmuch", ")", ";", "if", "(", "numProd", ">=", "min", ")", "{", "$", "(", "cambio", ")", ".", "text", "(", "numProd", ")", ";", "let", "totalProductos", "=", "Number", ".", "parseInt", "(", "$", "(", "'#numeroProductosCarrito'", ")", ".", "text", "(", ")", ",", "10", ")", "-", "howmuch", ";", "$", "(", "\"#numeroProductosCarrito\"", ")", ".", "replaceWith", "(", "\"<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>\"", "+", "totalProductos", "+", "\"</span>\"", ")", ";", "}", "else", "{", "let", "totalProductos", "=", "Number", ".", "parseInt", "(", "$", "(", "'#numeroProductosCarrito'", ")", ".", "text", "(", ")", ",", "10", ")", "-", "(", "numProd", "+", "howmuch", ")", ";", "$", "(", "\"#numeroProductosCarrito\"", ")", ".", "replaceWith", "(", "\"<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>\"", "+", "totalProductos", "+", "\"</span>\"", ")", ";", "$", "(", "\"#eliminar\"", "+", "id", ")", ".", "remove", "(", ")", ";", "if", "(", "$", "(", "\"#numeroProductosCarrito\"", ")", ".", "text", "(", ")", "<=", "0", ")", "{", "$", "(", "\"#carritoLista\"", ")", ".", "append", "(", "\"<li id='noProductos' class='p-4 list-group-item item-deparation' style='border: none!important;'>No tienes ningun producto</li>\"", ")", ";", "$", "(", "\"#carritoLista\"", ")", ".", "addClass", "(", "\"card\"", ")", ";", "$", "(", "\"#carritobtn\"", ")", ".", "hide", "(", ")", ";", "$", "(", "'#scroller'", ")", ".", "fadeOut", "(", "\"slow\"", ")", ";", "}", "}", "}", "else", "{", "$", "(", "cambio", ")", ".", "text", "(", "Number", ".", "parseInt", "(", "$", "(", "cambio", ")", ".", "text", "(", ")", ")", "+", "Number", ".", "parseInt", "(", "howmuch", ")", ")", ";", "let", "totalProductos", "=", "Number", ".", "parseInt", "(", "$", "(", "'#numeroProductosCarrito'", ")", ".", "text", "(", ")", ",", "10", ")", "+", "Number", ".", "parseInt", "(", "howmuch", ")", ";", "$", "(", "\"#numeroProductosCarrito\"", ")", ".", "replaceWith", "(", "\"<span id='numeroProductosCarrito' class='badge badge-dark badge-pill badge-position'>\"", "+", "totalProductos", "+", "\"</span>\"", ")", ";", "}", "actualizarCookie", "(", ")", ";", "}" ]
[ 41, 0 ]
[ 69, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
registrar_MedioVerificacion
()
null
funcion para registar medio de verificacion
funcion para registar medio de verificacion
function registrar_MedioVerificacion(){ var token = new $('#token').val(); var datos = new FormData($("#frmIngresarMedioVerificacion")[0]); $.ajax({ url:"/app/medioVerificacion", 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("Medio de verificacion Registrado Correctamente..!!", "", "success"); document.getElementById("frmIngresarMedioVerificacion").reset(); $("#myModal_IngresarMedioVerificacion").modal("hide"); $("#datatable").load("/lista_medioVerificacion"); } } }); }
[ "function", "registrar_MedioVerificacion", "(", ")", "{", "var", "token", "=", "new", "$", "(", "'#token'", ")", ".", "val", "(", ")", ";", "var", "datos", "=", "new", "FormData", "(", "$", "(", "\"#frmIngresarMedioVerificacion\"", ")", "[", "0", "]", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "\"/app/medioVerificacion\"", ",", "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", "(", "\"Medio de verificacion Registrado Correctamente..!!\"", ",", "\"\"", ",", "\"success\"", ")", ";", "document", ".", "getElementById", "(", "\"frmIngresarMedioVerificacion\"", ")", ".", "reset", "(", ")", ";", "$", "(", "\"#myModal_IngresarMedioVerificacion\"", ")", ".", "modal", "(", "\"hide\"", ")", ";", "$", "(", "\"#datatable\"", ")", ".", "load", "(", "\"/lista_medioVerificacion\"", ")", ";", "}", "}", "}", ")", ";", "}" ]
[ 65, 0 ]
[ 88, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
enviarDatos
()
null
/*Envia los datos de las posiciones y de la velocidad
/*Envia los datos de las posiciones y de la velocidad
function enviarDatos(){ var datos = '\"WEB_1\".'+"POSITION_1"+"="+document.getElementById("position1").value+"&"+'\"WEB_1\".'+"POSITION_2"+"="+document.getElementById("position2").value +"&"+'\"WEB_1\".'+"POSITION_3"+"="+document.getElementById("position3").value+"&" +'\"WEB_1\".'+"POSITION_4"+"="+document.getElementById("position4").value+"&"+'\"WEB_1\".'+"SPEED_1" +"="+document.getElementById("speed").value; //alert(datos); $($.ajax({ method:'POST', data:datos, success: function(datos){ console.log("funciona, el valor que se ha enviado es \n"+datos); }, error: function(){ console.log("errores"); } })) }
[ "function", "enviarDatos", "(", ")", "{", "var", "datos", "=", "'\\\"WEB_1\\\".'", "+", "\"POSITION_1\"", "+", "\"=\"", "+", "document", ".", "getElementById", "(", "\"position1\"", ")", ".", "value", "+", "\"&\"", "+", "'\\\"WEB_1\\\".'", "+", "\"POSITION_2\"", "+", "\"=\"", "+", "document", ".", "getElementById", "(", "\"position2\"", ")", ".", "value", "+", "\"&\"", "+", "'\\\"WEB_1\\\".'", "+", "\"POSITION_3\"", "+", "\"=\"", "+", "document", ".", "getElementById", "(", "\"position3\"", ")", ".", "value", "+", "\"&\"", "+", "'\\\"WEB_1\\\".'", "+", "\"POSITION_4\"", "+", "\"=\"", "+", "document", ".", "getElementById", "(", "\"position4\"", ")", ".", "value", "+", "\"&\"", "+", "'\\\"WEB_1\\\".'", "+", "\"SPEED_1\"", "+", "\"=\"", "+", "document", ".", "getElementById", "(", "\"speed\"", ")", ".", "value", ";", "//alert(datos);", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "datos", ",", "success", ":", "function", "(", "datos", ")", "{", "console", ".", "log", "(", "\"funciona, el valor que se ha enviado es \\n\"", "+", "datos", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "}" ]
[ 17, 0 ]
[ 33, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
1. Creación de un objeto vacío
1. Creación de un objeto vacío
function() {}
[ "function", "(", ")", "{", "}" ]
[ 46, 13 ]
[ 46, 26 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
(id_user, mapa)
null
indico color del pais y el estado del mapa para obtener posibles convinaciones de ataque Salida: [{atacante: Uruguay, defensor: Brasil},{atacante: Uruguay, defensor: Peru}]
indico color del pais y el estado del mapa para obtener posibles convinaciones de ataque Salida: [{atacante: Uruguay, defensor: Brasil},{atacante: Uruguay, defensor: Peru}]
function (id_user, mapa){ var posiblesAtaques = [] this.getPaisesConCapacidadDeAtaque(id_user, mapa).forEach(pais => { f_paises.get_limitrofes(pais).forEach(victima => { if (mapa[victima].owner != id_user){ posiblesAtaques.push({'atacante': pais, 'defensor': victima}); } }); }); return posiblesAtaques; }
[ "function", "(", "id_user", ",", "mapa", ")", "{", "var", "posiblesAtaques", "=", "[", "]", "this", ".", "getPaisesConCapacidadDeAtaque", "(", "id_user", ",", "mapa", ")", ".", "forEach", "(", "pais", "=>", "{", "f_paises", ".", "get_limitrofes", "(", "pais", ")", ".", "forEach", "(", "victima", "=>", "{", "if", "(", "mapa", "[", "victima", "]", ".", "owner", "!=", "id_user", ")", "{", "posiblesAtaques", ".", "push", "(", "{", "'atacante'", ":", "pais", ",", "'defensor'", ":", "victima", "}", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "posiblesAtaques", ";", "}" ]
[ 47, 24 ]
[ 58, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
clickAnimal
(id)
null
Redirige el a la página de detalles del producto
Redirige el a la página de detalles del producto
function clickAnimal(id){ location.href='/animal/'+id; }
[ "function", "clickAnimal", "(", "id", ")", "{", "location", ".", "href", "=", "'/animal/'", "+", "id", ";", "}" ]
[ 27, 4 ]
[ 29, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
convertir_cadena
(data)
null
convierte una cadena a un JSON
convierte una cadena a un JSON
function convertir_cadena(data){ data_json=[] let data_separada = [] data = data.split("\n") let data_clean=[] for(let i in data){ data_separada.push(data[i].split(" ")) } for(let i in data_separada){ data_clean.push(data_separada[i].filter(Boolean)) } data_clean.reduce((acumulador,actual,indice, array )=>{ let cadena = "" for(let i in acumulador){ if(i==0){ cadena+="{" } cadena += `"${acumulador[i]}":"${actual[i]}"`; if(i!=(acumulador.length-1)){ cadena+="," } if(i==(acumulador.length-1)){ cadena+="}" } } data_json.push(JSON.parse(cadena)) return acumulador }) return data_json }
[ "function", "convertir_cadena", "(", "data", ")", "{", "data_json", "=", "[", "]", "let", "data_separada", "=", "[", "]", "data", "=", "data", ".", "split", "(", "\"\\n\"", ")", "let", "data_clean", "=", "[", "]", "for", "(", "let", "i", "in", "data", ")", "{", "data_separada", ".", "push", "(", "data", "[", "i", "]", ".", "split", "(", "\" \"", ")", ")", "}", "for", "(", "let", "i", "in", "data_separada", ")", "{", "data_clean", ".", "push", "(", "data_separada", "[", "i", "]", ".", "filter", "(", "Boolean", ")", ")", "}", "data_clean", ".", "reduce", "(", "(", "acumulador", ",", "actual", ",", "indice", ",", "array", ")", "=>", "{", "let", "cadena", "=", "\"\"", "for", "(", "let", "i", "in", "acumulador", ")", "{", "if", "(", "i", "==", "0", ")", "{", "cadena", "+=", "\"{\"", "}", "cadena", "+=", "`", "${", "acumulador", "[", "i", "]", "}", "${", "actual", "[", "i", "]", "}", "`", ";", "if", "(", "i", "!=", "(", "acumulador", ".", "length", "-", "1", ")", ")", "{", "cadena", "+=", "\",\"", "}", "if", "(", "i", "==", "(", "acumulador", ".", "length", "-", "1", ")", ")", "{", "cadena", "+=", "\"}\"", "}", "}", "data_json", ".", "push", "(", "JSON", ".", "parse", "(", "cadena", ")", ")", "return", "acumulador", "}", ")", "return", "data_json", "}" ]
[ 62, 0 ]
[ 93, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
renderOptions
(data)
null
Renderiza las opciones del combo Tamaño Sandwich
Renderiza las opciones del combo Tamaño Sandwich
function renderOptions(data) { return ( data.map((prop, key) => { return ( <option key={key}> {prop.tamano_sandwich} </option> ); }) ); }
[ "function", "renderOptions", "(", "data", ")", "{", "return", "(", "data", ".", "map", "(", "(", "prop", ",", "key", ")", "=>", "{", "return", "(", "<", "option", "key", "=", "{", "key", "}", ">", "\n ", "{", "prop", ".", "tamano_sandwich", "}", "\n ", "<", "/", "option", ">", ")", ";", "}", ")", ")", ";", "}" ]
[ 110, 2 ]
[ 120, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
tablaresultadospedido
(lim)
null
Tabla resultados de la busqueda en el index de articulo
Tabla resultados de la busqueda en el index de articulo
function tablaresultadospedido(lim){ var controlador = ""; var parametro = ""; var base_url = document.getElementById('base_url').value; var categoriaestado = ""; if(lim == 1){ controlador = base_url+'pedido/buscarpedidoall/'; }else if(lim == 2){ var unidad_id = document.getElementById('unidad_id').value; var programa_id = document.getElementById('programa_id').value; var estado_id = document.getElementById('estado_id').value; if(unidad_id == 0){ categoriaestado += ""; }else{ categoriaestado += " and p.unidad_id = u.unidad_id and p.unidad_id = "+unidad_id+" "; } if(programa_id == 0){ categoriaestado += ""; }else{ categoriaestado += " and p.programa_id = pr.programa_id and p.programa_id = "+programa_id+" "; /*zonatext = $('select[name="zona_id"] option:selected').text(); zonatext = "Zona: "+zonatext;*/ } if(estado_id == 0){ categoriaestado += ""; }else{ categoriaestado += " and p.estado_id = "+estado_id+" "; /*categoriatext = $('select[name="categoriaclie_id"] option:selected').text(); categoriatext = "Categoria: "+categoriatext;*/ } } parametro = document.getElementById('filtrar').value; controlador = base_url+'pedido/buscarpedidosall/'; document.getElementById('loader').style.display = 'block'; //muestra el bloque del loader $.ajax({url: controlador, type:"POST", data:{parametro:parametro, categoria:categoriaestado}, success:function(respuesta){ $("#encontrados").val("- 0 -"); var registros = JSON.parse(respuesta); if (registros != null){ var n = registros.length; //tamaño del arreglo de la consulta $("#encontrados").val("- "+n+" -"); html = ""; /*if (n <= limite) x = n; else x = limite;*/ for (var i = 0; i < n ; i++){ var colorbaja = "style='background-color:"+registros[i]["estado_color"]+"'"; html += "<tr "+colorbaja+" class='no-margin'>"; html += "<td>"+(i+1)+"</td>"; html += "<td>"; html += "<font size='3'><b>"+registros[i]["unidad_nombre"]+"</b></font>"; var programa_nombre = ""; if(registros[i]["programa_nombre"] != null && registros[i]["programa_nombre"] != ""){ programa_nombre = registros[i]["programa_nombre"]; } html += "<br>"+programa_nombre; html += "</td>"; html += "<td style='text-align: center'>"; html += "<font size='3'><b>"+registros[i]["pedido_numero"]+"</b></font>"; html += "<br>"+moment(registros[i]["pedido_fechapedido"]).format("DD/MM/YYYY"); html += "</td>"; html += "<td style='text-align: center'>"; html += moment(registros[i]["pedido_fecha"]).format("DD/MM/YYYY")+"<br>"; html += registros[i]["pedido_hora"]; html += "</td>"; html += "<td class='no-print'>"; if(registros[i]["pedido_archivo"]){ html += "<a href='"+base_url+"resources/images/pedidos/archivos/"+registros[i]["pedido_archivo"]+"' target='_blank' class='no-print'>"+registros[i]["pedido_archivo"]+"</a>"; } html += "</td>"; html += "<td class='no-print'>"; html += "<div id='contieneimg'>"; var mimagen = "thumb_"+registros[i]["pedido_imagen"]; if(registros[i]["pedido_imagen"]){ html += "<a class='btn btn-xs' data-toggle='modal' data-target='#mostrarimagen"+i+"' style='padding: 0px;'>"; html += "<img src='"+base_url+"resources/images/pedidos/imagenes/"+mimagen+"' />"; html += "</a>"; } html += "</div>"; html += "</td>"; html += "<td style='text-align: center'>"; html += registros[i]["gestion_nombre"]+"<br>"; html += registros[i]["estado_descripcion"]; html += "</td>"; html += "<td class='no-print'>"; //if(registros[i]["estado_id"] == 6){ html += "<a href='"+base_url+"pedido/edit/"+registros[i]["pedido_id"]+"' class='btn btn-info btn-xs' title='Editar'><span class='fa fa-pencil'></span></a>"; html += "<a data-toggle='modal' data-target='#myModal"+registros[i]["pedido_id"]+"' title='Eliminar' class='btn btn-danger btn-xs'><span class='fa fa-trash'></span></a>"; //} html += "<!-- ---------------------- INICIO modal para confirmar eliminación ----------------- -->"; html += "<div class='modal fade' id='myModal"+registros[i]["pedido_id"]+"' tabindex='-1' role='dialog' aria-labelledby='myModalLabel"+registros[i]["pedido_id"]+"'>"; html += "<div class='modal-dialog' role='document'>"; html += "<br><br>"; html += "<div class='modal-content'>"; html += "<div class='modal-header'>"; html += "<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>x</span></button>"; html += "</div>"; html += "<div class='modal-body'>"; html += "<!------------------------------------------------------------------->"; html += "<h3><span class='fa fa-trash'></span>"; html += "¿Desea eliminar el Pedido "+registros[i]["pedido_numero"]+"?"; html += "</h3>"; html += "<!-- --------------------------------------------------------------- -->"; html += "</div>"; html += "<div class='modal-footer aligncenter'>"; html += "<a onclick='eliminarpedido("+registros[i]["pedido_id"]+")' class='btn btn-success'><span class='fa fa-check'></span> Si </a>"; html += "<a href='#' class='btn btn-danger' data-dismiss='modal'><span class='fa fa-times'></span> No </a>"; html += "</div>"; html += "</div>"; html += "</div>"; html += "</div>"; html += "<!-- ---------------------- FIN modal para confirmar eliminación ----------------- -->"; html += "<!-- ---------------------- INICIO modal para MOSTRAR imagen REAL ----------------- -->"; html += "<div class='modal fade' id='mostrarimagen"+i+"' tabindex='-1' role='dialog' aria-labelledby='mostrarimagenlabel"+i+"'>"; html += "<div class='modal-dialog' role='document'>"; html += "<br><br>"; html += "<div class='modal-content'>"; html += "<div class='modal-header'>"; html += "<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>x</span></button>"; html += "<font size='3'><b>"+registros[i]["pedido_numero"]+"</b></font>"; html += "</div>"; html += "<div class='modal-body'>"; html += "<!-- --------------------------------------------------------------- -->"; html += "'<img style='max-height: 100%; max-width: 100%' src='"+base_url+"resources/images/pedidos/imagenes/"+registros[i]["pedido_imagen"]+"' />"; html += "<!-- --------------------------------------------------------------- -->"; html += "</div>"; html += "</div>"; html += "</div>"; html += "</div>"; html += "<!-- ---------------------- FIN modal para MOSTRAR imagen REAL ----------------- -->"; html += "</td>"; html += "</tr>"; } $("#tablaresultados").html(html); document.getElementById('loader').style.display = 'none'; } document.getElementById('loader').style.display = 'none'; //ocultar el bloque del loader }, error:function(respuesta){ // alert("Algo salio mal...!!!"); html = ""; $("#tablaresultados").html(html); }, complete: function (jqXHR, textStatus) { document.getElementById('loader').style.display = 'none'; //ocultar el bloque del loader //tabla_inventario(); } }); }
[ "function", "tablaresultadospedido", "(", "lim", ")", "{", "var", "controlador", "=", "\"\"", ";", "var", "parametro", "=", "\"\"", ";", "var", "base_url", "=", "document", ".", "getElementById", "(", "'base_url'", ")", ".", "value", ";", "var", "categoriaestado", "=", "\"\"", ";", "if", "(", "lim", "==", "1", ")", "{", "controlador", "=", "base_url", "+", "'pedido/buscarpedidoall/'", ";", "}", "else", "if", "(", "lim", "==", "2", ")", "{", "var", "unidad_id", "=", "document", ".", "getElementById", "(", "'unidad_id'", ")", ".", "value", ";", "var", "programa_id", "=", "document", ".", "getElementById", "(", "'programa_id'", ")", ".", "value", ";", "var", "estado_id", "=", "document", ".", "getElementById", "(", "'estado_id'", ")", ".", "value", ";", "if", "(", "unidad_id", "==", "0", ")", "{", "categoriaestado", "+=", "\"\"", ";", "}", "else", "{", "categoriaestado", "+=", "\" and p.unidad_id = u.unidad_id and p.unidad_id = \"", "+", "unidad_id", "+", "\" \"", ";", "}", "if", "(", "programa_id", "==", "0", ")", "{", "categoriaestado", "+=", "\"\"", ";", "}", "else", "{", "categoriaestado", "+=", "\" and p.programa_id = pr.programa_id and p.programa_id = \"", "+", "programa_id", "+", "\" \"", ";", "/*zonatext = $('select[name=\"zona_id\"] option:selected').text();\r\n zonatext = \"Zona: \"+zonatext;*/", "}", "if", "(", "estado_id", "==", "0", ")", "{", "categoriaestado", "+=", "\"\"", ";", "}", "else", "{", "categoriaestado", "+=", "\" and p.estado_id = \"", "+", "estado_id", "+", "\" \"", ";", "/*categoriatext = $('select[name=\"categoriaclie_id\"] option:selected').text();\r\n categoriatext = \"Categoria: \"+categoriatext;*/", "}", "}", "parametro", "=", "document", ".", "getElementById", "(", "'filtrar'", ")", ".", "value", ";", "controlador", "=", "base_url", "+", "'pedido/buscarpedidosall/'", ";", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'block'", ";", "//muestra el bloque del loader\r", "$", ".", "ajax", "(", "{", "url", ":", "controlador", ",", "type", ":", "\"POST\"", ",", "data", ":", "{", "parametro", ":", "parametro", ",", "categoria", ":", "categoriaestado", "}", ",", "success", ":", "function", "(", "respuesta", ")", "{", "$", "(", "\"#encontrados\"", ")", ".", "val", "(", "\"- 0 -\"", ")", ";", "var", "registros", "=", "JSON", ".", "parse", "(", "respuesta", ")", ";", "if", "(", "registros", "!=", "null", ")", "{", "var", "n", "=", "registros", ".", "length", ";", "//tamaño del arreglo de la consulta\r", "$", "(", "\"#encontrados\"", ")", ".", "val", "(", "\"- \"", "+", "n", "+", "\" -\"", ")", ";", "html", "=", "\"\"", ";", "/*if (n <= limite) x = n; \r\n else x = limite;*/", "for", "(", "var", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "var", "colorbaja", "=", "\"style='background-color:\"", "+", "registros", "[", "i", "]", "[", "\"estado_color\"", "]", "+", "\"'\"", ";", "html", "+=", "\"<tr \"", "+", "colorbaja", "+", "\" class='no-margin'>\"", ";", "html", "+=", "\"<td>\"", "+", "(", "i", "+", "1", ")", "+", "\"</td>\"", ";", "html", "+=", "\"<td>\"", ";", "html", "+=", "\"<font size='3'><b>\"", "+", "registros", "[", "i", "]", "[", "\"unidad_nombre\"", "]", "+", "\"</b></font>\"", ";", "var", "programa_nombre", "=", "\"\"", ";", "if", "(", "registros", "[", "i", "]", "[", "\"programa_nombre\"", "]", "!=", "null", "&&", "registros", "[", "i", "]", "[", "\"programa_nombre\"", "]", "!=", "\"\"", ")", "{", "programa_nombre", "=", "registros", "[", "i", "]", "[", "\"programa_nombre\"", "]", ";", "}", "html", "+=", "\"<br>\"", "+", "programa_nombre", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td style='text-align: center'>\"", ";", "html", "+=", "\"<font size='3'><b>\"", "+", "registros", "[", "i", "]", "[", "\"pedido_numero\"", "]", "+", "\"</b></font>\"", ";", "html", "+=", "\"<br>\"", "+", "moment", "(", "registros", "[", "i", "]", "[", "\"pedido_fechapedido\"", "]", ")", ".", "format", "(", "\"DD/MM/YYYY\"", ")", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td style='text-align: center'>\"", ";", "html", "+=", "moment", "(", "registros", "[", "i", "]", "[", "\"pedido_fecha\"", "]", ")", ".", "format", "(", "\"DD/MM/YYYY\"", ")", "+", "\"<br>\"", ";", "html", "+=", "registros", "[", "i", "]", "[", "\"pedido_hora\"", "]", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td class='no-print'>\"", ";", "if", "(", "registros", "[", "i", "]", "[", "\"pedido_archivo\"", "]", ")", "{", "html", "+=", "\"<a href='\"", "+", "base_url", "+", "\"resources/images/pedidos/archivos/\"", "+", "registros", "[", "i", "]", "[", "\"pedido_archivo\"", "]", "+", "\"' target='_blank' class='no-print'>\"", "+", "registros", "[", "i", "]", "[", "\"pedido_archivo\"", "]", "+", "\"</a>\"", ";", "}", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td class='no-print'>\"", ";", "html", "+=", "\"<div id='contieneimg'>\"", ";", "var", "mimagen", "=", "\"thumb_\"", "+", "registros", "[", "i", "]", "[", "\"pedido_imagen\"", "]", ";", "if", "(", "registros", "[", "i", "]", "[", "\"pedido_imagen\"", "]", ")", "{", "html", "+=", "\"<a class='btn btn-xs' data-toggle='modal' data-target='#mostrarimagen\"", "+", "i", "+", "\"' style='padding: 0px;'>\"", ";", "html", "+=", "\"<img src='\"", "+", "base_url", "+", "\"resources/images/pedidos/imagenes/\"", "+", "mimagen", "+", "\"' />\"", ";", "html", "+=", "\"</a>\"", ";", "}", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td style='text-align: center'>\"", ";", "html", "+=", "registros", "[", "i", "]", "[", "\"gestion_nombre\"", "]", "+", "\"<br>\"", ";", "html", "+=", "registros", "[", "i", "]", "[", "\"estado_descripcion\"", "]", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"<td class='no-print'>\"", ";", "//if(registros[i][\"estado_id\"] == 6){\r", "html", "+=", "\"<a href='\"", "+", "base_url", "+", "\"pedido/edit/\"", "+", "registros", "[", "i", "]", "[", "\"pedido_id\"", "]", "+", "\"' class='btn btn-info btn-xs' title='Editar'><span class='fa fa-pencil'></span></a>\"", ";", "html", "+=", "\"<a data-toggle='modal' data-target='#myModal\"", "+", "registros", "[", "i", "]", "[", "\"pedido_id\"", "]", "+", "\"' title='Eliminar' class='btn btn-danger btn-xs'><span class='fa fa-trash'></span></a>\"", ";", "//}\r", "html", "+=", "\"<!-- ---------------------- INICIO modal para confirmar eliminación ----------------- -->\";", "\r", "html", "+=", "\"<div class='modal fade' id='myModal\"", "+", "registros", "[", "i", "]", "[", "\"pedido_id\"", "]", "+", "\"' tabindex='-1' role='dialog' aria-labelledby='myModalLabel\"", "+", "registros", "[", "i", "]", "[", "\"pedido_id\"", "]", "+", "\"'>\"", ";", "html", "+=", "\"<div class='modal-dialog' role='document'>\"", ";", "html", "+=", "\"<br><br>\"", ";", "html", "+=", "\"<div class='modal-content'>\"", ";", "html", "+=", "\"<div class='modal-header'>\"", ";", "html", "+=", "\"<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>x</span></button>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"<div class='modal-body'>\"", ";", "html", "+=", "\"<!------------------------------------------------------------------->\"", ";", "html", "+=", "\"<h3><span class='fa fa-trash'></span>\"", ";", "html", "+=", "\"¿Desea eliminar el Pedido \"+", "r", "egistros[", "i", "]", "[", "\"", "pedido_numero\"]", "+", "\"", "?\";", "\r", "html", "+=", "\"</h3>\"", ";", "html", "+=", "\"<!-- --------------------------------------------------------------- -->\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"<div class='modal-footer aligncenter'>\"", ";", "html", "+=", "\"<a onclick='eliminarpedido(\"", "+", "registros", "[", "i", "]", "[", "\"pedido_id\"", "]", "+", "\")' class='btn btn-success'><span class='fa fa-check'></span> Si </a>\"", ";", "html", "+=", "\"<a href='#' class='btn btn-danger' data-dismiss='modal'><span class='fa fa-times'></span> No </a>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"<!-- ---------------------- FIN modal para confirmar eliminación ----------------- -->\";", "\r", "html", "+=", "\"<!-- ---------------------- INICIO modal para MOSTRAR imagen REAL ----------------- -->\"", ";", "html", "+=", "\"<div class='modal fade' id='mostrarimagen\"", "+", "i", "+", "\"' tabindex='-1' role='dialog' aria-labelledby='mostrarimagenlabel\"", "+", "i", "+", "\"'>\"", ";", "html", "+=", "\"<div class='modal-dialog' role='document'>\"", ";", "html", "+=", "\"<br><br>\"", ";", "html", "+=", "\"<div class='modal-content'>\"", ";", "html", "+=", "\"<div class='modal-header'>\"", ";", "html", "+=", "\"<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>x</span></button>\"", ";", "html", "+=", "\"<font size='3'><b>\"", "+", "registros", "[", "i", "]", "[", "\"pedido_numero\"", "]", "+", "\"</b></font>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"<div class='modal-body'>\"", ";", "html", "+=", "\"<!-- --------------------------------------------------------------- -->\"", ";", "html", "+=", "\"'<img style='max-height: 100%; max-width: 100%' src='\"", "+", "base_url", "+", "\"resources/images/pedidos/imagenes/\"", "+", "registros", "[", "i", "]", "[", "\"pedido_imagen\"", "]", "+", "\"' />\"", ";", "html", "+=", "\"<!-- --------------------------------------------------------------- -->\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"</div>\"", ";", "html", "+=", "\"<!-- ---------------------- FIN modal para MOSTRAR imagen REAL ----------------- -->\"", ";", "html", "+=", "\"</td>\"", ";", "html", "+=", "\"</tr>\"", ";", "}", "$", "(", "\"#tablaresultados\"", ")", ".", "html", "(", "html", ")", ";", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "//ocultar el bloque del loader\r", "}", ",", "error", ":", "function", "(", "respuesta", ")", "{", "// alert(\"Algo salio mal...!!!\");\r", "html", "=", "\"\"", ";", "$", "(", "\"#tablaresultados\"", ")", ".", "html", "(", "html", ")", ";", "}", ",", "complete", ":", "function", "(", "jqXHR", ",", "textStatus", ")", "{", "document", ".", "getElementById", "(", "'loader'", ")", ".", "style", ".", "display", "=", "'none'", ";", "//ocultar el bloque del loader \r", "//tabla_inventario();\r", "}", "}", ")", ";", "}" ]
[ 40, 0 ]
[ 211, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
ajax con jquery
ajax con jquery
function () { $.ajax({ url: 'views/modulos/ajax/API_estadisticas.php?action=getConteoMantenimientos', method: 'GET', success: function( response ) { console.log(response); let responseJSON = JSON.parse(response); let cantidad = responseJSON.data[0].MantPendientes; $('#countUpMeMantenimientos').text(cantidad); altair_dashboard.count_animated(); }, error: function(error) { alert('No se pudo completar la operación. #' + error.status + ' ' + error.statusText); } }); }
[ "function", "(", ")", "{", "$", ".", "ajax", "(", "{", "url", ":", "'views/modulos/ajax/API_estadisticas.php?action=getConteoMantenimientos'", ",", "method", ":", "'GET'", ",", "success", ":", "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "let", "responseJSON", "=", "JSON", ".", "parse", "(", "response", ")", ";", "let", "cantidad", "=", "responseJSON", ".", "data", "[", "0", "]", ".", "MantPendientes", ";", "$", "(", "'#countUpMeMantenimientos'", ")", ".", "text", "(", "cantidad", ")", ";", "altair_dashboard", ".", "count_animated", "(", ")", ";", "}", ",", "error", ":", "function", "(", "error", ")", "{", "alert", "(", "'No se pudo completar la operación. #' ", " ", "rror.", "s", "tatus ", " ", " ' ", " ", "rror.", "s", "tatusText)", ";", "", "}", "}", ")", ";", "}" ]
[ 17, 21 ]
[ 35, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
div5
(x)
null
Key Scenario 1
Key Scenario 1
function div5(x) { x = x | 0; return ((x | 0) / 5) | 0; }
[ "function", "div5", "(", "x", ")", "{", "x", "=", "x", "|", "0", ";", "return", "(", "(", "x", "|", "0", ")", "/", "5", ")", "|", "0", ";", "}" ]
[ 30, 4 ]
[ 30, 63 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
emptyInput
(input)
null
Funcion para validar campos vacios
Funcion para validar campos vacios
function emptyInput(input) { if (input == "") { return true; } else { return false; } }
[ "function", "emptyInput", "(", "input", ")", "{", "if", "(", "input", "==", "\"\"", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
[ 29, 0 ]
[ 35, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
divn3
(x)
null
Key Scenario 3
Key Scenario 3
function divn3(x) { x = x | 0; return ((x | 0) / -3) | 0; }
[ "function", "divn3", "(", "x", ")", "{", "x", "=", "x", "|", "0", ";", "return", "(", "(", "x", "|", "0", ")", "/", "-", "3", ")", "|", "0", ";", "}" ]
[ 32, 4 ]
[ 32, 63 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
studle_case
(str)
null
Vue.use(axios) Next, we will create a fresh Vue application instance and attach it to the page. Then, you may begin adding components to this application or customize the JavaScript scaffolding to fit your unique needs.
Vue.use(axios) Next, we will create a fresh Vue application instance and attach it to the page. Then, you may begin adding components to this application or customize the JavaScript scaffolding to fit your unique needs.
function studle_case(str) { return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase() }
[ "function", "studle_case", "(", "str", ")", "{", "return", "str", ".", "replace", "(", "/", "([a-zA-Z])(?=[A-Z])", "/", "g", ",", "'$1-'", ")", ".", "toLowerCase", "(", ")", "}" ]
[ 20, 0 ]
[ 22, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program
cumpleanios1
(edad)
null
si solamente pasaramos la edad el valor de edad sacha no se vera afectado en consola cumpleanios1(sacha.edad) y sacha
si solamente pasaramos la edad el valor de edad sacha no se vera afectado en consola cumpleanios1(sacha.edad) y sacha
function cumpleanios1(edad){ edad += 1 }
[ "function", "cumpleanios1", "(", "edad", ")", "{", "edad", "+=", "1", "}" ]
[ 17, 0 ]
[ 19, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(n = 6)
null
Colores disponibles
Colores disponibles
function (n = 6) { return colores.slice(0, n) }
[ "function", "(", "n", "=", "6", ")", "{", "return", "colores", ".", "slice", "(", "0", ",", "n", ")", "}" ]
[ 59, 22 ]
[ 61, 2 ]
null
javascript
es
['es', 'es', 'es']
False
true
pair
Person
(name)
null
También podemos crear estas propiedades directamente en el "constructor". Podemos crear funciones por ejemplo:
También podemos crear estas propiedades directamente en el "constructor". Podemos crear funciones por ejemplo:
function Person(name) { this.name = name; this.greet = function () { console.log("Hello, I'm " + this.name); }; }
[ "function", "Person", "(", "name", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "greet", "=", "function", "(", ")", "{", "console", ".", "log", "(", "\"Hello, I'm \"", "+", "this", ".", "name", ")", ";", "}", ";", "}" ]
[ 72, 0 ]
[ 77, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
comprobarC6
()
null
palabra Ansiedad color cafe
palabra Ansiedad color cafe
function comprobarC6(){ c6 = document.getElementById('celdaC6').style.color="brown"; }
[ "function", "comprobarC6", "(", ")", "{", "c6", "=", "document", ".", "getElementById", "(", "'celdaC6'", ")", ".", "style", ".", "color", "=", "\"brown\"", ";", "}" ]
[ 59, 0 ]
[ 61, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Expresion de la funcion
Expresion de la funcion
function () { console.log('Hola desde funcion con expresion'); }
[ "function", "(", ")", "{", "console", ".", "log", "(", "'Hola desde funcion con expresion'", ")", ";", "}" ]
[ 27, 15 ]
[ 29, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
checkParent
(str)
null
Una funcion que devuelve true/false si tiene la misma cantidad de "(" y de ")"
Una funcion que devuelve true/false si tiene la misma cantidad de "(" y de ")"
function checkParent (str) { var result = str.split("").reduce(function (previus,char) { if (char === "(" ) { return ++previus; } if (char === ")" ) { return --previus; } return previus; },0); return !Boolean(result); }
[ "function", "checkParent", "(", "str", ")", "{", "var", "result", "=", "str", ".", "split", "(", "\"\"", ")", ".", "reduce", "(", "function", "(", "previus", ",", "char", ")", "{", "if", "(", "char", "===", "\"(\"", ")", "{", "return", "++", "previus", ";", "}", "if", "(", "char", "===", "\")\"", ")", "{", "return", "--", "previus", ";", "}", "return", "previus", ";", "}", ",", "0", ")", ";", "return", "!", "Boolean", "(", "result", ")", ";", "}" ]
[ 2, 0 ]
[ 10, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
sum
(num1, num2)
null
Primero, se crea una función.
Primero, se crea una función.
function sum(num1, num2) { return num1 + num2; }
[ "function", "sum", "(", "num1", ",", "num2", ")", "{", "return", "num1", "+", "num2", ";", "}" ]
[ 2, 0 ]
[ 4, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
calcularPerimetroCuadrado
()
null
Aquí interactuamos con el HTMl Cuadrado
Aquí interactuamos con el HTMl Cuadrado
function calcularPerimetroCuadrado() { const input = document.getElementById("InputCuadrado"); const value = input.value; const perimetro = perimetroCuadrado(value); alert(perimetro); }
[ "function", "calcularPerimetroCuadrado", "(", ")", "{", "const", "input", "=", "document", ".", "getElementById", "(", "\"InputCuadrado\"", ")", ";", "const", "value", "=", "input", ".", "value", ";", "const", "perimetro", "=", "perimetroCuadrado", "(", "value", ")", ";", "alert", "(", "perimetro", ")", ";", "}" ]
[ 49, 0 ]
[ 55, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
f
()
null
¿Por qué otra forma de expresar funciones? ¿Es sólo estética? No, las funciones flecha tienen una característica muy importante, y es el motivo de su existencia: *** Mantienen a "this" apuntando al contexto en el que fueron creadas ... SIEMPRE *** Es decir, el "this" dentro de una lambda siempre se refiere al contexto donde dicha lambda fue creada. "this" deja de ser el que llama a la lambda. Dicho de otro modo, las lambdas no tienen contexto propio porque siempre lo toman prestado desde el contexto donde fueron creadas. *** Ejemplos ***
¿Por qué otra forma de expresar funciones? ¿Es sólo estética? No, las funciones flecha tienen una característica muy importante, y es el motivo de su existencia: *** Mantienen a "this" apuntando al contexto en el que fueron creadas ... SIEMPRE *** Es decir, el "this" dentro de una lambda siempre se refiere al contexto donde dicha lambda fue creada. "this" deja de ser el que llama a la lambda. Dicho de otro modo, las lambdas no tienen contexto propio porque siempre lo toman prestado desde el contexto donde fueron creadas. *** Ejemplos ***
function f() { console.log(this.age); // Aqui el contexto es el "caller" de la función. this -> caller. }
[ "function", "f", "(", ")", "{", "console", ".", "log", "(", "this", ".", "age", ")", ";", "// Aqui el contexto es el \"caller\" de la función. this -> caller.", "}" ]
[ 52, 0 ]
[ 54, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
drawIt
(k)
null
esta es una función que dibuja los comandos de la tortuga
esta es una función que dibuja los comandos de la tortuga
function drawIt(k) { if (k=='F') { // dibujar hacia adelante // de polar a cartesiano basado en paso y ángulo actual: let x1 = x + step * cos(radians(currentangle)); let y1 = y + step * sin(radians(currentangle)); line(x, y, x1, y1); // conectar el anterior y el nuevo // actualizar la posición de la tortuga: x = x1; y = y1; } else if (k == '+') { currentangle += angle; // doblar hacia la izquierda } else if (k == '-') { currentangle -= angle; // doblar hacia la derecha } // valores aleatorios de color: let r = random(128, 255); let g = random(0, 192); let b = random(0, 50); let a = random(50, 100); // escoger una distribución gaussiana (D&D) para el radio: let radius = 0; radius += random(0, 15); radius += random(0, 15); radius += random(0, 15); radius = radius / 3; // dibujar: fill(r, g, b, a); ellipse(x, y, radius, radius); }
[ "function", "drawIt", "(", "k", ")", "{", "if", "(", "k", "==", "'F'", ")", "{", "// dibujar hacia adelante", "// de polar a cartesiano basado en paso y ángulo actual:", "let", "x1", "=", "x", "+", "step", "*", "cos", "(", "radians", "(", "currentangle", ")", ")", ";", "let", "y1", "=", "y", "+", "step", "*", "sin", "(", "radians", "(", "currentangle", ")", ")", ";", "line", "(", "x", ",", "y", ",", "x1", ",", "y1", ")", ";", "// conectar el anterior y el nuevo", "// actualizar la posición de la tortuga:", "x", "=", "x1", ";", "y", "=", "y1", ";", "}", "else", "if", "(", "k", "==", "'+'", ")", "{", "currentangle", "+=", "angle", ";", "// doblar hacia la izquierda", "}", "else", "if", "(", "k", "==", "'-'", ")", "{", "currentangle", "-=", "angle", ";", "// doblar hacia la derecha", "}", "// valores aleatorios de color:", "let", "r", "=", "random", "(", "128", ",", "255", ")", ";", "let", "g", "=", "random", "(", "0", ",", "192", ")", ";", "let", "b", "=", "random", "(", "0", ",", "50", ")", ";", "let", "a", "=", "random", "(", "50", ",", "100", ")", ";", "// escoger una distribución gaussiana (D&D) para el radio:", "let", "radius", "=", "0", ";", "radius", "+=", "random", "(", "0", ",", "15", ")", ";", "radius", "+=", "random", "(", "0", ",", "15", ")", ";", "radius", "+=", "random", "(", "0", ",", "15", ")", ";", "radius", "=", "radius", "/", "3", ";", "// dibujar:", "fill", "(", "r", ",", "g", ",", "b", ",", "a", ")", ";", "ellipse", "(", "x", ",", "y", ",", "radius", ",", "radius", ")", ";", "}" ]
[ 72, 0 ]
[ 105, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
urlParse
(url, slashesDenoteHost)
null
/* eslint-enable no-script-url
/* eslint-enable no-script-url
function urlParse(url, slashesDenoteHost) { if (url && url instanceof Url) { return url; } var u = new Url(); u.parse(url, slashesDenoteHost); return u; }
[ "function", "urlParse", "(", "url", ",", "slashesDenoteHost", ")", "{", "if", "(", "url", "&&", "url", "instanceof", "Url", ")", "{", "return", "url", ";", "}", "var", "u", "=", "new", "Url", "(", ")", ";", "u", ".", "parse", "(", "url", ",", "slashesDenoteHost", ")", ";", "return", "u", ";", "}" ]
[ 106, 0 ]
[ 112, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
updateOne
(req, res)
null
Update User Se requiere estar logeado y que el usuario que se desea modificar sea el mismo de la sesion
Update User Se requiere estar logeado y que el usuario que se desea modificar sea el mismo de la sesion
function updateOne(req, res) { const idUser = req.user._id Controller.updateUser(idUser, req.body) .then((user) => { response.success(req, res, user.body, 201) }) .catch((err) => { response.error(req, res, err, 404) }) }
[ "function", "updateOne", "(", "req", ",", "res", ")", "{", "const", "idUser", "=", "req", ".", "user", ".", "_id", "Controller", ".", "updateUser", "(", "idUser", ",", "req", ".", "body", ")", ".", "then", "(", "(", "user", ")", "=>", "{", "response", ".", "success", "(", "req", ",", "res", ",", "user", ".", "body", ",", "201", ")", "}", ")", ".", "catch", "(", "(", "err", ")", "=>", "{", "response", ".", "error", "(", "req", ",", "res", ",", "err", ",", "404", ")", "}", ")", "}" ]
[ 59, 0 ]
[ 68, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
publicar_student
()
null
funcion para enviar un mensaje desde la bandeja de comentarios del student, la inicial que aparece al ingresar al panel
funcion para enviar un mensaje desde la bandeja de comentarios del student, la inicial que aparece al ingresar al panel
function publicar_student() { var usuario = $("#user").val(); var curso = $("#course").val(); var seccion = $("#section").val(); var msj = $("#mensaje").val(); var token = $("#token").val(); if (msj == "") { toastr.options = { closeButton: false, debug: false, newestOnTop: false, progressBar: false, positionClass: "toast-top-center", preventDuplicates: false, onclick: null, showDuration: "500", hideDuration: "1000", timeOut: "5000", extendedTimeOut: "1000", showEasing: "swing", hideEasing: "linear", showMethod: "fadeIn", hideMethod: "fadeOut", }; toastr.error("debes ingresar un mensaje"); } else { $.ajax({ url: "../../ajax/post_in_section", headers: token, data: { curso_id: curso, seccion_id: seccion, user_id: usuario, mensaje: msj, _token: token, }, type: "POST", datatype: "json", beforeSend: function () { $("#btn_publicar").attr("disabled", true); $("#circle").circleProgress({ value: 0.75, size: 80, fill: { gradient: ["red", "orange"], }, }); }, complete: function () { $("#circle").hide(); }, success: function (data) { //console.log(response); $("#mensaje").val(""); $("#nuevo_post") .prepend(data) .fadeIn(1000, function () { $("#nuevo_post").css({ border: "4px solid lightcoral", "border-radius": "5px", }); }); toastr.options = { closeButton: false, debug: false, newestOnTop: false, progressBar: false, positionClass: "toast-top-center", preventDuplicates: false, onclick: null, showDuration: "500", hideDuration: "1000", timeOut: "5000", extendedTimeOut: "1000", showEasing: "swing", hideEasing: "linear", showMethod: "fadeIn", hideMethod: "fadeOut", }; toastr.success("Mensaje publicado exitósamente"); $("#btn_publicar").attr("disabled", false); }, error: function (response) { console.log(response); }, }); } }
[ "function", "publicar_student", "(", ")", "{", "var", "usuario", "=", "$", "(", "\"#user\"", ")", ".", "val", "(", ")", ";", "var", "curso", "=", "$", "(", "\"#course\"", ")", ".", "val", "(", ")", ";", "var", "seccion", "=", "$", "(", "\"#section\"", ")", ".", "val", "(", ")", ";", "var", "msj", "=", "$", "(", "\"#mensaje\"", ")", ".", "val", "(", ")", ";", "var", "token", "=", "$", "(", "\"#token\"", ")", ".", "val", "(", ")", ";", "if", "(", "msj", "==", "\"\"", ")", "{", "toastr", ".", "options", "=", "{", "closeButton", ":", "false", ",", "debug", ":", "false", ",", "newestOnTop", ":", "false", ",", "progressBar", ":", "false", ",", "positionClass", ":", "\"toast-top-center\"", ",", "preventDuplicates", ":", "false", ",", "onclick", ":", "null", ",", "showDuration", ":", "\"500\"", ",", "hideDuration", ":", "\"1000\"", ",", "timeOut", ":", "\"5000\"", ",", "extendedTimeOut", ":", "\"1000\"", ",", "showEasing", ":", "\"swing\"", ",", "hideEasing", ":", "\"linear\"", ",", "showMethod", ":", "\"fadeIn\"", ",", "hideMethod", ":", "\"fadeOut\"", ",", "}", ";", "toastr", ".", "error", "(", "\"debes ingresar un mensaje\"", ")", ";", "}", "else", "{", "$", ".", "ajax", "(", "{", "url", ":", "\"../../ajax/post_in_section\"", ",", "headers", ":", "token", ",", "data", ":", "{", "curso_id", ":", "curso", ",", "seccion_id", ":", "seccion", ",", "user_id", ":", "usuario", ",", "mensaje", ":", "msj", ",", "_token", ":", "token", ",", "}", ",", "type", ":", "\"POST\"", ",", "datatype", ":", "\"json\"", ",", "beforeSend", ":", "function", "(", ")", "{", "$", "(", "\"#btn_publicar\"", ")", ".", "attr", "(", "\"disabled\"", ",", "true", ")", ";", "$", "(", "\"#circle\"", ")", ".", "circleProgress", "(", "{", "value", ":", "0.75", ",", "size", ":", "80", ",", "fill", ":", "{", "gradient", ":", "[", "\"red\"", ",", "\"orange\"", "]", ",", "}", ",", "}", ")", ";", "}", ",", "complete", ":", "function", "(", ")", "{", "$", "(", "\"#circle\"", ")", ".", "hide", "(", ")", ";", "}", ",", "success", ":", "function", "(", "data", ")", "{", "//console.log(response);", "$", "(", "\"#mensaje\"", ")", ".", "val", "(", "\"\"", ")", ";", "$", "(", "\"#nuevo_post\"", ")", ".", "prepend", "(", "data", ")", ".", "fadeIn", "(", "1000", ",", "function", "(", ")", "{", "$", "(", "\"#nuevo_post\"", ")", ".", "css", "(", "{", "border", ":", "\"4px solid lightcoral\"", ",", "\"border-radius\"", ":", "\"5px\"", ",", "}", ")", ";", "}", ")", ";", "toastr", ".", "options", "=", "{", "closeButton", ":", "false", ",", "debug", ":", "false", ",", "newestOnTop", ":", "false", ",", "progressBar", ":", "false", ",", "positionClass", ":", "\"toast-top-center\"", ",", "preventDuplicates", ":", "false", ",", "onclick", ":", "null", ",", "showDuration", ":", "\"500\"", ",", "hideDuration", ":", "\"1000\"", ",", "timeOut", ":", "\"5000\"", ",", "extendedTimeOut", ":", "\"1000\"", ",", "showEasing", ":", "\"swing\"", ",", "hideEasing", ":", "\"linear\"", ",", "showMethod", ":", "\"fadeIn\"", ",", "hideMethod", ":", "\"fadeOut\"", ",", "}", ";", "toastr", ".", "success", "(", "\"Mensaje publicado exitósamente\")", ";", "", "$", "(", "\"#btn_publicar\"", ")", ".", "attr", "(", "\"disabled\"", ",", "false", ")", ";", "}", ",", "error", ":", "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "}", ",", "}", ")", ";", "}", "}" ]
[ 391, 0 ]
[ 483, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
valida_formulario
(formulario)
null
/* valida_formulario - valida el formulario del lado del cliente usando: jqueryvalidate formulario: id del formulario
/* valida_formulario - valida el formulario del lado del cliente usando: jqueryvalidate
function valida_formulario(formulario) { $(document).ready(function() { //================================================================================ // Para que valide los patterns del formulario $.validator.methods.pattern = function(value, element) { return (this.optional(element) || new RegExp(element.pattern).test(value)); }; // $.validator.messages.pattern = "Invalid input entered."; => asi se define en el footer si el idioma seleccionado es: 'en' //================================================================================ $("#" + formulario + " .error" ).html(''); $("#" + formulario).validate({ /* debug:true, errorPlacement: function(error, element) { var name = element.attr('name'); var errorSelector = '.error[id="error_' + name + '"]'; var $element = $(errorSelector); if ($element.length) { $(errorSelector).html(error.html()); } else { error.insertAfter(element); } },*/ highlight: function(input) { // $(input).addClass('error_input'); }, errorPlacement: function(error, element){}, submitHandler:function(){ valida_formulario_ajax(formulario); } }); }); }
[ "function", "valida_formulario", "(", "formulario", ")", "{", "$", "(", "document", ")", ".", "ready", "(", "function", "(", ")", "{", "//================================================================================", "// Para que valide los patterns del formulario", "$", ".", "validator", ".", "methods", ".", "pattern", "=", "function", "(", "value", ",", "element", ")", "{", "return", "(", "this", ".", "optional", "(", "element", ")", "||", "new", "RegExp", "(", "element", ".", "pattern", ")", ".", "test", "(", "value", ")", ")", ";", "}", ";", "// $.validator.messages.pattern = \"Invalid input entered.\"; => asi se define en el footer si el idioma seleccionado es: 'en' ", "//================================================================================", "$", "(", "\"#\"", "+", "formulario", "+", "\" .error\"", ")", ".", "html", "(", "''", ")", ";", "$", "(", "\"#\"", "+", "formulario", ")", ".", "validate", "(", "{", "/*\n debug:true,\n errorPlacement: function(error, element) \n {\n var name = element.attr('name');\n var errorSelector = '.error[id=\"error_' + name + '\"]';\n var $element = $(errorSelector);\n if ($element.length) { \n $(errorSelector).html(error.html());\n } else {\n error.insertAfter(element);\n }\n },*/", "highlight", ":", "function", "(", "input", ")", "{", "// $(input).addClass('error_input');", "}", ",", "errorPlacement", ":", "function", "(", "error", ",", "element", ")", "{", "}", ",", "submitHandler", ":", "function", "(", ")", "{", "valida_formulario_ajax", "(", "formulario", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}" ]
[ 112, 0 ]
[ 147, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
verify_Card
(rule_info, last_card, card)
null
Verifica que la carta que el jugador ingrese, este correcta
Verifica que la carta que el jugador ingrese, este correcta
function verify_Card(rule_info, last_card, card) { //Se analiza la regla var rule_p1 = rule_info[0]; var rule_p2 = rule_info[1]; var rule_p3 = rule_info[2]; if (rule_p1 == 0) { //Se toma el último caracter de la carta para saber que tipo es card = card.charAt(card.length - 1); prompt(card); //Verifica que la carta no tenga uno de los colores prohibidos if (rule_p2 == 0) { if (rule_p3.includes(card)) { return false; } else { return true; } } //Verifica que la carta tenga color permitido y orden correcto else { last_card = last_card.charAt(last_card.length - 1); var pivot = last_card + card; var pivotRule = rule_p3 + rule_p3; if (pivotRule.includes(pivot)) { //Si esta en el orden correcto devuelve true return true; } else { //Si no esta en el orden correcto devuelve False return false; } } } else { //Se toma el número de la carta card = card.slice(0, card.length - 1); card = Number(card); prompt(card); if (rule_p2 == 0) { //Se verifica que sea multiplo var resultado = card % rule_p3; if (resultado == 0) { return true; } else { return false; } } else if (rule_p2 == 1) { //Se verifica que el numero sea mayor al indicado if (Number(card) >= Number(rule_p3)) { return true; } else { return false; } } else if (rule_p2 == 2) { //Se verifica que el numero sea menor al indicado if (Number(card) <= Number(rule_p3)) { return true; } else { return false; } } else { //El numero es el prohibido if (card == rule_p3) { return false; } else { return true; } } } }
[ "function", "verify_Card", "(", "rule_info", ",", "last_card", ",", "card", ")", "{", "//Se analiza la regla", "var", "rule_p1", "=", "rule_info", "[", "0", "]", ";", "var", "rule_p2", "=", "rule_info", "[", "1", "]", ";", "var", "rule_p3", "=", "rule_info", "[", "2", "]", ";", "if", "(", "rule_p1", "==", "0", ")", "{", "//Se toma el último caracter de la carta para saber que tipo es ", "card", "=", "card", ".", "charAt", "(", "card", ".", "length", "-", "1", ")", ";", "prompt", "(", "card", ")", ";", "//Verifica que la carta no tenga uno de los colores prohibidos", "if", "(", "rule_p2", "==", "0", ")", "{", "if", "(", "rule_p3", ".", "includes", "(", "card", ")", ")", "{", "return", "false", ";", "}", "else", "{", "return", "true", ";", "}", "}", "//Verifica que la carta tenga color permitido y orden correcto", "else", "{", "last_card", "=", "last_card", ".", "charAt", "(", "last_card", ".", "length", "-", "1", ")", ";", "var", "pivot", "=", "last_card", "+", "card", ";", "var", "pivotRule", "=", "rule_p3", "+", "rule_p3", ";", "if", "(", "pivotRule", ".", "includes", "(", "pivot", ")", ")", "{", "//Si esta en el orden correcto devuelve true", "return", "true", ";", "}", "else", "{", "//Si no esta en el orden correcto devuelve False", "return", "false", ";", "}", "}", "}", "else", "{", "//Se toma el número de la carta", "card", "=", "card", ".", "slice", "(", "0", ",", "card", ".", "length", "-", "1", ")", ";", "card", "=", "Number", "(", "card", ")", ";", "prompt", "(", "card", ")", ";", "if", "(", "rule_p2", "==", "0", ")", "{", "//Se verifica que sea multiplo", "var", "resultado", "=", "card", "%", "rule_p3", ";", "if", "(", "resultado", "==", "0", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "else", "if", "(", "rule_p2", "==", "1", ")", "{", "//Se verifica que el numero sea mayor al indicado", "if", "(", "Number", "(", "card", ")", ">=", "Number", "(", "rule_p3", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "else", "if", "(", "rule_p2", "==", "2", ")", "{", "//Se verifica que el numero sea menor al indicado", "if", "(", "Number", "(", "card", ")", "<=", "Number", "(", "rule_p3", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "else", "{", "//El numero es el prohibido", "if", "(", "card", "==", "rule_p3", ")", "{", "return", "false", ";", "}", "else", "{", "return", "true", ";", "}", "}", "}", "}" ]
[ 192, 0 ]
[ 268, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
renderFirstName
(formData)
null
Funciones de registro de usuario
Funciones de registro de usuario
function renderFirstName(formData) { const $firstName = document.querySelector("#first-name"); const firstName = formData.get('first-name'); $firstName.textContent = firstName; return firstName; }
[ "function", "renderFirstName", "(", "formData", ")", "{", "const", "$firstName", "=", "document", ".", "querySelector", "(", "\"#first-name\"", ")", ";", "const", "firstName", "=", "formData", ".", "get", "(", "'first-name'", ")", ";", "$firstName", ".", "textContent", "=", "firstName", ";", "return", "firstName", ";", "}" ]
[ 7, 0 ]
[ 12, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
toggleAudio
(cnv)
null
función de ayuda para prender y apagar el sonido
función de ayuda para prender y apagar el sonido
function toggleAudio(cnv) { cnv.mouseOver(function() { carrier.amp(1.0, 0.01); }); cnv.touchStarted(function() { carrier.amp(1.0, 0.01); }); cnv.mouseOut(function() { carrier.amp(0.0, 1.0); }); }
[ "function", "toggleAudio", "(", "cnv", ")", "{", "cnv", ".", "mouseOver", "(", "function", "(", ")", "{", "carrier", ".", "amp", "(", "1.0", ",", "0.01", ")", ";", "}", ")", ";", "cnv", ".", "touchStarted", "(", "function", "(", ")", "{", "carrier", ".", "amp", "(", "1.0", ",", "0.01", ")", ";", "}", ")", ";", "cnv", ".", "mouseOut", "(", "function", "(", ")", "{", "carrier", ".", "amp", "(", "0.0", ",", "1.0", ")", ";", "}", ")", ";", "}" ]
[ 136, 0 ]
[ 146, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
asignarFiltros
(categoria)
null
Le agrego los nombres a los filtros que se visualizan a la izquierda de la pantalla.
Le agrego los nombres a los filtros que se visualizan a la izquierda de la pantalla.
function asignarFiltros(categoria) { let listaSubcategorias = document.querySelectorAll(`#${categoria} p`); let listaBtnfiltrado = document.querySelectorAll(".grid-contenedor-pricipal .categorias-filtrado a"); for (let i = 0; i < listaSubcategorias.length; i++) { listaBtnfiltrado[i + 1].textContent = listaSubcategorias[i].textContent; } }
[ "function", "asignarFiltros", "(", "categoria", ")", "{", "let", "listaSubcategorias", "=", "document", ".", "querySelectorAll", "(", "`", "${", "categoria", "}", "`", ")", ";", "let", "listaBtnfiltrado", "=", "document", ".", "querySelectorAll", "(", "\".grid-contenedor-pricipal .categorias-filtrado a\"", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "listaSubcategorias", ".", "length", ";", "i", "++", ")", "{", "listaBtnfiltrado", "[", "i", "+", "1", "]", ".", "textContent", "=", "listaSubcategorias", "[", "i", "]", ".", "textContent", ";", "}", "}" ]
[ 70, 0 ]
[ 76, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
onKeyEvent
(Mundo, keyCode)
null
Implemente esta función si quiere que su programa reaccione a eventos del teclado
Implemente esta función si quiere que su programa reaccione a eventos del teclado
function onKeyEvent (Mundo, keyCode) { return update(Mundo,{}); }
[ "function", "onKeyEvent", "(", "Mundo", ",", "keyCode", ")", "{", "return", "update", "(", "Mundo", ",", "{", "}", ")", ";", "}" ]
[ 52, 0 ]
[ 54, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
renderizarUsuarios
(personas)
null
Funciones para renderizar usuarios
Funciones para renderizar usuarios
function renderizarUsuarios(personas) { // [{},{},{}] console.log(personas); var html = ''; html += '<li>'; html += ' <a href="javascript:void(0)" class="active"> Chat de <span> ' + params.get('sala') + '</span></a>'; html += '</li>'; for (var i = 0; i < personas.length; i++) { html += '<li>'; html += ' <a data-id="' + personas[i].id + '" href="javascript:void(0)"><img src="assets/images/users/1.jpg" alt="user-img" class="img-circle"> <span>' + personas[i].nombre + ' <small class="text-success">online</small></span></a>'; html += '</li>'; } divUsuarios.html(html); }
[ "function", "renderizarUsuarios", "(", "personas", ")", "{", "// [{},{},{}]", "console", ".", "log", "(", "personas", ")", ";", "var", "html", "=", "''", ";", "html", "+=", "'<li>'", ";", "html", "+=", "' <a href=\"javascript:void(0)\" class=\"active\"> Chat de <span> '", "+", "params", ".", "get", "(", "'sala'", ")", "+", "'</span></a>'", ";", "html", "+=", "'</li>'", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "personas", ".", "length", ";", "i", "++", ")", "{", "html", "+=", "'<li>'", ";", "html", "+=", "' <a data-id=\"'", "+", "personas", "[", "i", "]", ".", "id", "+", "'\" href=\"javascript:void(0)\"><img src=\"assets/images/users/1.jpg\" alt=\"user-img\" class=\"img-circle\"> <span>'", "+", "personas", "[", "i", "]", ".", "nombre", "+", "' <small class=\"text-success\">online</small></span></a>'", ";", "html", "+=", "'</li>'", ";", "}", "divUsuarios", ".", "html", "(", "html", ")", ";", "}" ]
[ 14, 0 ]
[ 33, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getPosts
()
null
Información de los posts.
Información de los posts.
async function getPosts() { const response = await axios.get('https://jsonplaceholder.typicode.com/posts') return response.data; }
[ "async", "function", "getPosts", "(", ")", "{", "const", "response", "=", "await", "axios", ".", "get", "(", "'https://jsonplaceholder.typicode.com/posts'", ")", "return", "response", ".", "data", ";", "}" ]
[ 9, 0 ]
[ 12, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
ClearInputs
()
null
/ limpi campos despues de utilizar el modal
/ limpi campos despues de utilizar el modal
function ClearInputs() { var forms = document.getElementsByClassName('form-data'); Array.prototype.filter.call(forms, function (form) { form.classList.remove('was-validated'); }); //__Clean values of inputs $("#form-data")[0].reset(); id = 0; }
[ "function", "ClearInputs", "(", ")", "{", "var", "forms", "=", "document", ".", "getElementsByClassName", "(", "'form-data'", ")", ";", "Array", ".", "prototype", ".", "filter", ".", "call", "(", "forms", ",", "function", "(", "form", ")", "{", "form", ".", "classList", ".", "remove", "(", "'was-validated'", ")", ";", "}", ")", ";", "//__Clean values of inputs", "$", "(", "\"#form-data\"", ")", "[", "0", "]", ".", "reset", "(", ")", ";", "id", "=", "0", ";", "}" ]
[ 274, 0 ]
[ 282, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
CambiarValorObjeto
(p1)
null
llamamos a cambiarValorObjeto estamos pasando la referencia a la variable p1, apunta al mismo objeto en memoria y accedemos a esos atributos, pasando la variable p1 cambiamos juan perez por carlos lara
llamamos a cambiarValorObjeto estamos pasando la referencia a la variable p1, apunta al mismo objeto en memoria y accedemos a esos atributos, pasando la variable p1 cambiamos juan perez por carlos lara
function CambiarValorObjeto(p1){ p1.nombre = 'Carlos'; p1.apellido = 'Lara'; p1.edad = 23 }
[ "function", "CambiarValorObjeto", "(", "p1", ")", "{", "p1", ".", "nombre", "=", "'Carlos'", ";", "p1", ".", "apellido", "=", "'Lara'", ";", "p1", ".", "edad", "=", "23", "}" ]
[ 29, 0 ]
[ 34, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
newPage
(url)
null
/* eslint-enable no-multi-spaces
/* eslint-enable no-multi-spaces
async function newPage(url) { let page = null let done = null try { const browserType = browserTypes[process.env.BROWSER] const args = [] if (browserType === Chrome) { args.push("--window-size=1440,900") } else if (browserType === Firefox) { args.push("-width=1440", "-height=900") } const config = { headless: process.env.HEADLESS === "true" || false, args, } const browser = await browserType.launch(config) const context = await browser.newContext() page = await context.newPage(url) if (!config.headless && browserType === Firefox) { execSync("osascript -e 'activate application \"Nightly\"'") } await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: process.env.BROWSER === Safari ? 2 : undefined }) await page.waitFor(1e3, OPTIONS) page.on("pageerror", error => expect(error).toBeNull()) done = browser.close } catch (e) { console.warn(e) } const _page = new Page(page, done) return [_page, done] }
[ "async", "function", "newPage", "(", "url", ")", "{", "let", "page", "=", "null", "let", "done", "=", "null", "try", "{", "const", "browserType", "=", "browserTypes", "[", "process", ".", "env", ".", "BROWSER", "]", "const", "args", "=", "[", "]", "if", "(", "browserType", "===", "Chrome", ")", "{", "args", ".", "push", "(", "\"--window-size=1440,900\"", ")", "}", "else", "if", "(", "browserType", "===", "Firefox", ")", "{", "args", ".", "push", "(", "\"-width=1440\"", ",", "\"-height=900\"", ")", "}", "const", "config", "=", "{", "headless", ":", "process", ".", "env", ".", "HEADLESS", "===", "\"true\"", "||", "false", ",", "args", ",", "}", "const", "browser", "=", "await", "browserType", ".", "launch", "(", "config", ")", "const", "context", "=", "await", "browser", ".", "newContext", "(", ")", "page", "=", "await", "context", ".", "newPage", "(", "url", ")", "if", "(", "!", "config", ".", "headless", "&&", "browserType", "===", "Firefox", ")", "{", "execSync", "(", "\"osascript -e 'activate application \\\"Nightly\\\"'\"", ")", "}", "await", "page", ".", "setViewport", "(", "{", "width", ":", "1440", ",", "height", ":", "900", ",", "deviceScaleFactor", ":", "process", ".", "env", ".", "BROWSER", "===", "Safari", "?", "2", ":", "undefined", "}", ")", "await", "page", ".", "waitFor", "(", "1e3", ",", "OPTIONS", ")", "page", ".", "on", "(", "\"pageerror\"", ",", "error", "=>", "expect", "(", "error", ")", ".", "toBeNull", "(", ")", ")", "done", "=", "browser", ".", "close", "}", "catch", "(", "e", ")", "{", "console", ".", "warn", "(", "e", ")", "}", "const", "_page", "=", "new", "Page", "(", "page", ",", "done", ")", "return", "[", "_page", ",", "done", "]", "}" ]
[ 25, 0 ]
[ 55, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
imprimir
()
null
llamar a busqueda al presionar en boton de busqueda
llamar a busqueda al presionar en boton de busqueda
function imprimir(){ //Funcion encargada de mostrar productos buscados segun nombre var auxText=""; if(textSearch!=""){ auxText ="/"+document.getElementById("orden").value+parseInt(document.getElementById("asc-desc").value)+"/"+textSearch; } var button=document.getElementById("busqueda".value); textSearch=search.value; if(textSearch===""){ window.location.reload() } else{ fetch('https://bsale-test-backend.herokuapp.com/api/products/search/'+orden+'/'+textSearch)//solicitud a endpoint de busqueda de producto por su nombre .then(data=>data.json()) .then(data=>{ productos = data; document.getElementById('contenedor').innerHTML=" "; if(!productos[0]){ document.getElementById('contenedor').innerHTML="<h2 class=\"text-center my-5\" style=\"height: 500px;\">Producto no encontrado</h2>"; } else listarProductos(productos); }); } }
[ "function", "imprimir", "(", ")", "{", "//Funcion encargada de mostrar productos buscados segun nombre", "var", "auxText", "=", "\"\"", ";", "if", "(", "textSearch", "!=", "\"\"", ")", "{", "auxText", "=", "\"/\"", "+", "document", ".", "getElementById", "(", "\"orden\"", ")", ".", "value", "+", "parseInt", "(", "document", ".", "getElementById", "(", "\"asc-desc\"", ")", ".", "value", ")", "+", "\"/\"", "+", "textSearch", ";", "}", "var", "button", "=", "document", ".", "getElementById", "(", "\"busqueda\"", ".", "value", ")", ";", "textSearch", "=", "search", ".", "value", ";", "if", "(", "textSearch", "===", "\"\"", ")", "{", "window", ".", "location", ".", "reload", "(", ")", "}", "else", "{", "fetch", "(", "'https://bsale-test-backend.herokuapp.com/api/products/search/'", "+", "orden", "+", "'/'", "+", "textSearch", ")", "//solicitud a endpoint de busqueda de producto por su nombre", ".", "then", "(", "data", "=>", "data", ".", "json", "(", ")", ")", ".", "then", "(", "data", "=>", "{", "productos", "=", "data", ";", "document", ".", "getElementById", "(", "'contenedor'", ")", ".", "innerHTML", "=", "\" \"", ";", "if", "(", "!", "productos", "[", "0", "]", ")", "{", "document", ".", "getElementById", "(", "'contenedor'", ")", ".", "innerHTML", "=", "\"<h2 class=\\\"text-center my-5\\\" style=\\\"height: 500px;\\\">Producto no encontrado</h2>\"", ";", "}", "else", "listarProductos", "(", "productos", ")", ";", "}", ")", ";", "}", "}" ]
[ 117, 0 ]
[ 140, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(pais)
null
Obtener los limitrofes, solo los disponibles en la APP
Obtener los limitrofes, solo los disponibles en la APP
function (pais) { // Chequear si el pais realmente esta dentro de los utilizados. if (this.es_utilizado(pais)) { var limitrofes = []; paises_limitrofes[pais].forEach(element => { if (this.es_utilizado(element)) { limitrofes.push(element); } }); return limitrofes; } else { return 'array vacio'; } }
[ "function", "(", "pais", ")", "{", "// Chequear si el pais realmente esta dentro de los utilizados.\r", "if", "(", "this", ".", "es_utilizado", "(", "pais", ")", ")", "{", "var", "limitrofes", "=", "[", "]", ";", "paises_limitrofes", "[", "pais", "]", ".", "forEach", "(", "element", "=>", "{", "if", "(", "this", ".", "es_utilizado", "(", "element", ")", ")", "{", "limitrofes", ".", "push", "(", "element", ")", ";", "}", "}", ")", ";", "return", "limitrofes", ";", "}", "else", "{", "return", "'array vacio'", ";", "}", "}" ]
[ 6, 17 ]
[ 19, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
cancelOrder
()
null
Cancela la orden eliminando el pedido de la base de datos
Cancela la orden eliminando el pedido de la base de datos
function cancelOrder() { axios .delete(`http://127.0.0.1:8000/main/api/Pedido/${idpedido}`) .then(res => console.log(res)) .catch(err => console.log(err)); setOrder([]) setTotal(0) setNewTotal(0) setDescuento(0) toggleInitModal() // Abre el modal inicial para una nueva orden }
[ "function", "cancelOrder", "(", ")", "{", "axios", ".", "delete", "(", "`", "${", "idpedido", "}", "`", ")", ".", "then", "(", "res", "=>", "console", ".", "log", "(", "res", ")", ")", ".", "catch", "(", "err", "=>", "console", ".", "log", "(", "err", ")", ")", ";", "setOrder", "(", "[", "]", ")", "setTotal", "(", "0", ")", "setNewTotal", "(", "0", ")", "setDescuento", "(", "0", ")", "toggleInitModal", "(", ")", "// Abre el modal inicial para una nueva orden", "}" ]
[ 251, 2 ]
[ 261, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
areaCuadrado
(lado)
null
console.log("El perímetro del cuadrado es: " + perimetroCuadrado + "cm");
console.log("El perímetro del cuadrado es: " + perimetroCuadrado + "cm");
function areaCuadrado(lado) { return lado * lado; }
[ "function", "areaCuadrado", "(", "lado", ")", "{", "return", "lado", "*", "lado", ";", "}" ]
[ 10, 4 ]
[ 12, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(callback)
null
Respuesta confirmación eliminar
Respuesta confirmación eliminar
function(callback){ $("#btn-confirm").on("click", function(){ $("#ModalEliminar").modal('show'); }); $("#eliminar-tarjeta").on("click", function(){ callback(true); $("#ModalEliminar").modal('hide'); }); }
[ "function", "(", "callback", ")", "{", "$", "(", "\"#btn-confirm\"", ")", ".", "on", "(", "\"click\"", ",", "function", "(", ")", "{", "$", "(", "\"#ModalEliminar\"", ")", ".", "modal", "(", "'show'", ")", ";", "}", ")", ";", "$", "(", "\"#eliminar-tarjeta\"", ")", ".", "on", "(", "\"click\"", ",", "function", "(", ")", "{", "callback", "(", "true", ")", ";", "$", "(", "\"#ModalEliminar\"", ")", ".", "modal", "(", "'hide'", ")", ";", "}", ")", ";", "}" ]
[ 251, 21 ]
[ 260, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
markAsUnDone
({ index })
null
Marcar un todo como no hecho y guardar la lista
Marcar un todo como no hecho y guardar la lista
async function markAsUnDone({ index }) { const currentTodos = await readTodoList(); currentTodos.tasks[index - 1].done = false; await saveTodosToFile(currentTodos); }
[ "async", "function", "markAsUnDone", "(", "{", "index", "}", ")", "{", "const", "currentTodos", "=", "await", "readTodoList", "(", ")", ";", "currentTodos", ".", "tasks", "[", "index", "-", "1", "]", ".", "done", "=", "false", ";", "await", "saveTodosToFile", "(", "currentTodos", ")", ";", "}" ]
[ 115, 0 ]
[ 121, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
obtener_niveles
(planacad_id)
null
/* obtiene niveles de un plan academico
/* obtiene niveles de un plan academico
function obtener_niveles(planacad_id){ var base_url = document.getElementById('base_url').value; controlador = base_url+"inscripcion/buscar_nivel"; $("#nivel_id").empty(); $("#nivel_id").prepend("<option value='0'>- NIVEL -</option>"); $.ajax({ url:controlador, type:"POST", data:{planacad_id:planacad_id}, success:function(respuesta){ var registros = JSON.parse(respuesta); if (registros != null){ for(var i=0;i<registros.length;i++){ $("#nivel_id").prepend("<option value='"+registros[i].nivel_id+"'>"+registros[i].nivel_descripcion+"</option>"); } } }, error:function(respuesta){ }, }); }
[ "function", "obtener_niveles", "(", "planacad_id", ")", "{", "var", "base_url", "=", "document", ".", "getElementById", "(", "'base_url'", ")", ".", "value", ";", "controlador", "=", "base_url", "+", "\"inscripcion/buscar_nivel\"", ";", "$", "(", "\"#nivel_id\"", ")", ".", "empty", "(", ")", ";", "$", "(", "\"#nivel_id\"", ")", ".", "prepend", "(", "\"<option value='0'>- NIVEL -</option>\"", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "controlador", ",", "type", ":", "\"POST\"", ",", "data", ":", "{", "planacad_id", ":", "planacad_id", "}", ",", "success", ":", "function", "(", "respuesta", ")", "{", "var", "registros", "=", "JSON", ".", "parse", "(", "respuesta", ")", ";", "if", "(", "registros", "!=", "null", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "registros", ".", "length", ";", "i", "++", ")", "{", "$", "(", "\"#nivel_id\"", ")", ".", "prepend", "(", "\"<option value='\"", "+", "registros", "[", "i", "]", ".", "nivel_id", "+", "\"'>\"", "+", "registros", "[", "i", "]", ".", "nivel_descripcion", "+", "\"</option>\"", ")", ";", "}", "}", "}", ",", "error", ":", "function", "(", "respuesta", ")", "{", "}", ",", "}", ")", ";", "}" ]
[ 244, 0 ]
[ 264, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
limpiarCamposPosteo
()
null
Limpiar formulario de Posteo de Articulo del Blog
Limpiar formulario de Posteo de Articulo del Blog
function limpiarCamposPosteo() { titulo.value = ''; descripcion.value = ''; contenido.value = ''; errorDivTit.style.display = 'none'; titulo.style.border = '2px solid #eeae00'; errorDivDesc.style.display = 'none'; descripcion.style.border = '2px solid #eeae00'; errorDivCont.style.display = 'none'; contenido.style.border = '2px solid #eeae00'; }
[ "function", "limpiarCamposPosteo", "(", ")", "{", "titulo", ".", "value", "=", "''", ";", "descripcion", ".", "value", "=", "''", ";", "contenido", ".", "value", "=", "''", ";", "errorDivTit", ".", "style", ".", "display", "=", "'none'", ";", "titulo", ".", "style", ".", "border", "=", "'2px solid #eeae00'", ";", "errorDivDesc", ".", "style", ".", "display", "=", "'none'", ";", "descripcion", ".", "style", ".", "border", "=", "'2px solid #eeae00'", ";", "errorDivCont", ".", "style", ".", "display", "=", "'none'", ";", "contenido", ".", "style", ".", "border", "=", "'2px solid #eeae00'", ";", "}" ]
[ 75, 8 ]
[ 88, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
handleTvSearch
(ev)
null
función del api, aquí solo recojo la info que quiero mostrar en la web
función del api, aquí solo recojo la info que quiero mostrar en la web
function handleTvSearch(ev) { prevent(ev); let textUser = inputSearch.value; fetch('//api.tvmaze.com/search/shows?q=' + textUser) .then((response) => response.json()) .then((data) => { tvListData = data; tvPaintedList(); }); }
[ "function", "handleTvSearch", "(", "ev", ")", "{", "prevent", "(", "ev", ")", ";", "let", "textUser", "=", "inputSearch", ".", "value", ";", "fetch", "(", "'//api.tvmaze.com/search/shows?q='", "+", "textUser", ")", ".", "then", "(", "(", "response", ")", "=>", "response", ".", "json", "(", ")", ")", ".", "then", "(", "(", "data", ")", "=>", "{", "tvListData", "=", "data", ";", "tvPaintedList", "(", ")", ";", "}", ")", ";", "}" ]
[ 102, 0 ]
[ 112, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
imprimir
(tipo)
null
Metodo independiente por fuera de las dos clases
Metodo independiente por fuera de las dos clases
function imprimir(tipo){ console.log(tipo.obtenerDetalles()); determinarTipo(tipo); }
[ "function", "imprimir", "(", "tipo", ")", "{", "console", ".", "log", "(", "tipo", ".", "obtenerDetalles", "(", ")", ")", ";", "determinarTipo", "(", "tipo", ")", ";", "}" ]
[ 50, 0 ]
[ 53, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
ConditionsOr
(cond, search, Op)
null
* retorna un arregló con las consultas like
* retorna un arregló con las consultas like
function ConditionsOr(cond, search, Op) { console.log(cond); const or = []; let condicionLike; cond.forEach(element => { condicionLike = { [element]: { [Op.like]: `%${search}%` } }; or.push(condicionLike); }); return or; }
[ "function", "ConditionsOr", "(", "cond", ",", "search", ",", "Op", ")", "{", "console", ".", "log", "(", "cond", ")", ";", "const", "or", "=", "[", "]", ";", "let", "condicionLike", ";", "cond", ".", "forEach", "(", "element", "=>", "{", "condicionLike", "=", "{", "[", "element", "]", ":", "{", "[", "Op", ".", "like", "]", ":", "`", "${", "search", "}", "`", "}", "}", ";", "or", ".", "push", "(", "condicionLike", ")", ";", "}", ")", ";", "return", "or", ";", "}" ]
[ 1, 0 ]
[ 14, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
mientras enviamos el archivo
mientras enviamos el archivo
function(){ $("#"+divresul+"").html($("#cargador_empresa").html()); }
[ "function", "(", ")", "{", "$", "(", "\"#\"", "+", "divresul", "+", "\"\"", ")", ".", "html", "(", "$", "(", "\"#cargador_empresa\"", ")", ".", "html", "(", ")", ")", ";", "}" ]
[ 147, 24 ]
[ 149, 13 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
cargarCategoriaHtml
(i, categoria)
null
Le agrego a cada elemento del HTMl la clase con la categoría correspondiente.
Le agrego a cada elemento del HTMl la clase con la categoría correspondiente.
function cargarCategoriaHtml(i, categoria) { document.querySelectorAll(".contenedor-cards-articulos .articulo a")[i].className = `button-articulo-${categoria}`; document.querySelectorAll(".contenedor-cards-articulos .articulo img")[i].className = `img-articulo-${categoria}`; document.querySelectorAll(".contenedor-cards-articulos .articulo label")[i].className = `nombre-articulo-${categoria}`; document.querySelectorAll(".contenedor-cards-articulos .articulo p")[i].className = `precio-articulo-${categoria}`; document.querySelectorAll(".contenedor-cards-articulos .articulo h2")[i].className = `financiacion-articulo-${categoria}`; }
[ "function", "cargarCategoriaHtml", "(", "i", ",", "categoria", ")", "{", "document", ".", "querySelectorAll", "(", "\".contenedor-cards-articulos .articulo a\"", ")", "[", "i", "]", ".", "className", "=", "`", "${", "categoria", "}", "`", ";", "document", ".", "querySelectorAll", "(", "\".contenedor-cards-articulos .articulo img\"", ")", "[", "i", "]", ".", "className", "=", "`", "${", "categoria", "}", "`", ";", "document", ".", "querySelectorAll", "(", "\".contenedor-cards-articulos .articulo label\"", ")", "[", "i", "]", ".", "className", "=", "`", "${", "categoria", "}", "`", ";", "document", ".", "querySelectorAll", "(", "\".contenedor-cards-articulos .articulo p\"", ")", "[", "i", "]", ".", "className", "=", "`", "${", "categoria", "}", "`", ";", "document", ".", "querySelectorAll", "(", "\".contenedor-cards-articulos .articulo h2\"", ")", "[", "i", "]", ".", "className", "=", "`", "${", "categoria", "}", "`", ";", "}" ]
[ 86, 0 ]
[ 92, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
traerArticulos
()
null
Traigo todos los articulos
Traigo todos los articulos
async function traerArticulos() { const URL = `/articulo/get-all`; try { let response = await fetch(URL); if (response.ok) { let listadoArticulos = await response.json(); cargarArrayGlobal(listadoArticulos); } } catch (response) { console.log("Error en la conexión", response); } }
[ "async", "function", "traerArticulos", "(", ")", "{", "const", "URL", "=", "`", "`", ";", "try", "{", "let", "response", "=", "await", "fetch", "(", "URL", ")", ";", "if", "(", "response", ".", "ok", ")", "{", "let", "listadoArticulos", "=", "await", "response", ".", "json", "(", ")", ";", "cargarArrayGlobal", "(", "listadoArticulos", ")", ";", "}", "}", "catch", "(", "response", ")", "{", "console", ".", "log", "(", "\"Error en la conexión\",", " ", "esponse)", ";", "", "}", "}" ]
[ 7, 0 ]
[ 19, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
registro_ingreso
()
null
para registrar el ingreso de la persona
para registrar el ingreso de la persona
function registro_ingreso (){ let visitante = JSON.parse(localStorage.getItem("visitor")); let nombre = visitante.nombre; let apellido = visitante.apellido; access_entrada.push(visitante); console.log(access_entrada); $( "#permisos" ).slideUp("slow") $('permisos').addClass("none"); $("#acceso__visita").append(`<section> <h3>Bienvenido</h3> <p>${nombre} ${apellido}</p> <div> <button class="button button--volver" id="volver" onClick ="estado_inicial()">Regresar a Consulta </button> </div> </section>`) $('.login').addClass('ingreso_autorizado') }
[ "function", "registro_ingreso", "(", ")", "{", "let", "visitante", "=", "JSON", ".", "parse", "(", "localStorage", ".", "getItem", "(", "\"visitor\"", ")", ")", ";", "let", "nombre", "=", "visitante", ".", "nombre", ";", "let", "apellido", "=", "visitante", ".", "apellido", ";", "access_entrada", ".", "push", "(", "visitante", ")", ";", "console", ".", "log", "(", "access_entrada", ")", ";", "$", "(", "\"#permisos\"", ")", ".", "slideUp", "(", "\"slow\"", ")", "$", "(", "'permisos'", ")", ".", "addClass", "(", "\"none\"", ")", ";", "$", "(", "\"#acceso__visita\"", ")", ".", "append", "(", "`", "${", "nombre", "}", "${", "apellido", "}", "`", ")", "$", "(", "'.login'", ")", ".", "addClass", "(", "'ingreso_autorizado'", ")", "}" ]
[ 172, 0 ]
[ 189, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
medianaSalarios
(lista)
null
Calculadora de Medianas
Calculadora de Medianas
function medianaSalarios(lista) { const mitad = parseInt(lista.length / 2); if (esPar(lista.length)) { const personitaMitad1 = lista[mitad - 1]; const personitaMitad2 = lista[mitad]; const mediana = calcularMediaAritmetica([personitaMitad1, personitaMitad2]); return mediana; } else { const personitaMitad = lista[mitad]; return personitaMitad; } }
[ "function", "medianaSalarios", "(", "lista", ")", "{", "const", "mitad", "=", "parseInt", "(", "lista", ".", "length", "/", "2", ")", ";", "if", "(", "esPar", "(", "lista", ".", "length", ")", ")", "{", "const", "personitaMitad1", "=", "lista", "[", "mitad", "-", "1", "]", ";", "const", "personitaMitad2", "=", "lista", "[", "mitad", "]", ";", "const", "mediana", "=", "calcularMediaAritmetica", "(", "[", "personitaMitad1", ",", "personitaMitad2", "]", ")", ";", "return", "mediana", ";", "}", "else", "{", "const", "personitaMitad", "=", "lista", "[", "mitad", "]", ";", "return", "personitaMitad", ";", "}", "}" ]
[ 20, 4 ]
[ 33, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
CalcularPrecioConDescuento
(precio, descuento)
null
console.log({ precioOriginal, descuento, porcetajePrecioConDescuento, precioConDescuento, })
console.log({ precioOriginal, descuento, porcetajePrecioConDescuento, precioConDescuento, })
function CalcularPrecioConDescuento(precio, descuento) { const porcetajePrecioConDescuento = 100 - descuento const precioConDescuento = (precio * porcetajePrecioConDescuento) / 100 return precioConDescuento }
[ "function", "CalcularPrecioConDescuento", "(", "precio", ",", "descuento", ")", "{", "const", "porcetajePrecioConDescuento", "=", "100", "-", "descuento", "const", "precioConDescuento", "=", "(", "precio", "*", "porcetajePrecioConDescuento", ")", "/", "100", "return", "precioConDescuento", "}" ]
[ 11, 0 ]
[ 16, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
htmlLista
(snap)
null
Muestra los datos enviados por el servidor. Si los datos cambian en el servidor, se vuelve a invocar esta función y recibe los datos actualizados. @param {import( "../lib/tiposFire.js"). QuerySnapshot} snap estructura parecida a un Array, que contiene una copia de los datos del servidor.
Muestra los datos enviados por el servidor. Si los datos cambian en el servidor, se vuelve a invocar esta función y recibe los datos actualizados.
function htmlLista(snap) { let html = ""; if (snap.size > 0) { /* Cuando el número de * documentos devueltos por la * consulta es mayor que 0, * revisa uno por uno los * documentos de la consulta y * los muestra. El iterador * "doc" apunta a un * documento de la base * de datos. */ snap.forEach(doc => html += htmlFila(doc)); } else { /* Cuando el número de * documentos devueltos por la * consulta es igual a 0, * agrega un texto HTML. */ html += /* html */ `<li class="vacio"> -- No hay mensajes registrados. -- </li>`; } lista.innerHTML = html; }
[ "function", "htmlLista", "(", "snap", ")", "{", "let", "html", "=", "\"\"", ";", "if", "(", "snap", ".", "size", ">", "0", ")", "{", "/* Cuando el número de\n * documentos devueltos por la\n * consulta es mayor que 0,\n * revisa uno por uno los\n * documentos de la consulta y\n * los muestra. El iterador\n * \"doc\" apunta a un\n * documento de la base\n * de datos. */", "snap", ".", "forEach", "(", "doc", "=>", "html", "+=", "htmlFila", "(", "doc", ")", ")", ";", "}", "else", "{", "/* Cuando el número de\n * documentos devueltos por la\n * consulta es igual a 0,\n * agrega un texto HTML. */", "html", "+=", "/* html */", "`", "`", ";", "}", "lista", ".", "innerHTML", "=", "html", ";", "}" ]
[ 103, 0 ]
[ 129, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
changeResult
()
null
Cambie const por let sino rompe
Cambie const por let sino rompe
function changeResult() { // the ability to access a variables defined in the same scope as the function is known as 'closure' result = "b"; }
[ "function", "changeResult", "(", ")", "{", "// the ability to access a variables defined in the same scope as the function is known as 'closure'", "result", "=", "\"b\"", ";", "}" ]
[ 6, 4 ]
[ 9, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
fecha
()
null
con el numero del get month() se asigan en el array para obtener el mes
con el numero del get month() se asigan en el array para obtener el mes
function fecha() { var tiempo = new Date(); var dia = tiempo.getDay(); //se obtiene un numero del 0 al 6 var fech = tiempo.getDate(); diasemana.textContent = semana[dia]; day.textContent = fech.toString(); var mes = tiempo.getMonth(); //se obtiene un numero del 0 al 11 month.textContent = meses[mes]; var año = tiempo.getFullYear(); year.textContent = año.toString(); var segundos = tiempo.getSeconds(); if (segundos < 10) { //para q los segundo a empezar no solo tengan un digito segundos = 0 + segundos; } var segundosGrados = (segundos / 60) * 360; seconds.style.transform = "rotate(" + segundosGrados + "deg)"; s.textContent = segundos.toString(); var minutos = tiempo.getMinutes(); if (minutos < 10) { minutos = 0 + minutos; //para q minutos al inicioar aparesca con un 0 } var minutosGrados = (minutos / 60) * 360; minute.style.transform = "rotate(" + minutosGrados + "deg)"; m.textContent = minutos.toString(); var horas = tiempo.getHours(); if (horas < 10) { horas = 0 + horas; //para q horas al inicioar aparesca con un 0 } var horasGrados = (horas / 12) * 360; hor.style.transform = "rotate(" + horasGrados + "deg)"; h.textContent = horas.toString(); }
[ "function", "fecha", "(", ")", "{", "var", "tiempo", "=", "new", "Date", "(", ")", ";", "var", "dia", "=", "tiempo", ".", "getDay", "(", ")", ";", "//se obtiene un numero del 0 al 6\r", "var", "fech", "=", "tiempo", ".", "getDate", "(", ")", ";", "diasemana", ".", "textContent", "=", "semana", "[", "dia", "]", ";", "day", ".", "textContent", "=", "fech", ".", "toString", "(", ")", ";", "var", "mes", "=", "tiempo", ".", "getMonth", "(", ")", ";", "//se obtiene un numero del 0 al 11\r", "month", ".", "textContent", "=", "meses", "[", "mes", "]", ";", "var", "año ", " ", "iempo.", "g", "etFullYear(", ")", ";", "\r", "year", ".", "textContent", "=", "año.", "t", "oString(", ")", ";", "\r", "var", "segundos", "=", "tiempo", ".", "getSeconds", "(", ")", ";", "if", "(", "segundos", "<", "10", ")", "{", "//para q los segundo a empezar no solo tengan un digito\r", "segundos", "=", "0", "+", "segundos", ";", "}", "var", "segundosGrados", "=", "(", "segundos", "/", "60", ")", "*", "360", ";", "seconds", ".", "style", ".", "transform", "=", "\"rotate(\"", "+", "segundosGrados", "+", "\"deg)\"", ";", "s", ".", "textContent", "=", "segundos", ".", "toString", "(", ")", ";", "var", "minutos", "=", "tiempo", ".", "getMinutes", "(", ")", ";", "if", "(", "minutos", "<", "10", ")", "{", "minutos", "=", "0", "+", "minutos", ";", "//para q minutos al inicioar aparesca con un 0\r", "}", "var", "minutosGrados", "=", "(", "minutos", "/", "60", ")", "*", "360", ";", "minute", ".", "style", ".", "transform", "=", "\"rotate(\"", "+", "minutosGrados", "+", "\"deg)\"", ";", "m", ".", "textContent", "=", "minutos", ".", "toString", "(", ")", ";", "var", "horas", "=", "tiempo", ".", "getHours", "(", ")", ";", "if", "(", "horas", "<", "10", ")", "{", "horas", "=", "0", "+", "horas", ";", "//para q horas al inicioar aparesca con un 0\r", "}", "var", "horasGrados", "=", "(", "horas", "/", "12", ")", "*", "360", ";", "hor", ".", "style", ".", "transform", "=", "\"rotate(\"", "+", "horasGrados", "+", "\"deg)\"", ";", "h", ".", "textContent", "=", "horas", ".", "toString", "(", ")", ";", "}" ]
[ 275, 0 ]
[ 307, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
prepareAndGetDateOptions
(options)
null
/* eslint-enable no-unreachable
/* eslint-enable no-unreachable
function prepareAndGetDateOptions (options) { options = options || {formatLength: 'short', selector: 'date and time'}; options.formatLength = options.formatLength || 'short'; options.selector = options.selector || 'date and time'; return convertToMomentLocalizedFormat(options); }
[ "function", "prepareAndGetDateOptions", "(", "options", ")", "{", "options", "=", "options", "||", "{", "formatLength", ":", "'short'", ",", "selector", ":", "'date and time'", "}", ";", "options", ".", "formatLength", "=", "options", ".", "formatLength", "||", "'short'", ";", "options", ".", "selector", "=", "options", ".", "selector", "||", "'date and time'", ";", "return", "convertToMomentLocalizedFormat", "(", "options", ")", ";", "}" ]
[ 120, 0 ]
[ 126, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(character,system,action)
null
Aqui añadiremos la funcionalidad de la hora.
Aqui añadiremos la funcionalidad de la hora.
function(character,system,action){ if((character.qualities.minutos+10) >59){ system.setQuality("minutos",character.qualities.minutos+10-60); system.setQuality("hora",character.qualities.hora+1); system.setQuality("ingrediente2",false); system.setQuality("amabilidad",true); system.doLink("casaamiga"); }else{ system.setQuality("minutos",character.qualities.minutos+10); system.setQuality("ingrediente2",false); system.setQuality("amabilidad",true); system.doLink("casaamiga"); } }
[ "function", "(", "character", ",", "system", ",", "action", ")", "{", "if", "(", "(", "character", ".", "qualities", ".", "minutos", "+", "10", ")", ">", "59", ")", "{", "system", ".", "setQuality", "(", "\"minutos\"", ",", "character", ".", "qualities", ".", "minutos", "+", "10", "-", "60", ")", ";", "system", ".", "setQuality", "(", "\"hora\"", ",", "character", ".", "qualities", ".", "hora", "+", "1", ")", ";", "system", ".", "setQuality", "(", "\"ingrediente2\"", ",", "false", ")", ";", "system", ".", "setQuality", "(", "\"amabilidad\"", ",", "true", ")", ";", "system", ".", "doLink", "(", "\"casaamiga\"", ")", ";", "}", "else", "{", "system", ".", "setQuality", "(", "\"minutos\"", ",", "character", ".", "qualities", ".", "minutos", "+", "10", ")", ";", "system", ".", "setQuality", "(", "\"ingrediente2\"", ",", "false", ")", ";", "system", ".", "setQuality", "(", "\"amabilidad\"", ",", "true", ")", ";", "system", ".", "doLink", "(", "\"casaamiga\"", ")", ";", "}", "}" ]
[ 210, 17 ]
[ 223, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
GuardarDatos
()
null
/*Guarda datos necesarios para estadisticas
/*Guarda datos necesarios para estadisticas
function GuardarDatos() { if (comprobarUso() && ModoCambiado == true) { var modo = localStorage.getItem("Modo"); if (modo == "auto") { localStorage.setItem("ModoEstadisticas", "Automático"); localStorage.setItem("Velocidad auto", arrayVelocidad); localStorage.setItem("Tiempo total auto", tiempo); } else if (modo == "manual") { localStorage.setItem("ModoEstadisticas", "Manual"); localStorage.setItem("Velocidad manual", arrayVelocidad); localStorage.setItem("Tiempo total manual", tiempo); } else { localStorage.setItem("ModoEstadisticas", "Por cotas"); localStorage.setItem("Velocidad cotas", arrayVelocidad); localStorage.setItem("Tiempo total cotas", tiempo); } window.open("pages/estadisticas.html"); } }
[ "function", "GuardarDatos", "(", ")", "{", "if", "(", "comprobarUso", "(", ")", "&&", "ModoCambiado", "==", "true", ")", "{", "var", "modo", "=", "localStorage", ".", "getItem", "(", "\"Modo\"", ")", ";", "if", "(", "modo", "==", "\"auto\"", ")", "{", "localStorage", ".", "setItem", "(", "\"ModoEstadisticas\"", ",", "\"Automático\")", ";", "", "localStorage", ".", "setItem", "(", "\"Velocidad auto\"", ",", "arrayVelocidad", ")", ";", "localStorage", ".", "setItem", "(", "\"Tiempo total auto\"", ",", "tiempo", ")", ";", "}", "else", "if", "(", "modo", "==", "\"manual\"", ")", "{", "localStorage", ".", "setItem", "(", "\"ModoEstadisticas\"", ",", "\"Manual\"", ")", ";", "localStorage", ".", "setItem", "(", "\"Velocidad manual\"", ",", "arrayVelocidad", ")", ";", "localStorage", ".", "setItem", "(", "\"Tiempo total manual\"", ",", "tiempo", ")", ";", "}", "else", "{", "localStorage", ".", "setItem", "(", "\"ModoEstadisticas\"", ",", "\"Por cotas\"", ")", ";", "localStorage", ".", "setItem", "(", "\"Velocidad cotas\"", ",", "arrayVelocidad", ")", ";", "localStorage", ".", "setItem", "(", "\"Tiempo total cotas\"", ",", "tiempo", ")", ";", "}", "window", ".", "open", "(", "\"pages/estadisticas.html\"", ")", ";", "}", "}" ]
[ 56, 0 ]
[ 74, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(coupons)
null
Ésta declaración Equivale a declararlo como funcion dentro del find
Ésta declaración Equivale a declararlo como funcion dentro del find
function(coupons){ return coupons.name === inputCoupon; }
[ "function", "(", "coupons", ")", "{", "return", "coupons", ".", "name", "===", "inputCoupon", ";", "}" ]
[ 20, 19 ]
[ 22, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
loadclases
()
null
codigo para cargar solo las clases asignadas al curso seleccionado
codigo para cargar solo las clases asignadas al curso seleccionado
function loadclases() { //obtenemos el id de la modalidad seleccionada var course = $("#courses").val(); var token = $("#token").val(); $.ajax({ url: "../ajax/clasesbycoursesid", headers: token, data: { course_id: course, _token: token }, type: "POST", datatype: "json", success: function (data) { //console.log(response); $("#clases").html(data); }, error: function (response) { console.log(response); }, }); }
[ "function", "loadclases", "(", ")", "{", "//obtenemos el id de la modalidad seleccionada", "var", "course", "=", "$", "(", "\"#courses\"", ")", ".", "val", "(", ")", ";", "var", "token", "=", "$", "(", "\"#token\"", ")", ".", "val", "(", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "\"../ajax/clasesbycoursesid\"", ",", "headers", ":", "token", ",", "data", ":", "{", "course_id", ":", "course", ",", "_token", ":", "token", "}", ",", "type", ":", "\"POST\"", ",", "datatype", ":", "\"json\"", ",", "success", ":", "function", "(", "data", ")", "{", "//console.log(response);", "$", "(", "\"#clases\"", ")", ".", "html", "(", "data", ")", ";", "}", ",", "error", ":", "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "}", ",", "}", ")", ";", "}" ]
[ 346, 0 ]
[ 365, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getComponent
()
null
Se obtiene dinamicamente los archivos
Se obtiene dinamicamente los archivos
async function getComponent(){ const element = document.createElement('div'); const { default: _ } = await import('lodash'); element.innerHTML = _; return element; }
[ "async", "function", "getComponent", "(", ")", "{", "const", "element", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "const", "{", "default", ":", "_", "}", "=", "await", "import", "(", "'lodash'", ")", ";", "element", ".", "innerHTML", "=", "_", ";", "return", "element", ";", "}" ]
[ 14, 0 ]
[ 19, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Girar
(Vec)
null
esta funcion intercabia el bloque izquierdo por el derecho
esta funcion intercabia el bloque izquierdo por el derecho
function Girar(Vec){ var Vec2 = new Array(); for(j=0 ;j< Vec.length ; j=j+2){ Vec2[j+1]=Vec[j]; Vec2[j]=Vec[j+1]; } return Vec2 }
[ "function", "Girar", "(", "Vec", ")", "{", "var", "Vec2", "=", "new", "Array", "(", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "Vec", ".", "length", ";", "j", "=", "j", "+", "2", ")", "{", "Vec2", "[", "j", "+", "1", "]", "=", "Vec", "[", "j", "]", ";", "Vec2", "[", "j", "]", "=", "Vec", "[", "j", "+", "1", "]", ";", "}", "return", "Vec2", "}" ]
[ 47, 0 ]
[ 54, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
empezarJuego
()
null
Finalmente, la función más importante, y que da inicio a toda la lógica del juego.
Finalmente, la función más importante, y que da inicio a toda la lógica del juego.
function empezarJuego() { window.juego = new Juego() }
[ "function", "empezarJuego", "(", ")", "{", "window", ".", "juego", "=", "new", "Juego", "(", ")", "}" ]
[ 174, 0 ]
[ 176, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
relleno_auto
(_e)
null
para llenar con jquery
para llenar con jquery
function relleno_auto (_e){ $("#permisos").append(`<section class="success" ><h3>Resultado: Autorizado</h3> <p>Visitante: ${_e.nombre} ${_e.apellido}</p> <p>Documento N° ${_e.documento}</p> <p>Empresa: ${_e.empresa}</p> <p>SCTR vigente hasta: ${_e.fin_sctr}</p> <h3>Datos del Vehículo</h3> <p>Placa: ${_e.placa}</p> <p>Marca: ${_e.marca}</p> <p>Modelo: ${_e.modelo}</p> <p>Color: ${_e.color}</p> <p>Pertenece a: ${_e.empresa_vehiculo}</p> </section> <section class="acceso"> <button class="button button--in" id="ingreso" onClick ="registro_ingreso()">Ingreso </button> <button class="button button--out" id="out" onClick ="registro_salida()">Salida </button> </section> <div> <button class="button button--volver" id="volver" onClick ="estado_inicial()">Regresar a Consulta </button> </div>`); }
[ "function", "relleno_auto", "(", "_e", ")", "{", "$", "(", "\"#permisos\"", ")", ".", "append", "(", "`", "${", "_e", ".", "nombre", "}", "${", "_e", ".", "apellido", "}", "{_", "e.", "d", "ocumento}", "<", "${", "_e", ".", "empresa", "}", "${", "_e", ".", "fin_sctr", "}", "${", "_e", ".", "placa", "}", "${", "_e", ".", "marca", "}", "${", "_e", ".", "modelo", "}", "${", "_e", ".", "color", "}", "${", "_e", ".", "empresa_vehiculo", "}", "`", ")", ";", "}" ]
[ 106, 0 ]
[ 129, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mostrarElementos
()
null
Mostrar elementos en creacion de cotizacion
Mostrar elementos en creacion de cotizacion
function mostrarElementos() { // Cookies.remove("products"); // Cookies.remove("market_id"); $("#productmarket_content").empty(); if(Cookies.get("products")!=null) { var productosArray=jQuery.parseJSON(Cookies.get("products")); var cont=productosArray.length; if(cont>0){ var maxElements=parseInt(productosArray.length); for(var i=0;i<maxElements;i++) { $("#productmarket_content").append("<div class='col-md-12' id='product"+productosArray[i].id+"' style='margin-bottom:25px;'><div class='col-md-3'><img src='"+productosArray[i].thumbnail+"' style='width:100%;'></div>"+ "<div class='col-md-3' style='font-size: 0.8em;'>"+ String(productosArray[i].description).substring(0, 30)+"</div>"+ "<div class='col-md-3'> $"+parseFloat(productosArray[i].subtotal).toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+"</div>"+ "<div class='col-md-3'>"+ "<button class='btn btn-danger btn-xs btn-delete-market-product' style='margin-bottom:10px;' id='"+i+"' value='"+productosArray[i].id+"'><i class='fa fa-minus' aria-hidden='true'></i></button>"+ "<button class='btn btn-info btn-xs btn-edit-product' value='"+productosArray[i].id+"'><i class='fa fa-pencil' aria-hidden='true'></i></button>"+ "</div></div>"); } } else { $("#productmarket_content").html("<span class='help-block'>Agregar productos</span>"); } } else { $("#productmarket_content").html("<span class='help-block'>Agregar productos</span>"); } }
[ "function", "mostrarElementos", "(", ")", "{", "// Cookies.remove(\"products\");", "// Cookies.remove(\"market_id\");", "$", "(", "\"#productmarket_content\"", ")", ".", "empty", "(", ")", ";", "if", "(", "Cookies", ".", "get", "(", "\"products\"", ")", "!=", "null", ")", "{", "var", "productosArray", "=", "jQuery", ".", "parseJSON", "(", "Cookies", ".", "get", "(", "\"products\"", ")", ")", ";", "var", "cont", "=", "productosArray", ".", "length", ";", "if", "(", "cont", ">", "0", ")", "{", "var", "maxElements", "=", "parseInt", "(", "productosArray", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "maxElements", ";", "i", "++", ")", "{", "$", "(", "\"#productmarket_content\"", ")", ".", "append", "(", "\"<div class='col-md-12' id='product\"", "+", "productosArray", "[", "i", "]", ".", "id", "+", "\"' style='margin-bottom:25px;'><div class='col-md-3'><img src='\"", "+", "productosArray", "[", "i", "]", ".", "thumbnail", "+", "\"' style='width:100%;'></div>\"", "+", "\"<div class='col-md-3' style='font-size: 0.8em;'>\"", "+", "String", "(", "productosArray", "[", "i", "]", ".", "description", ")", ".", "substring", "(", "0", ",", "30", ")", "+", "\"</div>\"", "+", "\"<div class='col-md-3'> $\"", "+", "parseFloat", "(", "productosArray", "[", "i", "]", ".", "subtotal", ")", ".", "toFixed", "(", "2", ")", ".", "replace", "(", "/", "(\\d)(?=(\\d\\d\\d)+(?!\\d))", "/", "g", ",", "\"$1,\"", ")", "+", "\"</div>\"", "+", "\"<div class='col-md-3'>\"", "+", "\"<button class='btn btn-danger btn-xs btn-delete-market-product' style='margin-bottom:10px;' id='\"", "+", "i", "+", "\"' value='\"", "+", "productosArray", "[", "i", "]", ".", "id", "+", "\"'><i class='fa fa-minus' aria-hidden='true'></i></button>\"", "+", "\"<button class='btn btn-info btn-xs btn-edit-product' value='\"", "+", "productosArray", "[", "i", "]", ".", "id", "+", "\"'><i class='fa fa-pencil' aria-hidden='true'></i></button>\"", "+", "\"</div></div>\"", ")", ";", "}", "}", "else", "{", "$", "(", "\"#productmarket_content\"", ")", ".", "html", "(", "\"<span class='help-block'>Agregar productos</span>\"", ")", ";", "}", "}", "else", "{", "$", "(", "\"#productmarket_content\"", ")", ".", "html", "(", "\"<span class='help-block'>Agregar productos</span>\"", ")", ";", "}", "}" ]
[ 331, 2 ]
[ 371, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
validarNombreSusc
()
null
Validar Nombre (estilos)
Validar Nombre (estilos)
function validarNombreSusc() { if (nombreSusc.value == '') { errorDivNomSusc.style.display = 'block'; errorDivNomSusc.innerHTML = "este campo es obligatorio"; nombreSusc.style.border = '3px solid #eeae00'; errorDivNomSusc.style.color = '#eeae00'; errorDivNomSusc.style.paddingTop = '5px'; return false; } else { errorDivNomSusc.style.display = 'none'; nombreSusc.style.border = 'none'; return true; } }
[ "function", "validarNombreSusc", "(", ")", "{", "if", "(", "nombreSusc", ".", "value", "==", "''", ")", "{", "errorDivNomSusc", ".", "style", ".", "display", "=", "'block'", ";", "errorDivNomSusc", ".", "innerHTML", "=", "\"este campo es obligatorio\"", ";", "nombreSusc", ".", "style", ".", "border", "=", "'3px solid #eeae00'", ";", "errorDivNomSusc", ".", "style", ".", "color", "=", "'#eeae00'", ";", "errorDivNomSusc", ".", "style", ".", "paddingTop", "=", "'5px'", ";", "return", "false", ";", "}", "else", "{", "errorDivNomSusc", ".", "style", ".", "display", "=", "'none'", ";", "nombreSusc", ".", "style", ".", "border", "=", "'none'", ";", "return", "true", ";", "}", "}" ]
[ 367, 8 ]
[ 380, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
(node)
null
var y = {x: 'y'}
var y = {x: 'y'}
function (node) { if (node.properties.length === 0) { return } var first = context.getFirstToken(node) var second = context.getFirstToken(node, 1) var penultimate = context.getLastToken(node, 1) var last = context.getLastToken(node) validateBraceSpacing(node, first, second, penultimate, last) }
[ "function", "(", "node", ")", "{", "if", "(", "node", ".", "properties", ".", "length", "===", "0", ")", "{", "return", "}", "var", "first", "=", "context", ".", "getFirstToken", "(", "node", ")", "var", "second", "=", "context", ".", "getFirstToken", "(", "node", ",", "1", ")", "var", "penultimate", "=", "context", ".", "getLastToken", "(", "node", ",", "1", ")", "var", "last", "=", "context", ".", "getLastToken", "(", "node", ")", "validateBraceSpacing", "(", "node", ",", "first", ",", "second", ",", "penultimate", ",", "last", ")", "}" ]
[ 237, 24 ]
[ 248, 7 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
click
(event)
null
destroy todo
destroy todo
async function click(event) { let key = event.target.dataset.key let res = await destroy({key}) await render(res) }
[ "async", "function", "click", "(", "event", ")", "{", "let", "key", "=", "event", ".", "target", ".", "dataset", ".", "key", "let", "res", "=", "await", "destroy", "(", "{", "key", "}", ")", "await", "render", "(", "res", ")", "}" ]
[ 63, 0 ]
[ 67, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program
listarHoteles
()
null
Metodo para listar las noticias almacenadas en la BD
Metodo para listar las noticias almacenadas en la BD
function listarHoteles() { listadoHotel.innerHTML = ""; db.collection("Hoteles").get().then((querySnapshot) => { querySnapshot.forEach(async (doc) => { listadoHotel.innerHTML += ` <tr> <td>${doc.data().nombreHotel}</td> <td>${doc.data().Direccion}</td> <td>${doc.data().Correo}</td> <td>${doc.data().Telefono}</td> <td> <button type="button" onclick="LeerHotel('${doc.id}')" class="btn btn-default fas fa-edit"></button> <button type="button" onclick="BorrarHotel('${doc.id}')" class="btn btn-default fas fa-trash-alt"></button> </td> </tr> `; }); }); }
[ "function", "listarHoteles", "(", ")", "{", "listadoHotel", ".", "innerHTML", "=", "\"\"", ";", "db", ".", "collection", "(", "\"Hoteles\"", ")", ".", "get", "(", ")", ".", "then", "(", "(", "querySnapshot", ")", "=>", "{", "querySnapshot", ".", "forEach", "(", "async", "(", "doc", ")", "=>", "{", "listadoHotel", ".", "innerHTML", "+=", "`", "${", "doc", ".", "data", "(", ")", ".", "nombreHotel", "}", "${", "doc", ".", "data", "(", ")", ".", "Direccion", "}", "${", "doc", ".", "data", "(", ")", ".", "Correo", "}", "${", "doc", ".", "data", "(", ")", ".", "Telefono", "}", "${", "doc", ".", "id", "}", "${", "doc", ".", "id", "}", "`", ";", "}", ")", ";", "}", ")", ";", "}" ]
[ 74, 0 ]
[ 93, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
jc:2020.06.11:14:30: las funciones neo y draw fueron extraidas de la siguiente url: https://thecodeplayer.com/walkthrough/matrix-rain-animation-html5-canvas-javascript
jc:2020.06.11:14:30: las funciones neo y draw fueron extraidas de la siguiente url: https://thecodeplayer.com/walkthrough/matrix-rain-animation-html5-canvas-javascript
function(){ this.c = document.getElementById("default_matrix_canvas"); this.ctx = this.c.getContext("2d"); this.c.height = window.innerHeight; this.c.width = window.innerWidth; //chinese characters - taken from the unicode charset this.chinese = "田由甲申甴电甶男甸甹町画甼甽甾甿畀畁畂畃畄畅畆畇畈畉畊畋界畍畎畏畐畑";// //converting the string into an array of single characters this.chinese = this.chinese.split(""); this.font_size = 10; this.columns = this.c.width/this.font_size; //number of columns for the rain //an array of drops - one per column this.drops = []; //x below is the x coordinate //1 = y co-ordinate of the drop(same for every drop initially) for(let x = 0; x < this.columns; x++){ this.drops[x] = 1; } }
[ "function", "(", ")", "{", "this", ".", "c", "=", "document", ".", "getElementById", "(", "\"default_matrix_canvas\"", ")", ";", "this", ".", "ctx", "=", "this", ".", "c", ".", "getContext", "(", "\"2d\"", ")", ";", "this", ".", "c", ".", "height", "=", "window", ".", "innerHeight", ";", "this", ".", "c", ".", "width", "=", "window", ".", "innerWidth", ";", "//chinese characters - taken from the unicode charset", "this", ".", "chinese", "=", "\"田由甲申甴电甶男甸甹町画甼甽甾甿畀畁畂畃畄畅畆畇畈畉畊畋界畍畎畏畐畑\";//", "", "", "//converting the string into an array of single characters", "this", ".", "chinese", "=", "this", ".", "chinese", ".", "split", "(", "\"\"", ")", ";", "this", ".", "font_size", "=", "10", ";", "this", ".", "columns", "=", "this", ".", "c", ".", "width", "/", "this", ".", "font_size", ";", "//number of columns for the rain", "//an array of drops - one per column", "this", ".", "drops", "=", "[", "]", ";", "//x below is the x coordinate", "//1 = y co-ordinate of the drop(same for every drop initially)", "for", "(", "let", "x", "=", "0", ";", "x", "<", "this", ".", "columns", ";", "x", "++", ")", "{", "this", ".", "drops", "[", "x", "]", "=", "1", ";", "}", "}" ]
[ 48, 6 ]
[ 70, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
validateCategory
()
null
Función para validar select de categorias
Función para validar select de categorias
function validateCategory(){ var i=$('select[name="category"] > option').length; if(i<=1){ Swal.fire( 'No hay presupuesto para compras!', 'Comuniquese con la persona encargada.', 'warning' ) } }
[ "function", "validateCategory", "(", ")", "{", "var", "i", "=", "$", "(", "'select[name=\"category\"] > option'", ")", ".", "length", ";", "if", "(", "i", "<=", "1", ")", "{", "Swal", ".", "fire", "(", "'No hay presupuesto para compras!'", ",", "'Comuniquese con la persona encargada.'", ",", "'warning'", ")", "}", "}" ]
[ 59, 0 ]
[ 68, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Import para las alertas Imports para los iconos
Import para las alertas Imports para los iconos
function () { return { lineNumbers: true, theme: "material-ocean", mode: "xml" }; }
[ "function", "(", ")", "{", "return", "{", "lineNumbers", ":", "true", ",", "theme", ":", "\"material-ocean\"", ",", "mode", ":", "\"xml\"", "}", ";", "}" ]
[ 139, 12 ]
[ 139, 95 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
winner
()
null
Final Funcion para comparar los resultados// funcion para acabar el juego cuando uno de los dos llegue a 5
Final Funcion para comparar los resultados// funcion para acabar el juego cuando uno de los dos llegue a 5
function winner(){ if (counterUser == 5){ return alert('User Wins! please press F5 to play again.'); }else if (counterComputer == 5){ return alert ('Computer Wins! please press F5 to play agai.'); }; }
[ "function", "winner", "(", ")", "{", "if", "(", "counterUser", "==", "5", ")", "{", "return", "alert", "(", "'User Wins! please press F5 to play again.'", ")", ";", "}", "else", "if", "(", "counterComputer", "==", "5", ")", "{", "return", "alert", "(", "'Computer Wins! please press F5 to play agai.'", ")", ";", "}", ";", "}" ]
[ 44, 0 ]
[ 50, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Delete
(id_)
null
funcion para eliminar valor seleccionado
funcion para eliminar valor seleccionado
function Delete(id_) { id = id_; $('#modal_eliminar').modal('show'); }
[ "function", "Delete", "(", "id_", ")", "{", "id", "=", "id_", ";", "$", "(", "'#modal_eliminar'", ")", ".", "modal", "(", "'show'", ")", ";", "}" ]
[ 184, 0 ]
[ 187, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
myFunction
( texto )
null
Función predeterminada que nos ayuda a imprimir en consola y además a modificar el resultado.
Función predeterminada que nos ayuda a imprimir en consola y además a modificar el resultado.
function myFunction( texto ) { // Seleccionar Elemento con clase "resultado" const resultado = document.querySelector('.resultado'); // Modificar el contenido del elemento seleccionado. resultado.textContent = `${texto}`; // Imprimir en la consola de nuestro navegador. console.log(texto) }
[ "function", "myFunction", "(", "texto", ")", "{", "// Seleccionar Elemento con clase \"resultado\"", "const", "resultado", "=", "document", ".", "querySelector", "(", "'.resultado'", ")", ";", "// Modificar el contenido del elemento seleccionado.", "resultado", ".", "textContent", "=", "`", "${", "texto", "}", "`", ";", "// Imprimir en la consola de nuestro navegador.", "console", ".", "log", "(", "texto", ")", "}" ]
[ 105, 0 ]
[ 112, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
validar_registro_contraseña_repetida(
)
null
Validar contraseña repetida
Validar contraseña repetida
function validar_registro_contraseña_repetida() { try { let contraseña = document.getElementById("contraseña").value; let contraseña_repetida = document.getElementById("contraseña_repetida").value; // Si no esta vacía if (contraseña_repetida) { if (contraseña == contraseña_repetida) { document.getElementById("contraseña_repetida").style.borderColor = ""; document.getElementsByClassName("error_contraseña_repetida")[0].innerHTML = ""; return true; } else { throw "La contraseña no coincide"; } } else { throw "Este campo es obligatorio"; } } catch(error) { document.getElementById("contraseña_repetida").style.borderColor = "rgba(255, 0, 0, 0.6)"; document.getElementsByClassName("error_contraseña_repetida")[0].innerHTML = error; return false; } }
[ "function", "validar_registro_contraseña_repetida(", ")", " ", "", "try", "{", "let", "contraseña ", " ", "ocument.", "g", "etElementById(", "\"", "contraseña\").", "v", "a", "lue;", "", "let", "contraseña_repetida ", " ", "ocument.", "g", "etElementById(", "\"", "contraseña_repetida\").", "v", "a", "lue;", "", "// Si no esta vacía", "if", "(", "contraseña_repetida)", " ", "", "if", "(", "contraseña ", "= ", "ontraseña_repetida) ", "{", "", "document", ".", "getElementById", "(", "\"contraseña_repetida\")", ".", "s", "tyle.", "b", "orderColor ", " ", "\";", "", "document", ".", "getElementsByClassName", "(", "\"error_contraseña_repetida\")", "[", "0", "]", ".", "i", "nnerHTML ", " ", "\";", "", "return", "true", ";", "}", "else", "{", "throw", "\"La contraseña no coincide\";", "", "}", "}", "else", "{", "throw", "\"Este campo es obligatorio\"", ";", "}", "}", "catch", "(", "error", ")", "{", "document", ".", "getElementById", "(", "\"contraseña_repetida\")", ".", "s", "tyle.", "b", "orderColor ", " ", "rgba(255, 0, 0, 0.6)\";", "", "document", ".", "getElementsByClassName", "(", "\"error_contraseña_repetida\")", "[", "0", "]", ".", "i", "nnerHTML ", " ", "rror;", "", "return", "false", ";", "}", "}" ]
[ 160, 0 ]
[ 187, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
editarPropietario
(ente_id)
null
Traer datos de Propietario
Traer datos de Propietario
function editarPropietario(ente_id) { const url = '/propietarios/' + ente_id + '/edit' const formPropietarioUpdate = document.getElementById('formPropietarioUpdate'); fetch(url, { method: 'GET', mode: "cors", headers: { accept: "application/json", 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }) .then(response => { if (response.ok) { response.json().then(success => { formPropietarioUpdate.id.value = success.id; formPropietarioUpdate.nombre.value = success.nombre; formPropietarioUpdate.apellido.value = success.apellido; formPropietarioUpdate.email.value = success.email; formPropietarioUpdate.tipo_identificacion.value = success.tipo_identificacion; formPropietarioUpdate.identificacion.value = success.identificacion; formPropietarioUpdate.direccion.value = success.direccion; formPropietarioUpdate.ciudad.value = success.ciudad; formPropietarioUpdate.departamento.value = success.departamento; formPropietarioUpdate.barrio.value = success.barrio; formPropietarioUpdate.telefono.value = success.telefono; formPropietarioUpdate.opcional_telefono.value = success.opcional_telefono $('#modalPropietarioUpdate').modal('show') }); } }) .catch(error => { console.log('request failed'); }); }
[ "function", "editarPropietario", "(", "ente_id", ")", "{", "const", "url", "=", "'/propietarios/'", "+", "ente_id", "+", "'/edit'", "const", "formPropietarioUpdate", "=", "document", ".", "getElementById", "(", "'formPropietarioUpdate'", ")", ";", "fetch", "(", "url", ",", "{", "method", ":", "'GET'", ",", "mode", ":", "\"cors\"", ",", "headers", ":", "{", "accept", ":", "\"application/json\"", ",", "'X-CSRF-TOKEN'", ":", "$", "(", "'meta[name=\"csrf-token\"]'", ")", ".", "attr", "(", "'content'", ")", "}", "}", ")", ".", "then", "(", "response", "=>", "{", "if", "(", "response", ".", "ok", ")", "{", "response", ".", "json", "(", ")", ".", "then", "(", "success", "=>", "{", "formPropietarioUpdate", ".", "id", ".", "value", "=", "success", ".", "id", ";", "formPropietarioUpdate", ".", "nombre", ".", "value", "=", "success", ".", "nombre", ";", "formPropietarioUpdate", ".", "apellido", ".", "value", "=", "success", ".", "apellido", ";", "formPropietarioUpdate", ".", "email", ".", "value", "=", "success", ".", "email", ";", "formPropietarioUpdate", ".", "tipo_identificacion", ".", "value", "=", "success", ".", "tipo_identificacion", ";", "formPropietarioUpdate", ".", "identificacion", ".", "value", "=", "success", ".", "identificacion", ";", "formPropietarioUpdate", ".", "direccion", ".", "value", "=", "success", ".", "direccion", ";", "formPropietarioUpdate", ".", "ciudad", ".", "value", "=", "success", ".", "ciudad", ";", "formPropietarioUpdate", ".", "departamento", ".", "value", "=", "success", ".", "departamento", ";", "formPropietarioUpdate", ".", "barrio", ".", "value", "=", "success", ".", "barrio", ";", "formPropietarioUpdate", ".", "telefono", ".", "value", "=", "success", ".", "telefono", ";", "formPropietarioUpdate", ".", "opcional_telefono", ".", "value", "=", "success", ".", "opcional_telefono", "$", "(", "'#modalPropietarioUpdate'", ")", ".", "modal", "(", "'show'", ")", "}", ")", ";", "}", "}", ")", ".", "catch", "(", "error", "=>", "{", "console", ".", "log", "(", "'request failed'", ")", ";", "}", ")", ";", "}" ]
[ 145, 0 ]
[ 178, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
eliminarPropietario
(ente_id)
null
Eliminar Propietario
Eliminar Propietario
function eliminarPropietario(ente_id) { toastr.options.preventDuplicates = true; toastr.warning("<br /><button class='btn btn-sm btn-danger m-1' type='button' value='yes'>Yes</button> <button class='btn btn-sm btn-dark m-1' type ='button' value='no' > No </button>", 'Desea eliminar este elemento ?', { allowHtml: true, onclick: function (toast) { value = toast.target.value if (value == 'yes') { const url = '/propietarios/' + ente_id fetch(url, { method: 'DELETE', mode: "cors", headers: { accept: "application/json", 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }) .then(response => { if (response.ok) { response.text().then(success => { dtPropietarios.draw(); toastr.remove() toastr.info('Success:', success); }); } }) .catch(error => { console.log('request failed'); }); } else { toastr.remove() } } }); }
[ "function", "eliminarPropietario", "(", "ente_id", ")", "{", "toastr", ".", "options", ".", "preventDuplicates", "=", "true", ";", "toastr", ".", "warning", "(", "\"<br /><button class='btn btn-sm btn-danger m-1' type='button' value='yes'>Yes</button> <button class='btn btn-sm btn-dark m-1' type ='button' value='no' > No </button>\"", ",", "'Desea eliminar este elemento ?'", ",", "{", "allowHtml", ":", "true", ",", "onclick", ":", "function", "(", "toast", ")", "{", "value", "=", "toast", ".", "target", ".", "value", "if", "(", "value", "==", "'yes'", ")", "{", "const", "url", "=", "'/propietarios/'", "+", "ente_id", "fetch", "(", "url", ",", "{", "method", ":", "'DELETE'", ",", "mode", ":", "\"cors\"", ",", "headers", ":", "{", "accept", ":", "\"application/json\"", ",", "'X-CSRF-TOKEN'", ":", "$", "(", "'meta[name=\"csrf-token\"]'", ")", ".", "attr", "(", "'content'", ")", "}", "}", ")", ".", "then", "(", "response", "=>", "{", "if", "(", "response", ".", "ok", ")", "{", "response", ".", "text", "(", ")", ".", "then", "(", "success", "=>", "{", "dtPropietarios", ".", "draw", "(", ")", ";", "toastr", ".", "remove", "(", ")", "toastr", ".", "info", "(", "'Success:'", ",", "success", ")", ";", "}", ")", ";", "}", "}", ")", ".", "catch", "(", "error", "=>", "{", "console", ".", "log", "(", "'request failed'", ")", ";", "}", ")", ";", "}", "else", "{", "toastr", ".", "remove", "(", ")", "}", "}", "}", ")", ";", "}" ]
[ 109, 0 ]
[ 142, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program