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
perimetroCirculo
(radio)
null
CÓDIGO DE LA CIRCUNFERENCIA
CÓDIGO DE LA CIRCUNFERENCIA
function perimetroCirculo(radio){ return 2*Math.PI*radio; }
[ "function", "perimetroCirculo", "(", "radio", ")", "{", "return", "2", "*", "Math", ".", "PI", "*", "radio", ";", "}" ]
[ 19, 0 ]
[ 21, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
actualizarPagina
()
null
Actualiza posicionamiento de los elementos según librería.
Actualiza posicionamiento de los elementos según librería.
function actualizarPagina() { grid.refreshItems().layout(); }
[ "function", "actualizarPagina", "(", ")", "{", "grid", ".", "refreshItems", "(", ")", ".", "layout", "(", ")", ";", "}" ]
[ 8, 0 ]
[ 10, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
registrar_tiempoPlanificacion
()
null
funcion para registar tiempo de planificacion
funcion para registar tiempo de planificacion
function registrar_tiempoPlanificacion(){ var token = new $('#token').val(); var datos = new FormData($("#frmIngresarTiempoPlanificacion")[0]); $.ajax({ url:"/app/tiempoPlanificacion", 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("Tiempo de Planificacion Registrado Correctamente..!!", "", "success"); document.getElementById("frmIngresarTiempoPlanificacion").reset(); $("#myModal_IngresarTiempoPlanificacion").modal("hide"); $("#datatable").load("/lista_tiempoPlanificacion"); } } }); }
[ "function", "registrar_tiempoPlanificacion", "(", ")", "{", "var", "token", "=", "new", "$", "(", "'#token'", ")", ".", "val", "(", ")", ";", "var", "datos", "=", "new", "FormData", "(", "$", "(", "\"#frmIngresarTiempoPlanificacion\"", ")", "[", "0", "]", ")", ";", "$", ".", "ajax", "(", "{", "url", ":", "\"/app/tiempoPlanificacion\"", ",", "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", "(", "\"Tiempo de Planificacion Registrado Correctamente..!!\"", ",", "\"\"", ",", "\"success\"", ")", ";", "document", ".", "getElementById", "(", "\"frmIngresarTiempoPlanificacion\"", ")", ".", "reset", "(", ")", ";", "$", "(", "\"#myModal_IngresarTiempoPlanificacion\"", ")", ".", "modal", "(", "\"hide\"", ")", ";", "$", "(", "\"#datatable\"", ")", ".", "load", "(", "\"/lista_tiempoPlanificacion\"", ")", ";", "}", "}", "}", ")", ";", "}" ]
[ 100, 0 ]
[ 122, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Añadimos un get para identificar el estdo
Añadimos un get para identificar el estdo
function () { return this._id; }
[ "function", "(", ")", "{", "return", "this", ".", "_id", ";", "}" ]
[ 24, 13 ]
[ 26, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
()
null
generamos el token
generamos el token
function () { return Math.random().toString(36).substr(2); // remove `0.` }
[ "function", "(", ")", "{", "return", "Math", ".", "random", "(", ")", ".", "toString", "(", "36", ")", ".", "substr", "(", "2", ")", ";", "// remove `0.`", "}" ]
[ 27, 19 ]
[ 29, 7 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
(elemento)
null
.map() ejecuta la función por cada elemento
.map() ejecuta la función por cada elemento
function (elemento) { // el parámetro 'elemento' evalua cada elemento del array // Las condicionales verifican si los elementos del array se repiten o solo existe un solo elemento sel mismo valor if (lista1Count[elemento]) { // cuando el elemento existe lista1Count[elemento] += 1; // se le agrega 1 cuando existía el elemento previamente } else { // Cuando el elemento no existe previamente lista1Count[elemento] = 1; // Es igual a uno ta que solo existe una vez } }
[ "function", "(", "elemento", ")", "{", "// el parámetro 'elemento' evalua cada elemento del array", "// Las condicionales verifican si los elementos del array se repiten o solo existe un solo elemento sel mismo valor", "if", "(", "lista1Count", "[", "elemento", "]", ")", "{", "// cuando el elemento existe", "lista1Count", "[", "elemento", "]", "+=", "1", ";", "// se le agrega 1 cuando existía el elemento previamente", "}", "else", "{", "// Cuando el elemento no existe previamente", "lista1Count", "[", "elemento", "]", "=", "1", ";", "// Es igual a uno ta que solo existe una vez", "}", "}" ]
[ 17, 4 ]
[ 24, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
arguments
App
()
null
Va a hacer de método render de la clase compoennts /* Esa funci´n la puedo renderizar en index
Va a hacer de método render de la clase compoennts /* Esa funci´n la puedo renderizar en index
function App(){ return ( <BrowserRouter> <Layout> <Switch> <Route exact path="/badges" component={Badges} /> <Route exact path="/badges/new" component={BadgeNew} /> <Route exact path="/404" component={NotFound} /> <Redirect from="*" to="/404" /> </Switch> </Layout> </BrowserRouter> ) }
[ "function", "App", "(", ")", "{", "return", "(", "<", "BrowserRouter", ">", "\r\n ", "<", "Layout", ">", "\r\n ", "<", "Switch", ">", "\r\n ", "<", "Route", "exact", "path", "=", "\"/badges\"", "component", "=", "{", "Badges", "}", "/", ">", "\r\n \r\n ", "<", "Route", "exact", "path", "=", "\"/badges/new\"", "component", "=", "{", "BadgeNew", "}", "/", ">", "\r\n\r\n ", "<", "Route", "exact", "path", "=", "\"/404\"", "component", "=", "{", "NotFound", "}", "/", ">", "\r\n ", "<", "Redirect", "from", "=", "\"*\"", "to", "=", "\"/404\"", "/", ">", "\r\n \r\n ", "<", "/", "Switch", ">", "\r\n ", "<", "/", "Layout", ">", "\r\n ", "<", "/", "BrowserRouter", ">", ")", "}" ]
[ 10, 0 ]
[ 28, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
get_idubicacion
(idsearch)
null
funcion para manuel
funcion para manuel
function get_idubicacion(idsearch) { var _token = $('input[name="_token"]').val(); $.ajax({ type: "POST", url: "/get_idubication_pay", data: { data_one: idsearch, _token: _token }, success: function(data) { //console.log(data); $('#idUbication').val(data); }, error: function(data) { console.log('Error:', data); } }); }
[ "function", "get_idubicacion", "(", "idsearch", ")", "{", "var", "_token", "=", "$", "(", "'input[name=\"_token\"]'", ")", ".", "val", "(", ")", ";", "$", ".", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "\"/get_idubication_pay\"", ",", "data", ":", "{", "data_one", ":", "idsearch", ",", "_token", ":", "_token", "}", ",", "success", ":", "function", "(", "data", ")", "{", "//console.log(data);", "$", "(", "'#idUbication'", ")", ".", "val", "(", "data", ")", ";", "}", ",", "error", ":", "function", "(", "data", ")", "{", "console", ".", "log", "(", "'Error:'", ",", "data", ")", ";", "}", "}", ")", ";", "}" ]
[ 1095, 0 ]
[ 1112, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mostrarHTML
()
null
vamos a mostrar el HTML en el carrito para que se puedan visualizar los cursos que seleccionemos
vamos a mostrar el HTML en el carrito para que se puedan visualizar los cursos que seleccionemos
function mostrarHTML() { limpiarHTML() articulosCarrito.forEach(curso => { const lista = document.createElement('tr') lista.innerHTML = ` <img src ='${curso.imagen}' width = '100'> <td>${curso.titulo}</td> <td>$${curso.precio}</td> <td>${curso.cantidad}</td> <td> <a href= '#' class='borrar-curso' data-id='${curso.id}'> X </a> </td> ` tbody.appendChild(lista) }) }
[ "function", "mostrarHTML", "(", ")", "{", "limpiarHTML", "(", ")", "articulosCarrito", ".", "forEach", "(", "curso", "=>", "{", "const", "lista", "=", "document", ".", "createElement", "(", "'tr'", ")", "lista", ".", "innerHTML", "=", "`", "${", "curso", ".", "imagen", "}", "${", "curso", ".", "titulo", "}", "${", "curso", ".", "precio", "}", "${", "curso", ".", "cantidad", "}", "${", "curso", ".", "id", "}", "`", "tbody", ".", "appendChild", "(", "lista", ")", "}", ")", "}" ]
[ 122, 0 ]
[ 141, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getTodo
(req, res, next)
null
end getTodos
end getTodos
function getTodo(req, res, next) { var id = req.params.id Todo.get(id) .then((todo) => { return res.json({ data: todo, status: 'ok' }) }) .catch((e) => { return next({ message: e.message, status: e.status, stack: e }) }) }
[ "function", "getTodo", "(", "req", ",", "res", ",", "next", ")", "{", "var", "id", "=", "req", ".", "params", ".", "id", "Todo", ".", "get", "(", "id", ")", ".", "then", "(", "(", "todo", ")", "=>", "{", "return", "res", ".", "json", "(", "{", "data", ":", "todo", ",", "status", ":", "'ok'", "}", ")", "}", ")", ".", "catch", "(", "(", "e", ")", "=>", "{", "return", "next", "(", "{", "message", ":", "e", ".", "message", ",", "status", ":", "e", ".", "status", ",", "stack", ":", "e", "}", ")", "}", ")", "}" ]
[ 42, 0 ]
[ 59, 1 ]
null
javascript
es
['es', 'es', 'es']
False
true
program
renderFavorites
()
null
Pinta las tarjetas de favoritos se ejecuta con el click en la tarjeta
Pinta las tarjetas de favoritos se ejecuta con el click en la tarjeta
function renderFavorites() { let listFavorite = ""; for (const favfilm of arrayFavorite) { listFavorite += `<li class="fav">`; if (favfilm.show.image !== null) { listFavorite += `<img src="${favfilm.show.image.medium}" alt="${favfilm.show.name}" height="150px">`; } else { listFavorite += `<img src="https://via.placeholder.com/210x295/ffffff/666666/?text=TV" alt="${favfilm.show.name}" height="150px">`; } listFavorite += `<h2>${favfilm.show.name}</h2>`; listFavorite += `<div data-id="${favfilm.show.id}" class="js-shows container-delete"><p class="text">Elimina</p></div>`; listFavorite += `</li>`; } favoritecontainer.innerHTML = listFavorite; addListenShow(); }
[ "function", "renderFavorites", "(", ")", "{", "let", "listFavorite", "=", "\"\"", ";", "for", "(", "const", "favfilm", "of", "arrayFavorite", ")", "{", "listFavorite", "+=", "`", "`", ";", "if", "(", "favfilm", ".", "show", ".", "image", "!==", "null", ")", "{", "listFavorite", "+=", "`", "${", "favfilm", ".", "show", ".", "image", ".", "medium", "}", "${", "favfilm", ".", "show", ".", "name", "}", "`", ";", "}", "else", "{", "listFavorite", "+=", "`", "${", "favfilm", ".", "show", ".", "name", "}", "`", ";", "}", "listFavorite", "+=", "`", "${", "favfilm", ".", "show", ".", "name", "}", "`", ";", "listFavorite", "+=", "`", "${", "favfilm", ".", "show", ".", "id", "}", "`", ";", "listFavorite", "+=", "`", "`", ";", "}", "favoritecontainer", ".", "innerHTML", "=", "listFavorite", ";", "addListenShow", "(", ")", ";", "}" ]
[ 2, 0 ]
[ 18, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
crearEntrada
()
null
/* Carga la página de crear tema
/* Carga la página de crear tema
function crearEntrada() { $.ajax({ url: "pages/crearTema.php", success: function (result) { $("#mainContenido").html(result); } }); if (screen.width < 1030) { ocultarCaja(); } }
[ "function", "crearEntrada", "(", ")", "{", "$", ".", "ajax", "(", "{", "url", ":", "\"pages/crearTema.php\"", ",", "success", ":", "function", "(", "result", ")", "{", "$", "(", "\"#mainContenido\"", ")", ".", "html", "(", "result", ")", ";", "}", "}", ")", ";", "if", "(", "screen", ".", "width", "<", "1030", ")", "{", "ocultarCaja", "(", ")", ";", "}", "}" ]
[ 54, 0 ]
[ 64, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mark_open
(e)
null
Marcar como abierta
Marcar como abierta
function mark_open(e){ var valor= e.getAttribute('value'); var _token = $('meta[name="csrf-token"]').attr('content'); var folio = e.getAttribute('datas'); Swal.fire({ title: '¿Estás seguro?', text: "Se marcara como abierta, la nota de credito con folio: "+folio, type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Aceptar', cancelButtonText: 'Cancelar' }).then((result) => { if (result.value) { $.ajax({ type: "POST", url: '/sales/customer-credit-notes/mark-open', data: {token_b : valor, _token : _token}, success: function (data) { if(data.status == 200){ Swal.fire('Operación completada!', '', 'success') .then(()=> { location.href ="/sales/credit-notes-history"; }); } else { Swal.fire({ type: 'error', title: 'Oops... Error: '+data.status, text: 'El recurso no se ha modificado', }); } }, error: function (err) { Swal.fire({ type: 'error', title: 'Oops...', text: err.statusText, }); } }) } }); }
[ "function", "mark_open", "(", "e", ")", "{", "var", "valor", "=", "e", ".", "getAttribute", "(", "'value'", ")", ";", "var", "_token", "=", "$", "(", "'meta[name=\"csrf-token\"]'", ")", ".", "attr", "(", "'content'", ")", ";", "var", "folio", "=", "e", ".", "getAttribute", "(", "'datas'", ")", ";", "Swal", ".", "fire", "(", "{", "title", ":", "'¿Estás seguro?',", "", "text", ":", "\"Se marcara como abierta, la nota de credito con folio: \"", "+", "folio", ",", "type", ":", "'warning'", ",", "showCancelButton", ":", "true", ",", "confirmButtonColor", ":", "'#3085d6'", ",", "cancelButtonColor", ":", "'#d33'", ",", "confirmButtonText", ":", "'Aceptar'", ",", "cancelButtonText", ":", "'Cancelar'", "}", ")", ".", "then", "(", "(", "result", ")", "=>", "{", "if", "(", "result", ".", "value", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "\"POST\"", ",", "url", ":", "'/sales/customer-credit-notes/mark-open'", ",", "data", ":", "{", "token_b", ":", "valor", ",", "_token", ":", "_token", "}", ",", "success", ":", "function", "(", "data", ")", "{", "if", "(", "data", ".", "status", "==", "200", ")", "{", "Swal", ".", "fire", "(", "'Operación completada!',", " ", "',", " ", "success')", "", ".", "then", "(", "(", ")", "=>", "{", "location", ".", "href", "=", "\"/sales/credit-notes-history\"", ";", "}", ")", ";", "}", "else", "{", "Swal", ".", "fire", "(", "{", "type", ":", "'error'", ",", "title", ":", "'Oops... Error: '", "+", "data", ".", "status", ",", "text", ":", "'El recurso no se ha modificado'", ",", "}", ")", ";", "}", "}", ",", "error", ":", "function", "(", "err", ")", "{", "Swal", ".", "fire", "(", "{", "type", ":", "'error'", ",", "title", ":", "'Oops...'", ",", "text", ":", "err", ".", "statusText", ",", "}", ")", ";", "}", "}", ")", "}", "}", ")", ";", "}" ]
[ 391, 0 ]
[ 435, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
getCookie
(name)
null
obtener el token de las cookies
obtener el token de las cookies
function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; }
[ "function", "getCookie", "(", "name", ")", "{", "var", "cookieValue", "=", "null", ";", "if", "(", "document", ".", "cookie", "&&", "document", ".", "cookie", "!=", "''", ")", "{", "var", "cookies", "=", "document", ".", "cookie", ".", "split", "(", "';'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "cookies", ".", "length", ";", "i", "++", ")", "{", "var", "cookie", "=", "jQuery", ".", "trim", "(", "cookies", "[", "i", "]", ")", ";", "// Does this cookie string begin with the name we want?", "if", "(", "cookie", ".", "substring", "(", "0", ",", "name", ".", "length", "+", "1", ")", "==", "(", "name", "+", "'='", ")", ")", "{", "cookieValue", "=", "decodeURIComponent", "(", "cookie", ".", "substring", "(", "name", ".", "length", "+", "1", ")", ")", ";", "break", ";", "}", "}", "}", "return", "cookieValue", ";", "}" ]
[ 1, 0 ]
[ 15, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setup
()
null
Las instrucciones dentro de la función setup() se ejecutan una vez, cuando el programa se inicia
Las instrucciones dentro de la función setup() se ejecutan una vez, cuando el programa se inicia
function setup() { createCanvas(720, 400); stroke(255); noLoop(); y = height * 0.5; }
[ "function", "setup", "(", ")", "{", "createCanvas", "(", "720", ",", "400", ")", ";", "stroke", "(", "255", ")", ";", "noLoop", "(", ")", ";", "y", "=", "height", "*", "0.5", ";", "}" ]
[ 10, 0 ]
[ 15, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
playNote
(note, duration)
null
una función para tocar una nota
una función para tocar una nota
function playNote(note, duration) { osc.freq(midiToFreq(note)); // aparición gradual osc.fade(0.5,0.2); // si definimos una duración, apagar gradualmente if (duration) { setTimeout(function() { osc.fade(0,0.2); }, duration-50); } }
[ "function", "playNote", "(", "note", ",", "duration", ")", "{", "osc", ".", "freq", "(", "midiToFreq", "(", "note", ")", ")", ";", "// aparición gradual", "osc", ".", "fade", "(", "0.5", ",", "0.2", ")", ";", "// si definimos una duración, apagar gradualmente", "if", "(", "duration", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "osc", ".", "fade", "(", "0", ",", "0.2", ")", ";", "}", ",", "duration", "-", "50", ")", ";", "}", "}" ]
[ 50, 0 ]
[ 61, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
dibujarCarta
(palo, numero)
null
Función que crea la carta en HTML
Función que crea la carta en HTML
function dibujarCarta(palo, numero) { let carta = document.createElement("div"); carta.classList.add("card"); let contenido = document.createElement("span"); contenido.classList.add("number", palo); if (numero == 1) numero = "A"; if (numero == 11) numero = "J"; if (numero == 12) numero = "Q"; if (numero == 13) numero = "K"; contenido.innerHTML = numero; carta.appendChild(contenido); return carta; }
[ "function", "dibujarCarta", "(", "palo", ",", "numero", ")", "{", "let", "carta", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "carta", ".", "classList", ".", "add", "(", "\"card\"", ")", ";", "let", "contenido", "=", "document", ".", "createElement", "(", "\"span\"", ")", ";", "contenido", ".", "classList", ".", "add", "(", "\"number\"", ",", "palo", ")", ";", "if", "(", "numero", "==", "1", ")", "numero", "=", "\"A\"", ";", "if", "(", "numero", "==", "11", ")", "numero", "=", "\"J\"", ";", "if", "(", "numero", "==", "12", ")", "numero", "=", "\"Q\"", ";", "if", "(", "numero", "==", "13", ")", "numero", "=", "\"K\"", ";", "contenido", ".", "innerHTML", "=", "numero", ";", "carta", ".", "appendChild", "(", "contenido", ")", ";", "return", "carta", ";", "}" ]
[ 21, 0 ]
[ 35, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
obtenerRecomendados
()
null
Obtiene un listado de productos recomendados para este producto
Obtiene un listado de productos recomendados para este producto
function obtenerRecomendados() { var _this3 = this; //Datos para obtener la consulta var datos = { 'animal': this.product.tipo_animal, 'categoria': this.product.categoria, 'id_producto_excluir': this.product.id }; axios.post('/api/product/recomendados', datos).then(function (res) { _this3.productos_recomendados = res.data.products; })["catch"](function (err) { console.log(err); }); }
[ "function", "obtenerRecomendados", "(", ")", "{", "var", "_this3", "=", "this", ";", "//Datos para obtener la consulta", "var", "datos", "=", "{", "'animal'", ":", "this", ".", "product", ".", "tipo_animal", ",", "'categoria'", ":", "this", ".", "product", ".", "categoria", ",", "'id_producto_excluir'", ":", "this", ".", "product", ".", "id", "}", ";", "axios", ".", "post", "(", "'/api/product/recomendados'", ",", "datos", ")", ".", "then", "(", "function", "(", "res", ")", "{", "_this3", ".", "productos_recomendados", "=", "res", ".", "data", ".", "products", ";", "}", ")", "[", "\"catch\"", "]", "(", "function", "(", "err", ")", "{", "console", ".", "log", "(", "err", ")", ";", "}", ")", ";", "}" ]
[ 73, 25 ]
[ 87, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
mensaje_bienvenida
(req, res)
null
Funcion que mostrara un mensaje de bienvenida
Funcion que mostrara un mensaje de bienvenida
function mensaje_bienvenida(req, res) { res.json("Esta es la pagina principal de la pagina"); //Envia una respuesta en formato json }
[ "function", "mensaje_bienvenida", "(", "req", ",", "res", ")", "{", "res", ".", "json", "(", "\"Esta es la pagina principal de la pagina\"", ")", ";", "//Envia una respuesta en formato json", "}" ]
[ 3, 0 ]
[ 5, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
()
null
Todas las funciones tienen el atributo prototype.
Todas las funciones tienen el atributo prototype.
function (){}
[ "function", "(", ")", "{", "}" ]
[ 1, 13 ]
[ 1, 26 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
setup
()
null
Las instrucciones dentro de la función setup() se ejecutan una vez, al principio del programa
Las instrucciones dentro de la función setup() se ejecutan una vez, al principio del programa
function setup() { // createCanvas() debe ser la primera instrucción createCanvas(720, 400); stroke(255); // Hacer que el color de trazado sea blanco frameRate(30); }
[ "function", "setup", "(", ")", "{", "// createCanvas() debe ser la primera instrucción", "createCanvas", "(", "720", ",", "400", ")", ";", "stroke", "(", "255", ")", ";", "// Hacer que el color de trazado sea blanco", "frameRate", "(", "30", ")", ";", "}" ]
[ 9, 0 ]
[ 14, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
onMouseEvent
(Mundo, event)
null
Implemente esta función si quiere que su programa reaccione a eventos del mouse
Implemente esta función si quiere que su programa reaccione a eventos del mouse
function onMouseEvent (Mundo, event) { return update(Mundo,{}); }
[ "function", "onMouseEvent", "(", "Mundo", ",", "event", ")", "{", "return", "update", "(", "Mundo", ",", "{", "}", ")", ";", "}" ]
[ 47, 0 ]
[ 49, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
enviarSennal
(nomVar,currentId,otherId)
null
/*Esta funcion envia un true a la variable correspondiente y se queda pulsada, si se clicka de nuevo, se pone en false
/*Esta funcion envia un true a la variable correspondiente y se queda pulsada, si se clicka de nuevo, se pone en false
function enviarSennal(nomVar,currentId,otherId){ var val = false; if (nomVar=='ADELANTE') { if(adelanteCheck==false){ val = true; adelanteCheck= true; }else{ val = false; adelanteCheck = false; } }else if(nomVar=='ATRAS'){ if(atrasCheck==false){ val = true; atrasCheck = true; }else{ val = false; atrasCheck = false; } } var datos = '\"WEB_1\".'+nomVar+"="+val; $($.ajax({ method:'POST', data:datos, success: function(datos){ console.log("funciona, el valor que se ha enviado es \n"+"WEB_1."+nomVar+"="+val); }, error: function(){ console.log("errores"); } })) alterBotn(currentId,otherId); }
[ "function", "enviarSennal", "(", "nomVar", ",", "currentId", ",", "otherId", ")", "{", "var", "val", "=", "false", ";", "if", "(", "nomVar", "==", "'ADELANTE'", ")", "{", "if", "(", "adelanteCheck", "==", "false", ")", "{", "val", "=", "true", ";", "adelanteCheck", "=", "true", ";", "}", "else", "{", "val", "=", "false", ";", "adelanteCheck", "=", "false", ";", "}", "}", "else", "if", "(", "nomVar", "==", "'ATRAS'", ")", "{", "if", "(", "atrasCheck", "==", "false", ")", "{", "val", "=", "true", ";", "atrasCheck", "=", "true", ";", "}", "else", "{", "val", "=", "false", ";", "atrasCheck", "=", "false", ";", "}", "}", "var", "datos", "=", "'\\\"WEB_1\\\".'", "+", "nomVar", "+", "\"=\"", "+", "val", ";", "$", "(", "$", ".", "ajax", "(", "{", "method", ":", "'POST'", ",", "data", ":", "datos", ",", "success", ":", "function", "(", "datos", ")", "{", "console", ".", "log", "(", "\"funciona, el valor que se ha enviado es \\n\"", "+", "\"WEB_1.\"", "+", "nomVar", "+", "\"=\"", "+", "val", ")", ";", "}", ",", "error", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"errores\"", ")", ";", "}", "}", ")", ")", "alterBotn", "(", "currentId", ",", "otherId", ")", ";", "}" ]
[ 38, 0 ]
[ 69, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
updateTask
(id, row)
null
Método para actualizar una tarea en el microservicio eslint-disable-next-line no-unused-vars
Método para actualizar una tarea en el microservicio eslint-disable-next-line no-unused-vars
async function updateTask(id, row) { event.preventDefault() const res = await fetch( `http://localhost:3001/api/inbox/${id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ tarea: updTask, }), }, ) const data = await res.json() const dataWithId = { _id: id, ...data.data } const list = [] console.log(dataWithId) tasks.map((item, numOfRow) => { numOfRow === editingRow ? list.push(dataWithId) : list.push(item) }) setTasks(list) setEditingRow() }
[ "async", "function", "updateTask", "(", "id", ",", "row", ")", "{", "event", ".", "preventDefault", "(", ")", "const", "res", "=", "await", "fetch", "(", "`", "${", "id", "}", "`", ",", "{", "method", ":", "'PUT'", ",", "headers", ":", "{", "'Content-Type'", ":", "'application/json'", ",", "}", ",", "body", ":", "JSON", ".", "stringify", "(", "{", "tarea", ":", "updTask", ",", "}", ")", ",", "}", ",", ")", "const", "data", "=", "await", "res", ".", "json", "(", ")", "const", "dataWithId", "=", "{", "_id", ":", "id", ",", "...", "data", ".", "data", "}", "const", "list", "=", "[", "]", "console", ".", "log", "(", "dataWithId", ")", "tasks", ".", "map", "(", "(", "item", ",", "numOfRow", ")", "=>", "{", "numOfRow", "===", "editingRow", "?", "list", ".", "push", "(", "dataWithId", ")", ":", "list", ".", "push", "(", "item", ")", "}", ")", "setTasks", "(", "list", ")", "setEditingRow", "(", ")", "}" ]
[ 60, 2 ]
[ 81, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
agregarAlCarrito
(e)
null
escribiremos funciones que se conectaran con la funcion de registrarEventos()
escribiremos funciones que se conectaran con la funcion de registrarEventos()
function agregarAlCarrito(e) { e.preventDefault() if (existeClassAgregar) { const cursoSeleccionado = e.target.parentElement.parentElement leerCurso(cursoSeleccionado) } }
[ "function", "agregarAlCarrito", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", "if", "(", "existeClassAgregar", ")", "{", "const", "cursoSeleccionado", "=", "e", ".", "target", ".", "parentElement", ".", "parentElement", "leerCurso", "(", "cursoSeleccionado", ")", "}", "}" ]
[ 34, 0 ]
[ 44, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
eliminardetalle
(codigo,index)
null
/* Eliminar productos
/* Eliminar productos
function eliminardetalle(codigo,index){ total=total-subtotal[index]; tam=detalleventa.length; var i=0; var pos; while (i<tam) { if (detalleventa[i].codigo==codigo) { pos=i; break; } i=i+1; } detalleventa.splice(pos,1); $('#fila'+index).remove(); controlproducto[index]=""; $('#total').val(number_format(total,2)); }
[ "function", "eliminardetalle", "(", "codigo", ",", "index", ")", "{", "total", "=", "total", "-", "subtotal", "[", "index", "]", ";", "tam", "=", "detalleventa", ".", "length", ";", "var", "i", "=", "0", ";", "var", "pos", ";", "while", "(", "i", "<", "tam", ")", "{", "if", "(", "detalleventa", "[", "i", "]", ".", "codigo", "==", "codigo", ")", "{", "pos", "=", "i", ";", "break", ";", "}", "i", "=", "i", "+", "1", ";", "}", "detalleventa", ".", "splice", "(", "pos", ",", "1", ")", ";", "$", "(", "'#fila'", "+", "index", ")", ".", "remove", "(", ")", ";", "controlproducto", "[", "index", "]", "=", "\"\"", ";", "$", "(", "'#total'", ")", ".", "val", "(", "number_format", "(", "total", ",", "2", ")", ")", ";", "}" ]
[ 139, 0 ]
[ 157, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(position)
null
Una clase simple de partícula (Particle)
Una clase simple de partícula (Particle)
function(position) { this.acceleration = createVector(0, 0.05); this.velocity = createVector(random(-1, 1), random(-1, 0)); this.position = position.copy(); this.lifespan = 255.0; }
[ "function", "(", "position", ")", "{", "this", ".", "acceleration", "=", "createVector", "(", "0", ",", "0.05", ")", ";", "this", ".", "velocity", "=", "createVector", "(", "random", "(", "-", "1", ",", "1", ")", ",", "random", "(", "-", "1", ",", "0", ")", ")", ";", "this", ".", "position", "=", "position", ".", "copy", "(", ")", ";", "this", ".", "lifespan", "=", "255.0", ";", "}" ]
[ 19, 15 ]
[ 24, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
variable_declarator
getUnviewedMessages
(req, res)
null
Contar mensajes no leídos
Contar mensajes no leídos
function getUnviewedMessages(req, res){ var userId = req.user.sub; Message.count({receiver: userId, viewed: 'false'}).exec((err, count) => { if(err) return res.status(500).send({message: 'Error en la petición.'}); return res.status(200).send({ 'unviewed': count }); }); }
[ "function", "getUnviewedMessages", "(", "req", ",", "res", ")", "{", "var", "userId", "=", "req", ".", "user", ".", "sub", ";", "Message", ".", "count", "(", "{", "receiver", ":", "userId", ",", "viewed", ":", "'false'", "}", ")", ".", "exec", "(", "(", "err", ",", "count", ")", "=>", "{", "if", "(", "err", ")", "return", "res", ".", "status", "(", "500", ")", ".", "send", "(", "{", "message", ":", "'Error en la petición.'}", ")", ";", "", "return", "res", ".", "status", "(", "200", ")", ".", "send", "(", "{", "'unviewed'", ":", "count", "}", ")", ";", "}", ")", ";", "}" ]
[ 76, 0 ]
[ 85, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
areaTriangulo
(base, altura)
null
console.log("El perimetro del triángulo mide: " + perimetroTriangulo + " cms"); Area del triangulo
console.log("El perimetro del triángulo mide: " + perimetroTriangulo + " cms"); Area del triangulo
function areaTriangulo(base, altura) { return (base*altura)/2; }
[ "function", "areaTriangulo", "(", "base", ",", "altura", ")", "{", "return", "(", "base", "*", "altura", ")", "/", "2", ";", "}" ]
[ 43, 0 ]
[ 45, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
handleOnTaskMouseDown
(evt)
null
Eventos de la lista de pendientes
Eventos de la lista de pendientes
function handleOnTaskMouseDown(evt){ var taskItem = evt.target; taskItem.pressMenu = setTimeout(()=>{ taskItem.longPress = true; taskItem.classList.add("bg-red-200"); },1500); }
[ "function", "handleOnTaskMouseDown", "(", "evt", ")", "{", "var", "taskItem", "=", "evt", ".", "target", ";", "taskItem", ".", "pressMenu", "=", "setTimeout", "(", "(", ")", "=>", "{", "taskItem", ".", "longPress", "=", "true", ";", "taskItem", ".", "classList", ".", "add", "(", "\"bg-red-200\"", ")", ";", "}", ",", "1500", ")", ";", "}" ]
[ 13, 4 ]
[ 19, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
sum
()
null
1. Las "arrow functions" no pueden hacer tracking de sus argumentos a través de la variable dinámica "arguments".
1. Las "arrow functions" no pueden hacer tracking de sus argumentos a través de la variable dinámica "arguments".
function sum() { let total = 0; for (const num of arguments) { // Aprovechar y explicar el for..of total += num; } return total; // Alternativa más compacta: Reduce!!! //return Array.from(arguments).reduce((acc, val) => acc + val); }
[ "function", "sum", "(", ")", "{", "let", "total", "=", "0", ";", "for", "(", "const", "num", "of", "arguments", ")", "{", "// Aprovechar y explicar el for..of", "total", "+=", "num", ";", "}", "return", "total", ";", "// Alternativa más compacta: Reduce!!!", "//return Array.from(arguments).reduce((acc, val) => acc + val);", "}" ]
[ 140, 0 ]
[ 149, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
showPassword
()
null
Mostrar la Contraseña
Mostrar la Contraseña
function showPassword() { var change = document.getElementById('password-confirm'); $('#show_password').unbind('click').click(function () { if (change.type === "password") { change.type = "text"; $('i').removeClass('fa fa-eye-slash').addClass('fa fa-eye'); } else { change.type = "password"; $('i').removeClass('fa fa-eye').addClass('fa fa-eye-slash'); } }); }
[ "function", "showPassword", "(", ")", "{", "var", "change", "=", "document", ".", "getElementById", "(", "'password-confirm'", ")", ";", "$", "(", "'#show_password'", ")", ".", "unbind", "(", "'click'", ")", ".", "click", "(", "function", "(", ")", "{", "if", "(", "change", ".", "type", "===", "\"password\"", ")", "{", "change", ".", "type", "=", "\"text\"", ";", "$", "(", "'i'", ")", ".", "removeClass", "(", "'fa fa-eye-slash'", ")", ".", "addClass", "(", "'fa fa-eye'", ")", ";", "}", "else", "{", "change", ".", "type", "=", "\"password\"", ";", "$", "(", "'i'", ")", ".", "removeClass", "(", "'fa fa-eye'", ")", ".", "addClass", "(", "'fa fa-eye-slash'", ")", ";", "}", "}", ")", ";", "}" ]
[ 57, 4 ]
[ 70, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
logout
(req, h)
null
Funclion de Cerrar Sesion
Funclion de Cerrar Sesion
function logout(req, h) { // Con unstate removemos la Cookie por el nombre return h.redirect('/login').unstate('user') }
[ "function", "logout", "(", "req", ",", "h", ")", "{", "// Con unstate removemos la Cookie por el nombre", "return", "h", ".", "redirect", "(", "'/login'", ")", ".", "unstate", "(", "'user'", ")", "}" ]
[ 57, 0 ]
[ 60, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Circle
(x, y, dx, dy, radius)
null
Aquí defino la función del circulo y sus variables
Aquí defino la función del circulo y sus variables
function Circle(x, y, dx, dy, radius) { this.x = x; // eje x this.y = y; // eje y this.dx = dx; // x velocidad this.dy = dy; // y velocidad this.radius = radius; // radio del circulo (tamaño) this.draw = function () { context.beginPath(); //crea una nueva ruta para dibujar y editar el estilo context.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false); context.strokeStyle = 'blue'; context.stroke(); context.fillStyle = 'red'; context.fill(); } //Esta función lo que hace es que con unos condicionales asignemos el punto donde la bola choca con el hancho y el alto y así cambiar el rumbo //llama a una función, que tiene dos condicionales(if)S this.update = function () { // si x + el radio > innerWidth o x - el radio < 0 entonces this.dx = this.dx if (this.x + this.radius > innerWidth || this.x - this.radius < 0) { this.dx = -this.dx; } // si y + el radio > innerHeight o y - el radio < 0 entonces this.dy = this.dy if (this.y + this.radius > innerHeight || this.y - this.radius < 0) { this.dy = -this.dy; } this.x += this.dx; this.y += this.dy; this.draw(); } }
[ "function", "Circle", "(", "x", ",", "y", ",", "dx", ",", "dy", ",", "radius", ")", "{", "this", ".", "x", "=", "x", ";", "// eje x\r", "this", ".", "y", "=", "y", ";", "// eje y\r", "this", ".", "dx", "=", "dx", ";", "// x velocidad\r", "this", ".", "dy", "=", "dy", ";", "// y velocidad\r", "this", ".", "radius", "=", "radius", ";", "// radio del circulo (tamaño)\r", "this", ".", "draw", "=", "function", "(", ")", "{", "context", ".", "beginPath", "(", ")", ";", "//crea una nueva ruta para dibujar y editar el estilo\r", "context", ".", "arc", "(", "this", ".", "x", ",", "this", ".", "y", ",", "this", ".", "radius", ",", "0", ",", "Math", ".", "PI", "*", "2", ",", "false", ")", ";", "context", ".", "strokeStyle", "=", "'blue'", ";", "context", ".", "stroke", "(", ")", ";", "context", ".", "fillStyle", "=", "'red'", ";", "context", ".", "fill", "(", ")", ";", "}", "//Esta función lo que hace es que con unos condicionales asignemos el punto donde la bola choca con el hancho y el alto y así cambiar el rumbo\r", "//llama a una función, que tiene dos condicionales(if)S\r", "this", ".", "update", "=", "function", "(", ")", "{", "// si x + el radio > innerWidth o x - el radio < 0 entonces this.dx = this.dx\r", "if", "(", "this", ".", "x", "+", "this", ".", "radius", ">", "innerWidth", "||", "this", ".", "x", "-", "this", ".", "radius", "<", "0", ")", "{", "this", ".", "dx", "=", "-", "this", ".", "dx", ";", "}", "// si y + el radio > innerHeight o y - el radio < 0 entonces this.dy = this.dy\r", "if", "(", "this", ".", "y", "+", "this", ".", "radius", ">", "innerHeight", "||", "this", ".", "y", "-", "this", ".", "radius", "<", "0", ")", "{", "this", ".", "dy", "=", "-", "this", ".", "dy", ";", "}", "this", ".", "x", "+=", "this", ".", "dx", ";", "this", ".", "y", "+=", "this", ".", "dy", ";", "this", ".", "draw", "(", ")", ";", "}", "}" ]
[ 9, 0 ]
[ 44, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
deleteRow
(fila)
null
Elimino la columna seleccionada de la tabla de cuentas contables
Elimino la columna seleccionada de la tabla de cuentas contables
function deleteRow(fila) { var row = fila.parentNode.parentNode; row.parentNode.removeChild(row); }
[ "function", "deleteRow", "(", "fila", ")", "{", "var", "row", "=", "fila", ".", "parentNode", ".", "parentNode", ";", "row", ".", "parentNode", ".", "removeChild", "(", "row", ")", ";", "}" ]
[ 853, 0 ]
[ 856, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
registroUsuario
()
null
* Validaciones de Usuario **
* Validaciones de Usuario **
function registroUsuario(){ var nombre = $("#InputNombre").val(); if(nombre != ""){ var expresion = /^[a-zA-ZñÑáéíóúÁÉÍÓÚ ]*$/; if (!expresion.test(nombre)){ $("#InputNombre").parent().before('<div class="alert alert-warning"><strong>Error:</strong> No se permite numero ni caracteres especiales.</div>') return false; } }else{ $("#InputNombre").parent().before('<div class="alert alert-warning"><strong>ATENCIÓN:</strong> Este campo es obligatorio.</div>') return false; } var usuario = $("#InputUsuario").val(); if(usuario != ""){ var expresion = /^[a-zA-Z0-9 ]*$/; if (!expresion.test(usuario)){ $("#InputUsuario").parent().before('<div class="alert alert-warning"><strong>Error:</strong> No se permite caracteres especiales.</div>') return false; } }else{ $("#InputUsuario").parent().before('<div class="alert alert-warning"><strong>ATENCIÓN:</strong> Este campo es obligatorio.</div>') return false; } return true; }
[ "function", "registroUsuario", "(", ")", "{", "var", "nombre", "=", "$", "(", "\"#InputNombre\"", ")", ".", "val", "(", ")", ";", "if", "(", "nombre", "!=", "\"\"", ")", "{", "var", "expresion", "=", "/", "^[a-zA-ZñÑáéíóúÁÉÍÓÚ ]*$/;", "", "", "if", "(", "!", "expresion", ".", "test", "(", "nombre", ")", ")", "{", "$", "(", "\"#InputNombre\"", ")", ".", "parent", "(", ")", ".", "before", "(", "'<div class=\"alert alert-warning\"><strong>Error:</strong> No se permite numero ni caracteres especiales.</div>'", ")", "return", "false", ";", "}", "}", "else", "{", "$", "(", "\"#InputNombre\"", ")", ".", "parent", "(", ")", ".", "before", "(", "'<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio.</div>')", "", "return", "false", ";", "}", "var", "usuario", "=", "$", "(", "\"#InputUsuario\"", ")", ".", "val", "(", ")", ";", "if", "(", "usuario", "!=", "\"\"", ")", "{", "var", "expresion", "=", "/", "^[a-zA-Z0-9 ]*$", "/", ";", "if", "(", "!", "expresion", ".", "test", "(", "usuario", ")", ")", "{", "$", "(", "\"#InputUsuario\"", ")", ".", "parent", "(", ")", ".", "before", "(", "'<div class=\"alert alert-warning\"><strong>Error:</strong> No se permite caracteres especiales.</div>'", ")", "return", "false", ";", "}", "}", "else", "{", "$", "(", "\"#InputUsuario\"", ")", ".", "parent", "(", ")", ".", "before", "(", "'<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio.</div>')", "", "return", "false", ";", "}", "return", "true", ";", "}" ]
[ 2, 0 ]
[ 43, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
change
()
null
FUNCION QUE ME TIRA LOS VALORES DEL SLIDER DE LARGO DE PARED
FUNCION QUE ME TIRA LOS VALORES DEL SLIDER DE LARGO DE PARED
function change (){ var largo = $("#largo").val(); var largo1 = $("#largo1"); $( "#largo1" ).html(largo); }
[ "function", "change", "(", ")", "{", "var", "largo", "=", "$", "(", "\"#largo\"", ")", ".", "val", "(", ")", ";", "var", "largo1", "=", "$", "(", "\"#largo1\"", ")", ";", "$", "(", "\"#largo1\"", ")", ".", "html", "(", "largo", ")", ";", "}" ]
[ 51, 0 ]
[ 56, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
update_cantidades
(e)
null
Funcion para mofdificar datos al actualizar una cantidad de la tabla de pedidos
Funcion para mofdificar datos al actualizar una cantidad de la tabla de pedidos
function update_cantidades(e){ let tr = e.parentNode.parentNode; let precio = parseFloat($(tr).find('.precio').val()); let cantidad = parseInt($(tr).find('.cantidad').val()); let descuento = parseFloat($(tr).find('.descuento_percent').val()); let total = 0.0; let subtotal = precio * cantidad; let percent_amount = percent(descuento, subtotal); total = subtotal - percent_amount; $(tr).find('.subtotal').text(subtotal.toFixed(2)); $(tr).find('.descuento').text(percent_amount.toFixed(2)); $(tr).find('.total').text(total.toFixed(2)); sumaTotales(); }
[ "function", "update_cantidades", "(", "e", ")", "{", "let", "tr", "=", "e", ".", "parentNode", ".", "parentNode", ";", "let", "precio", "=", "parseFloat", "(", "$", "(", "tr", ")", ".", "find", "(", "'.precio'", ")", ".", "val", "(", ")", ")", ";", "let", "cantidad", "=", "parseInt", "(", "$", "(", "tr", ")", ".", "find", "(", "'.cantidad'", ")", ".", "val", "(", ")", ")", ";", "let", "descuento", "=", "parseFloat", "(", "$", "(", "tr", ")", ".", "find", "(", "'.descuento_percent'", ")", ".", "val", "(", ")", ")", ";", "let", "total", "=", "0.0", ";", "let", "subtotal", "=", "precio", "*", "cantidad", ";", "let", "percent_amount", "=", "percent", "(", "descuento", ",", "subtotal", ")", ";", "total", "=", "subtotal", "-", "percent_amount", ";", "$", "(", "tr", ")", ".", "find", "(", "'.subtotal'", ")", ".", "text", "(", "subtotal", ".", "toFixed", "(", "2", ")", ")", ";", "$", "(", "tr", ")", ".", "find", "(", "'.descuento'", ")", ".", "text", "(", "percent_amount", ".", "toFixed", "(", "2", ")", ")", ";", "$", "(", "tr", ")", ".", "find", "(", "'.total'", ")", ".", "text", "(", "total", ".", "toFixed", "(", "2", ")", ")", ";", "sumaTotales", "(", ")", ";", "}" ]
[ 306, 0 ]
[ 322, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
saveFile
()
null
Función para guardar el archivo
Función para guardar el archivo
function saveFile() { save('design.jpg'); }
[ "function", "saveFile", "(", ")", "{", "save", "(", "'design.jpg'", ")", ";", "}" ]
[ 35, 0 ]
[ 37, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
convertToMp3
(path, filename, numeroCliente)
null
* funciones del sistema **
* funciones del sistema **
function convertToMp3(path, filename, numeroCliente) { var mp3Name = '22'+year+month+day+numeroCliente + 'N.mp3'; cmd.get( 'lame -b 64 --resample 16 -a ' + path+filename + ' /home/aaron/saludInt_Mp3/' +mp3Name + '', function(data) { console.log('Listo se convirtio a MP3'); console.log('--------------------------------'); sendByFTP('/home/aaron/saludInt_Mp3/', mp3Name) console.log('--------------------------------'); }); }
[ "function", "convertToMp3", "(", "path", ",", "filename", ",", "numeroCliente", ")", "{", "var", "mp3Name", "=", "'22'", "+", "year", "+", "month", "+", "day", "+", "numeroCliente", "+", "'N.mp3'", ";", "cmd", ".", "get", "(", "'lame -b 64 --resample 16 -a '", "+", "path", "+", "filename", "+", "' /home/aaron/saludInt_Mp3/'", "+", "mp3Name", "+", "''", ",", "function", "(", "data", ")", "{", "console", ".", "log", "(", "'Listo se convirtio a MP3'", ")", ";", "console", ".", "log", "(", "'--------------------------------'", ")", ";", "sendByFTP", "(", "'/home/aaron/saludInt_Mp3/'", ",", "mp3Name", ")", "console", ".", "log", "(", "'--------------------------------'", ")", ";", "}", ")", ";", "}" ]
[ 57, 0 ]
[ 70, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
alturaTrianguloIsosceles
(trianguloGrandeLadoA, trianguloGrandeLadoB, trianguloGrandeLadoBase)
null
console.log("El área del triángulo mide: " + areaTriangulo + " cms^2");
console.log("El área del triángulo mide: " + areaTriangulo + " cms^2");
function alturaTrianguloIsosceles(trianguloGrandeLadoA, trianguloGrandeLadoB, trianguloGrandeLadoBase) { if (trianguloGrandeLadoA != trianguloGrandeLadoB) { console.error("Los lados a y b no son iguales"); } else { const trianguloPequenoLadoB = trianguloGrandeLadoBase / 2; const trianguloPequenoLadoBase = trianguloGrandeLadoA; const trianguloPequenoLadoBCuadrado = trianguloPequenoLadoB * trianguloPequenoLadoB; const trianguloPequenoLadoBaseCuadrado = trianguloPequenoLadoBase * trianguloPequenoLadoBase; const trianguloPequenoLadoA = Math.sqrt(trianguloPequenoLadoBaseCuadrado - trianguloPequenoLadoBCuadrado); const trianguloGrandeAltura = trianguloPequenoLadoA; return trianguloGrandeAltura; } }
[ "function", "alturaTrianguloIsosceles", "(", "trianguloGrandeLadoA", ",", "trianguloGrandeLadoB", ",", "trianguloGrandeLadoBase", ")", "{", "if", "(", "trianguloGrandeLadoA", "!=", "trianguloGrandeLadoB", ")", "{", "console", ".", "error", "(", "\"Los lados a y b no son iguales\"", ")", ";", "}", "else", "{", "const", "trianguloPequenoLadoB", "=", "trianguloGrandeLadoBase", "/", "2", ";", "const", "trianguloPequenoLadoBase", "=", "trianguloGrandeLadoA", ";", "const", "trianguloPequenoLadoBCuadrado", "=", "trianguloPequenoLadoB", "*", "trianguloPequenoLadoB", ";", "const", "trianguloPequenoLadoBaseCuadrado", "=", "trianguloPequenoLadoBase", "*", "trianguloPequenoLadoBase", ";", "const", "trianguloPequenoLadoA", "=", "Math", ".", "sqrt", "(", "trianguloPequenoLadoBaseCuadrado", "-", "trianguloPequenoLadoBCuadrado", ")", ";", "const", "trianguloGrandeAltura", "=", "trianguloPequenoLadoA", ";", "return", "trianguloGrandeAltura", ";", "}", "}" ]
[ 48, 0 ]
[ 64, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
escritura
(data, filename)
null
--------------------- Guardar Datos --------------------- escritura(json,'ordenamiento');
--------------------- Guardar Datos --------------------- escritura(json,'ordenamiento');
function escritura(data, filename){ let file = new Blob([JSON.stringify(data)],{type:'application/json'}); let a = document.createElement('a'); a.href = URL.createObjectURL(file); a.download = `${filename}.json`; a.click() //console.log(a) }
[ "function", "escritura", "(", "data", ",", "filename", ")", "{", "let", "file", "=", "new", "Blob", "(", "[", "JSON", ".", "stringify", "(", "data", ")", "]", ",", "{", "type", ":", "'application/json'", "}", ")", ";", "let", "a", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "a", ".", "href", "=", "URL", ".", "createObjectURL", "(", "file", ")", ";", "a", ".", "download", "=", "`", "${", "filename", "}", "`", ";", "a", ".", "click", "(", ")", "//console.log(a)", "}" ]
[ 267, 0 ]
[ 274, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(data)
null
Se añade el parametro de busqueda del medico
Se añade el parametro de busqueda del medico
function (data) { //$("#comboSala").html('<option>Cargando...</option>'); }
[ "function", "(", "data", ")", "{", "//$(\"#comboSala\").html('<option>Cargando...</option>');", "}" ]
[ 17, 21 ]
[ 19, 10 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
findEventSection
( clickNode )
null
/* eslint-enable no-multi-spaces Finds the section of the page the user interacted with based on a DOM element. Returns the name of the section. @param {HTMLElement} clickNode The DOM element. @return {string} The name of the section the contains the clickNode.
/* eslint-enable no-multi-spaces Finds the section of the page the user interacted with based on a DOM element. Returns the name of the section.
function findEventSection( clickNode ) { var eventSection = {}, i, j, nodes; for ( i = 0; i < eventSections.length; i++ ) { nodes = eventSections[ i ].nodes; for ( j = 0; j < nodes.length; j++ ) { if ( nodes[ j ].contains( clickNode ) ) { eventSection = eventSections[ i ]; } } } return eventSection.name; }
[ "function", "findEventSection", "(", "clickNode", ")", "{", "var", "eventSection", "=", "{", "}", ",", "i", ",", "j", ",", "nodes", ";", "for", "(", "i", "=", "0", ";", "i", "<", "eventSections", ".", "length", ";", "i", "++", ")", "{", "nodes", "=", "eventSections", "[", "i", "]", ".", "nodes", ";", "for", "(", "j", "=", "0", ";", "j", "<", "nodes", ".", "length", ";", "j", "++", ")", "{", "if", "(", "nodes", "[", "j", "]", ".", "contains", "(", "clickNode", ")", ")", "{", "eventSection", "=", "eventSections", "[", "i", "]", ";", "}", "}", "}", "return", "eventSection", ".", "name", ";", "}" ]
[ 101, 1 ]
[ 119, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
statement_block
dibujarJuego
(escena)
null
funcion que dibuja el juego
funcion que dibuja el juego
function dibujarJuego(escena){ contexto.drawImage(imagen1, 0, 0, canvas.width, canvas.height); //dibujamos la imagen de fondo escena.dibujarEscena(); //Dibujamos la escena actual for(var i = 0; i<numPelotas; i++){ //Dibujamos en la parte inferior de la pantalla el numero restante de vidas contexto.beginPath(); contexto.arc(i*canvas.width/20 + canvas.width/12 ,canvas.height*11/12,10,0,(Math.PI/180)*360,true); contexto.strokeStyle = "rgb(90, 90, 0)"; contexto.lineWidth = 1; contexto.fillStyle="rgb(255, 207, 142)"; contexto.fill(); contexto.stroke(); contexto.closePath(); } //Dibujamos los bordes contexto.drawImage(imagen3, 0, 0, canvas.width, anchoSuperior); contexto.drawImage(imagen4, 0, anchoSuperior, anchoBorde, canvas.height-anchoSuperior); contexto.drawImage(imagen5, canvas.width-anchoBorde, anchoSuperior, anchoBorde, canvas.height-anchoSuperior); //Mostramos la puntuacion contexto.fillStyle="rgb(180, 180, 30)"; contexto.font = "10px sans-serif" contexto.fillText("Puntuacion " + puntuacion ,canvas.width/20,canvas.height/20); }
[ "function", "dibujarJuego", "(", "escena", ")", "{", "contexto", ".", "drawImage", "(", "imagen1", ",", "0", ",", "0", ",", "canvas", ".", "width", ",", "canvas", ".", "height", ")", ";", "//dibujamos la imagen de fondo", "escena", ".", "dibujarEscena", "(", ")", ";", "//Dibujamos la escena actual", "for", "(", "var", "i", "=", "0", ";", "i", "<", "numPelotas", ";", "i", "++", ")", "{", "//Dibujamos en la parte inferior de la pantalla el numero restante de vidas", "contexto", ".", "beginPath", "(", ")", ";", "contexto", ".", "arc", "(", "i", "*", "canvas", ".", "width", "/", "20", "+", "canvas", ".", "width", "/", "12", ",", "canvas", ".", "height", "*", "11", "/", "12", ",", "10", ",", "0", ",", "(", "Math", ".", "PI", "/", "180", ")", "*", "360", ",", "true", ")", ";", "contexto", ".", "strokeStyle", "=", "\"rgb(90, 90, 0)\"", ";", "contexto", ".", "lineWidth", "=", "1", ";", "contexto", ".", "fillStyle", "=", "\"rgb(255, 207, 142)\"", ";", "contexto", ".", "fill", "(", ")", ";", "contexto", ".", "stroke", "(", ")", ";", "contexto", ".", "closePath", "(", ")", ";", "}", "//Dibujamos los bordes", "contexto", ".", "drawImage", "(", "imagen3", ",", "0", ",", "0", ",", "canvas", ".", "width", ",", "anchoSuperior", ")", ";", "contexto", ".", "drawImage", "(", "imagen4", ",", "0", ",", "anchoSuperior", ",", "anchoBorde", ",", "canvas", ".", "height", "-", "anchoSuperior", ")", ";", "contexto", ".", "drawImage", "(", "imagen5", ",", "canvas", ".", "width", "-", "anchoBorde", ",", "anchoSuperior", ",", "anchoBorde", ",", "canvas", ".", "height", "-", "anchoSuperior", ")", ";", "//Mostramos la puntuacion", "contexto", ".", "fillStyle", "=", "\"rgb(180, 180, 30)\"", ";", "contexto", ".", "font", "=", "\"10px sans-serif\"", "contexto", ".", "fillText", "(", "\"Puntuacion \"", "+", "puntuacion", ",", "canvas", ".", "width", "/", "20", ",", "canvas", ".", "height", "/", "20", ")", ";", "}" ]
[ 574, 0 ]
[ 599, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
Simbolo
(tipo, id, linea, columna)
null
instruccionSemantica: string;
instruccionSemantica: string;
function Simbolo(tipo, id, linea, columna) { this.indentificador = id; this.linea = linea; this.columna = columna; this.tipo = tipo; }
[ "function", "Simbolo", "(", "tipo", ",", "id", ",", "linea", ",", "columna", ")", "{", "this", ".", "indentificador", "=", "id", ";", "this", ".", "linea", "=", "linea", ";", "this", ".", "columna", "=", "columna", ";", "this", ".", "tipo", "=", "tipo", ";", "}" ]
[ 5, 4 ]
[ 10, 5 ]
null
javascript
es
['es', 'es', 'es']
False
true
statement_block
(data)
null
una vez finalizado correctamente
una vez finalizado correctamente
function(data){ $("#"+divresul+"").html(data); $("#fotografia_usuario").attr('src', $("#fotografia_usuario").attr('src') + '?' + Math.random() ); if(rs ){ $('#'+nombreform+'').trigger("reset"); mostrarseccion(seccion_sel); } }
[ "function", "(", "data", ")", "{", "$", "(", "\"#\"", "+", "divresul", "+", "\"\"", ")", ".", "html", "(", "data", ")", ";", "$", "(", "\"#fotografia_usuario\"", ")", ".", "attr", "(", "'src'", ",", "$", "(", "\"#fotografia_usuario\"", ")", ".", "attr", "(", "'src'", ")", "+", "'?'", "+", "Math", ".", "random", "(", ")", ")", ";", "if", "(", "rs", ")", "{", "$", "(", "'#'", "+", "nombreform", "+", "''", ")", ".", "trigger", "(", "\"reset\"", ")", ";", "mostrarseccion", "(", "seccion_sel", ")", ";", "}", "}" ]
[ 151, 21 ]
[ 159, 13 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
()
null
ajax con VUE
ajax con VUE
function () { }
[ "function", "(", ")", "{", "}" ]
[ 51, 24 ]
[ 53, 5 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
getSilabas
(palabra)
null
(bool) Indica si se ha encontrado la silaba tónica Devuelve Objeto 'silaba' con los valores calculados @param {string} palabra @returns {Object}
(bool) Indica si se ha encontrado la silaba tónica Devuelve Objeto 'silaba' con los valores calculados
function getSilabas(palabra) { posicionSilabas(palabra); acentuacion(); hiato(); diptongoTriptongo(); return JSON.parse(JSON.stringify(silaba)); }
[ "function", "getSilabas", "(", "palabra", ")", "{", "posicionSilabas", "(", "palabra", ")", ";", "acentuacion", "(", ")", ";", "hiato", "(", ")", ";", "diptongoTriptongo", "(", ")", ";", "return", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "silaba", ")", ")", ";", "}" ]
[ 39, 0 ]
[ 45, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
showTwitter
()
null
URL Y TWITTER función handler para desplegar url y botón compartir en twitter
URL Y TWITTER función handler para desplegar url y botón compartir en twitter
function showTwitter() { if (form.checkValidity() === true) { twitterContainer.classList.remove('js-share--url'); sendRequest(getDataObj()); } else { twitterContainer.classList.add("js-share--url"); alert("Ey! Faltan info, revisa tus datos."); } }
[ "function", "showTwitter", "(", ")", "{", "if", "(", "form", ".", "checkValidity", "(", ")", "===", "true", ")", "{", "twitterContainer", ".", "classList", ".", "remove", "(", "'js-share--url'", ")", ";", "sendRequest", "(", "getDataObj", "(", ")", ")", ";", "}", "else", "{", "twitterContainer", ".", "classList", ".", "add", "(", "\"js-share--url\"", ")", ";", "alert", "(", "\"Ey! Faltan info, revisa tus datos.\"", ")", ";", "}", "}" ]
[ 30, 0 ]
[ 39, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
login
(params)
null
validar se los datos ingresados existen en la base de datos
validar se los datos ingresados existen en la base de datos
function login(params) { let query = 'SELECT * FROM USUARIO_SISTEMA WHERE CORREO = $1 AND CONTRASENA = $2'; let {correo, contrasena} = params.datos, values = [correo, contrasena] return database.query(query, values) .then(response => { return response.rows[0]; }) .catch(err => { console.log("errorr: " + err) }); }
[ "function", "login", "(", "params", ")", "{", "let", "query", "=", "'SELECT * FROM USUARIO_SISTEMA WHERE CORREO = $1 AND CONTRASENA = $2'", ";", "let", "{", "correo", ",", "contrasena", "}", "=", "params", ".", "datos", ",", "values", "=", "[", "correo", ",", "contrasena", "]", "return", "database", ".", "query", "(", "query", ",", "values", ")", ".", "then", "(", "response", "=>", "{", "return", "response", ".", "rows", "[", "0", "]", ";", "}", ")", ".", "catch", "(", "err", "=>", "{", "console", ".", "log", "(", "\"errorr: \"", "+", "err", ")", "}", ")", ";", "}" ]
[ 5, 0 ]
[ 14, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
setTopLevelNavigator
(navigatorRef)
null
Declaramos la función para decirle a ReactNavigation cuál es nuestro Navigator. Lo mismo de antes, luego se explica qué es
Declaramos la función para decirle a ReactNavigation cuál es nuestro Navigator. Lo mismo de antes, luego se explica qué es
function setTopLevelNavigator(navigatorRef) { _navigator = navigatorRef; }
[ "function", "setTopLevelNavigator", "(", "navigatorRef", ")", "{", "_navigator", "=", "navigatorRef", ";", "}" ]
[ 8, 0 ]
[ 10, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
perimetroCirculoConF
(diametro)
null
Codigo del Circulo - con valores dinamicos a travez de una funsion
Codigo del Circulo - con valores dinamicos a travez de una funsion
function perimetroCirculoConF (diametro) { return `El perimetro de este circulo es igual a ${diametro * Math.PI} cm`; }
[ "function", "perimetroCirculoConF", "(", "diametro", ")", "{", "return", "`", "${", "diametro", "*", "Math", ".", "PI", "}", "`", ";", "}" ]
[ 74, 8 ]
[ 76, 9 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
fetchData
(url_api, callback)
null
/* función que nos va a permitir traer la información desde la API
/* función que nos va a permitir traer la información desde la API
function fetchData(url_api, callback){ let xhttp = new XMLHttpRequest(); xhttp.open(`GET`, url_api, true); xhttp.onreadystatechange = function (event) { if(xhttp.readyState === 4) { if(xhttp.status === 200){ callback(null, JSON.parse(xhttp.responseText)); }else { const error = new Error(`Error ` + url_api); return callback(error, null); } } } xhttp.send(); }
[ "function", "fetchData", "(", "url_api", ",", "callback", ")", "{", "let", "xhttp", "=", "new", "XMLHttpRequest", "(", ")", ";", "xhttp", ".", "open", "(", "`", "`", ",", "url_api", ",", "true", ")", ";", "xhttp", ".", "onreadystatechange", "=", "function", "(", "event", ")", "{", "if", "(", "xhttp", ".", "readyState", "===", "4", ")", "{", "if", "(", "xhttp", ".", "status", "===", "200", ")", "{", "callback", "(", "null", ",", "JSON", ".", "parse", "(", "xhttp", ".", "responseText", ")", ")", ";", "}", "else", "{", "const", "error", "=", "new", "Error", "(", "`", "`", "+", "url_api", ")", ";", "return", "callback", "(", "error", ",", "null", ")", ";", "}", "}", "}", "xhttp", ".", "send", "(", ")", ";", "}" ]
[ 4, 0 ]
[ 18, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
mouseReleased
()
null
Disminuye gradualmente cuando soltamos el botón del ratón
Disminuye gradualmente cuando soltamos el botón del ratón
function mouseReleased() { osc.fade(0,0.5); }
[ "function", "mouseReleased", "(", ")", "{", "osc", ".", "fade", "(", "0", ",", "0.5", ")", ";", "}" ]
[ 117, 0 ]
[ 119, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
square
(number)
null
Definición sencilla de una función
Definición sencilla de una función
function square(number) { return number * number; }
[ "function", "square", "(", "number", ")", "{", "return", "number", "*", "number", ";", "}" ]
[ 3, 0 ]
[ 5, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
miFuncion
()
null
funcion que no recibe ni devuelve parametros
funcion que no recibe ni devuelve parametros
function miFuncion(){ }
[ "function", "miFuncion", "(", ")", "{", "}" ]
[ 2, 0 ]
[ 4, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
f2
()
null
Función Modo Estricto
Función Modo Estricto
function f2() { 'use strict'; // see strict mode return this; }
[ "function", "f2", "(", ")", "{", "'use strict'", ";", "// see strict mode", "return", "this", ";", "}" ]
[ 23, 0 ]
[ 26, 1 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
back
(key = {})
null
Creamos la función para volver (El parámetro de key es opcional, lo puse por si lo necesitásemos en un futuro)
Creamos la función para volver (El parámetro de key es opcional, lo puse por si lo necesitásemos en un futuro)
function back(key = {}) { _navigator.dispatch( NavigationActions.back(key) ) }
[ "function", "back", "(", "key", "=", "{", "}", ")", "{", "_navigator", ".", "dispatch", "(", "NavigationActions", ".", "back", "(", "key", ")", ")", "}" ]
[ 25, 0 ]
[ 29, 3 ]
null
javascript
es
['es', 'es', 'es']
True
true
program
(pais)
null
Paises que declaramos estan dispobles en la APP
Paises que declaramos estan dispobles en la APP
function (pais) { return (paises_usados_por_nosotros.includes(pais)); }
[ "function", "(", "pais", ")", "{", "return", "(", "paises_usados_por_nosotros", ".", "includes", "(", "pais", ")", ")", ";", "}" ]
[ 22, 15 ]
[ 24, 2 ]
null
javascript
es
['es', 'es', 'es']
True
true
pair
convertToPolar
(point)
null
Ich verstehe den Rückgabe-Wert von atan2 nicht, deshalb verwende ich meine Eigene Implementation, um Polar nach polar zu konvertieren.
Ich verstehe den Rückgabe-Wert von atan2 nicht, deshalb verwende ich meine Eigene Implementation, um Polar nach polar zu konvertieren.
function convertToPolar(point) { var x = point.x; var y = point.y; var atan = Math.atan(y / x); // Quadrant bestimmen if (x > 0 && y >= 0) { // Quadrant 1 return atan; } if (x > 0 && y < 0) { // Quadrant 4 return atan + 2 * Math.PI; } if (x < 0) { // Quadrant 2 & 3 return atan + Math.PI; } }
[ "function", "convertToPolar", "(", "point", ")", "{", "var", "x", "=", "point", ".", "x", ";", "var", "y", "=", "point", ".", "y", ";", "var", "atan", "=", "Math", ".", "atan", "(", "y", "/", "x", ")", ";", "// Quadrant bestimmen", "if", "(", "x", ">", "0", "&&", "y", ">=", "0", ")", "{", "// Quadrant 1", "return", "atan", ";", "}", "if", "(", "x", ">", "0", "&&", "y", "<", "0", ")", "{", "// Quadrant 4", "return", "atan", "+", "2", "*", "Math", ".", "PI", ";", "}", "if", "(", "x", "<", "0", ")", "{", "// Quadrant 2 & 3", "return", "atan", "+", "Math", ".", "PI", ";", "}", "}" ]
[ 64, 0 ]
[ 78, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
calculateSizeAndPositions
(systemLimit, incoming, outgoing)
null
Berechnet wenn notwendig neue Breite der System Grenze und die Positions für States.
Berechnet wenn notwendig neue Breite der System Grenze und die Positions für States.
function calculateSizeAndPositions(systemLimit, incoming, outgoing) { let noOfIncomingStates = incoming.length - noOfUsageConnections(incoming); let noOfOutgoingStates = outgoing.length - noOfUsageConnections(outgoing); let systemLimitWidth = systemLimit.width; // Neue systemLimit.width berechnen, falls ProcessOperator mehr als 12 Shapes In- oder Output hat (Default Width reicht dann nicht mehr aus) if ((noOfIncomingStates || noOfOutgoingStates) >= 12) { // -10, damit deltas nicht zu klein werden // 50 ist Default Width von einem StateShape systemLimitWidth = systemLimitWidth + (Math.max(noOfOutgoingStates, noOfIncomingStates) - 10) * 50; }; // +1 damit Abstand von den Ecken mit berücksichtigt wird. let delta_incoming_x = systemLimitWidth / (noOfIncomingStates + 1); let delta_outgoing_x = systemLimitWidth / (noOfOutgoingStates + 1); return { SystemLimitWidth: systemLimitWidth, incomings: { start_x: (systemLimit.x - 25) + delta_incoming_x, delta_x: delta_incoming_x, y: systemLimit.y - 25 }, outgoings: { start_x: (systemLimit.x - 25) + delta_outgoing_x, delta_x: delta_outgoing_x, y: systemLimit.y - 25 + systemLimit.height } } }
[ "function", "calculateSizeAndPositions", "(", "systemLimit", ",", "incoming", ",", "outgoing", ")", "{", "let", "noOfIncomingStates", "=", "incoming", ".", "length", "-", "noOfUsageConnections", "(", "incoming", ")", ";", "let", "noOfOutgoingStates", "=", "outgoing", ".", "length", "-", "noOfUsageConnections", "(", "outgoing", ")", ";", "let", "systemLimitWidth", "=", "systemLimit", ".", "width", ";", "// Neue systemLimit.width berechnen, falls ProcessOperator mehr als 12 Shapes In- oder Output hat (Default Width reicht dann nicht mehr aus)", "if", "(", "(", "noOfIncomingStates", "||", "noOfOutgoingStates", ")", ">=", "12", ")", "{", "// -10, damit deltas nicht zu klein werden // 50 ist Default Width von einem StateShape", "systemLimitWidth", "=", "systemLimitWidth", "+", "(", "Math", ".", "max", "(", "noOfOutgoingStates", ",", "noOfIncomingStates", ")", "-", "10", ")", "*", "50", ";", "}", ";", "// +1 damit Abstand von den Ecken mit berücksichtigt wird.", "let", "delta_incoming_x", "=", "systemLimitWidth", "/", "(", "noOfIncomingStates", "+", "1", ")", ";", "let", "delta_outgoing_x", "=", "systemLimitWidth", "/", "(", "noOfOutgoingStates", "+", "1", ")", ";", "return", "{", "SystemLimitWidth", ":", "systemLimitWidth", ",", "incomings", ":", "{", "start_x", ":", "(", "systemLimit", ".", "x", "-", "25", ")", "+", "delta_incoming_x", ",", "delta_x", ":", "delta_incoming_x", ",", "y", ":", "systemLimit", ".", "y", "-", "25", "}", ",", "outgoings", ":", "{", "start_x", ":", "(", "systemLimit", ".", "x", "-", "25", ")", "+", "delta_outgoing_x", ",", "delta_x", ":", "delta_outgoing_x", ",", "y", ":", "systemLimit", ".", "y", "-", "25", "+", "systemLimit", ".", "height", "}", "}", "}" ]
[ 305, 0 ]
[ 330, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
getLenguajeFile
(lenguaje, exito)
null
// Provide your translations as JSON / JS objects var englishTranslation = { header: { title: 'Welcome to Academica', subtitle: 'Dieser Untertitel ist nur für Demozwecke', }, }; var spanishTranslation = { translateme: 'Eine Überschrift', subtitle: 'Dieser Untertitel ist nur für Demozwecke' };
// Provide your translations as JSON / JS objects var englishTranslation = { header: { title: 'Welcome to Academica', subtitle: 'Dieser Untertitel ist nur für Demozwecke', }, }; var spanishTranslation = { translateme: 'Eine Überschrift', subtitle: 'Dieser Untertitel ist nur für Demozwecke' };
function getLenguajeFile(lenguaje, exito) { fetch(`/dist/lenguajes/${lenguaje}.json?` + Math.random() * 10000) .then((res) => { return json = res.json() }) .then((translation) => { json = translation exito() }) .catch((e) => { console.log(e) console.log(`archivo: ${lenguaje}.json`) }); }
[ "function", "getLenguajeFile", "(", "lenguaje", ",", "exito", ")", "{", "fetch", "(", "`", "${", "lenguaje", "}", "`", "+", "Math", ".", "random", "(", ")", "*", "10000", ")", ".", "then", "(", "(", "res", ")", "=>", "{", "return", "json", "=", "res", ".", "json", "(", ")", "}", ")", ".", "then", "(", "(", "translation", ")", "=>", "{", "json", "=", "translation", "exito", "(", ")", "}", ")", ".", "catch", "(", "(", "e", ")", "=>", "{", "console", ".", "log", "(", "e", ")", "console", ".", "log", "(", "`", "${", "lenguaje", "}", "`", ")", "}", ")", ";", "}" ]
[ 12, 0 ]
[ 25, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
children
()
null
## Children #################################################################################
## Children #################################################################################
function children() { if (!this.__children__) { if (!this.state) { return null; } else { this.__children__ = this.possibleTransitions(); } } return this.__children__; }
[ "function", "children", "(", ")", "{", "if", "(", "!", "this", ".", "__children__", ")", "{", "if", "(", "!", "this", ".", "state", ")", "{", "return", "null", ";", "}", "else", "{", "this", ".", "__children__", "=", "this", ".", "possibleTransitions", "(", ")", ";", "}", "}", "return", "this", ".", "__children__", ";", "}" ]
[ 21, 11 ]
[ 30, 2 ]
null
javascript
de
['de', 'de', 'de']
True
true
pair
getpayloadJWT
(token)
null
Trenne den Payload vom Header und Signatur
Trenne den Payload vom Header und Signatur
function getpayloadJWT(token){ var payload = token.split('.')[1]; return payload; }
[ "function", "getpayloadJWT", "(", "token", ")", "{", "var", "payload", "=", "token", ".", "split", "(", "'.'", ")", "[", "1", "]", ";", "return", "payload", ";", "}" ]
[ 92, 0 ]
[ 95, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
filterReset
()
null
filterReset
filterReset
function filterReset() { var q = $('#titleFilter').val(''); $('input').val(''); $('input:checkbox').prop('checked', false); var table = $('[data-enabled-search]').DataTable(); table.columns(0).search('').draw(); $('#routing-group').val('Routing Group'); var sel = $('#routing-group').prev(''); $('.dk-selected ', sel).text('Routing Group'); $('.dk-select-options .dk-option-selected', sel).removeClass('dk-option-selected'); $('.dk-select-options li:first', sel).addClass('dk-option-selected'); $('#partner-name').val('Partner Name'); sel = $('#partner-name').prev(''); $('.dk-selected ', sel).text('Partner Name'); $('.dk-select-options .dk-option-selected', sel).removeClass('dk-option-selected'); $('.dk-select-options li:first', sel).addClass('dk-option-selected'); }
[ "function", "filterReset", "(", ")", "{", "var", "q", "=", "$", "(", "'#titleFilter'", ")", ".", "val", "(", "''", ")", ";", "$", "(", "'input'", ")", ".", "val", "(", "''", ")", ";", "$", "(", "'input:checkbox'", ")", ".", "prop", "(", "'checked'", ",", "false", ")", ";", "var", "table", "=", "$", "(", "'[data-enabled-search]'", ")", ".", "DataTable", "(", ")", ";", "table", ".", "columns", "(", "0", ")", ".", "search", "(", "''", ")", ".", "draw", "(", ")", ";", "$", "(", "'#routing-group'", ")", ".", "val", "(", "'Routing Group'", ")", ";", "var", "sel", "=", "$", "(", "'#routing-group'", ")", ".", "prev", "(", "''", ")", ";", "$", "(", "'.dk-selected '", ",", "sel", ")", ".", "text", "(", "'Routing Group'", ")", ";", "$", "(", "'.dk-select-options .dk-option-selected'", ",", "sel", ")", ".", "removeClass", "(", "'dk-option-selected'", ")", ";", "$", "(", "'.dk-select-options li:first'", ",", "sel", ")", ".", "addClass", "(", "'dk-option-selected'", ")", ";", "$", "(", "'#partner-name'", ")", ".", "val", "(", "'Partner Name'", ")", ";", "sel", "=", "$", "(", "'#partner-name'", ")", ".", "prev", "(", "''", ")", ";", "$", "(", "'.dk-selected '", ",", "sel", ")", ".", "text", "(", "'Partner Name'", ")", ";", "$", "(", "'.dk-select-options .dk-option-selected'", ",", "sel", ")", ".", "removeClass", "(", "'dk-option-selected'", ")", ";", "$", "(", "'.dk-select-options li:first'", ",", "sel", ")", ".", "addClass", "(", "'dk-option-selected'", ")", ";", "}" ]
[ 770, 0 ]
[ 787, 1 ]
null
javascript
de
['de', 'de', 'de']
False
true
program
getModifiers
(path, doc, changeClass, changeFill)
null
könnte man in die Fkt davor intigrieren
könnte man in die Fkt davor intigrieren
function getModifiers(path, doc, changeClass, changeFill){ path += "/modifierSpeciesReference"; path = getLocalXPath(path); let modifiers = doc.evaluate(path, doc, null, XPathResult.ANY_TYPE, null); let node = null; let modifiersList = "<li><span class='" + changeClass + "'><em><b>List of modifiers</span></em></b> was " + changeFill + ":</li><ul>"; while(node = modifiers.iterateNext()){ let participantName = node.attributes.species.nodeValue; //grep name of species if available let getName = doc.getElementById(participantName).attributes.name.value; if (getName) participantName = getName; modifiersList += "<li><em><b>" + participantName + "</em></b></li>"; } modifiersList += "</ul>"; //console.log(modifiers); return modifiersList; }
[ "function", "getModifiers", "(", "path", ",", "doc", ",", "changeClass", ",", "changeFill", ")", "{", "path", "+=", "\"/modifierSpeciesReference\"", ";", "path", "=", "getLocalXPath", "(", "path", ")", ";", "let", "modifiers", "=", "doc", ".", "evaluate", "(", "path", ",", "doc", ",", "null", ",", "XPathResult", ".", "ANY_TYPE", ",", "null", ")", ";", "let", "node", "=", "null", ";", "let", "modifiersList", "=", "\"<li><span class='\"", "+", "changeClass", "+", "\"'><em><b>List of modifiers</span></em></b> was \"", "+", "changeFill", "+", "\":</li><ul>\"", ";", "while", "(", "node", "=", "modifiers", ".", "iterateNext", "(", ")", ")", "{", "let", "participantName", "=", "node", ".", "attributes", ".", "species", ".", "nodeValue", ";", "//grep name of species if available", "let", "getName", "=", "doc", ".", "getElementById", "(", "participantName", ")", ".", "attributes", ".", "name", ".", "value", ";", "if", "(", "getName", ")", "participantName", "=", "getName", ";", "modifiersList", "+=", "\"<li><em><b>\"", "+", "participantName", "+", "\"</em></b></li>\"", ";", "}", "modifiersList", "+=", "\"</ul>\"", ";", "//console.log(modifiers);", "return", "modifiersList", ";", "}" ]
[ 763, 0 ]
[ 780, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
onDequeueButtonClick
()
null
Ausgabe der Variable Aufruf der dequeue-Funktion und speichern einer Variable
Ausgabe der Variable Aufruf der dequeue-Funktion und speichern einer Variable
function onDequeueButtonClick() { let val = dequeue(); if (val === undefined) { document.querySelector('#action-value').value = 'error: nothing to remove'; document.querySelector('#dequeue-value').value = 'no value'; } else { document.querySelector('#dequeue-value').value = val; document.querySelector('#action-value').value = 'dequeue ' + val; document.querySelector('#queue-list').value = queue; } }
[ "function", "onDequeueButtonClick", "(", ")", "{", "let", "val", "=", "dequeue", "(", ")", ";", "if", "(", "val", "===", "undefined", ")", "{", "document", ".", "querySelector", "(", "'#action-value'", ")", ".", "value", "=", "'error: nothing to remove'", ";", "document", ".", "querySelector", "(", "'#dequeue-value'", ")", ".", "value", "=", "'no value'", ";", "}", "else", "{", "document", ".", "querySelector", "(", "'#dequeue-value'", ")", ".", "value", "=", "val", ";", "document", ".", "querySelector", "(", "'#action-value'", ")", ".", "value", "=", "'dequeue '", "+", "val", ";", "document", ".", "querySelector", "(", "'#queue-list'", ")", ".", "value", "=", "queue", ";", "}", "}" ]
[ 31, 0 ]
[ 43, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
__getLConnRunAs
()
null
Understand X-LCONN-RUNAS clause
Understand X-LCONN-RUNAS clause
function __getLConnRunAs() { var LConnRunAs = process.env.IC_LCONN_RUN_AS; var delegationMapping = {}; if (typeof LConnRunAs === "string") { let tmp = LConnRunAs.split(':'); if (tmp.length === 2) { delegationMapping.nodeId = tmp[0]; delegationMapping.userId = tmp[1]; return delegationMapping; } } return null; }
[ "function", "__getLConnRunAs", "(", ")", "{", "var", "LConnRunAs", "=", "process", ".", "env", ".", "IC_LCONN_RUN_AS", ";", "var", "delegationMapping", "=", "{", "}", ";", "if", "(", "typeof", "LConnRunAs", "===", "\"string\"", ")", "{", "let", "tmp", "=", "LConnRunAs", ".", "split", "(", "':'", ")", ";", "if", "(", "tmp", ".", "length", "===", "2", ")", "{", "delegationMapping", ".", "nodeId", "=", "tmp", "[", "0", "]", ";", "delegationMapping", ".", "userId", "=", "tmp", "[", "1", "]", ";", "return", "delegationMapping", ";", "}", "}", "return", "null", ";", "}" ]
[ 54, 0 ]
[ 66, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(modalId)
null
/* Zwischenstand Video ------------------------------------------------------------------------------
/* Zwischenstand Video ------------------------------------------------------------------------------
function (modalId) { function setModalCookie(modalId) { var now = new Date(); now.setTime(now.getTime() + 1 * 3600 * 1000 * 24 * 365); document.cookie = modalId + "=watched; expires=" + now.toUTCString(); } var modal = document.getElementById(modalId); /* Close Video */ if (modal) { modal.querySelector("[aria-label=close]").addEventListener("click", function (event) { event.preventDefault(); modal.classList.toggle("is-active"); setModalCookie(modalId); }, false); } /* Trigger Video on start */ var pairs = decodeURIComponent(document.cookie).split(";"); var cookies = {}; pairs.forEach(function (pair) { pair = pair.split('='); pair[0] = pair[0].replace(/[^0-9a-zA-Z]/g, ""); cookies[pair[0]] = decodeURIComponent(pair[1] || ''); }); var pageUrl = document.querySelector("[data-url]"); if (pageUrl && modal && cookies[modalId] != "watched") { if (pageUrl.dataset.url == "/") { modal.classList.toggle("is-active"); } } /* Trigger Modal via Button */ var modalTrigger = document.querySelector("#zeige-" + modalId); if (modalTrigger && modal) { modalTrigger.addEventListener("click", function (event) { event.preventDefault(); modal.classList.toggle("is-active"); }, false); } }
[ "function", "(", "modalId", ")", "{", "function", "setModalCookie", "(", "modalId", ")", "{", "var", "now", "=", "new", "Date", "(", ")", ";", "now", ".", "setTime", "(", "now", ".", "getTime", "(", ")", "+", "1", "*", "3600", "*", "1000", "*", "24", "*", "365", ")", ";", "document", ".", "cookie", "=", "modalId", "+", "\"=watched; expires=\"", "+", "now", ".", "toUTCString", "(", ")", ";", "}", "var", "modal", "=", "document", ".", "getElementById", "(", "modalId", ")", ";", "/* Close Video */", "if", "(", "modal", ")", "{", "modal", ".", "querySelector", "(", "\"[aria-label=close]\"", ")", ".", "addEventListener", "(", "\"click\"", ",", "function", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "modal", ".", "classList", ".", "toggle", "(", "\"is-active\"", ")", ";", "setModalCookie", "(", "modalId", ")", ";", "}", ",", "false", ")", ";", "}", "/* Trigger Video on start */", "var", "pairs", "=", "decodeURIComponent", "(", "document", ".", "cookie", ")", ".", "split", "(", "\";\"", ")", ";", "var", "cookies", "=", "{", "}", ";", "pairs", ".", "forEach", "(", "function", "(", "pair", ")", "{", "pair", "=", "pair", ".", "split", "(", "'='", ")", ";", "pair", "[", "0", "]", "=", "pair", "[", "0", "]", ".", "replace", "(", "/", "[^0-9a-zA-Z]", "/", "g", ",", "\"\"", ")", ";", "cookies", "[", "pair", "[", "0", "]", "]", "=", "decodeURIComponent", "(", "pair", "[", "1", "]", "||", "''", ")", ";", "}", ")", ";", "var", "pageUrl", "=", "document", ".", "querySelector", "(", "\"[data-url]\"", ")", ";", "if", "(", "pageUrl", "&&", "modal", "&&", "cookies", "[", "modalId", "]", "!=", "\"watched\"", ")", "{", "if", "(", "pageUrl", ".", "dataset", ".", "url", "==", "\"/\"", ")", "{", "modal", ".", "classList", ".", "toggle", "(", "\"is-active\"", ")", ";", "}", "}", "/* Trigger Modal via Button */", "var", "modalTrigger", "=", "document", ".", "querySelector", "(", "\"#zeige-\"", "+", "modalId", ")", ";", "if", "(", "modalTrigger", "&&", "modal", ")", "{", "modalTrigger", ".", "addEventListener", "(", "\"click\"", ",", "function", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "modal", ".", "classList", ".", "toggle", "(", "\"is-active\"", ")", ";", "}", ",", "false", ")", ";", "}", "}" ]
[ 191, 12 ]
[ 235, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
variable_declarator
getWatchlists
(accountId)
null
getWatchlist() Get all watchlists of an account. @instance @memberof TDAmeritrade @param {string} accountId The account id @returns {Promise<any>} List of watchlists @example const watchlists = await td.getWatchlists('45678')
getWatchlist() Get all watchlists of an account.
function getWatchlists(accountId) { return this.axios.get(`/accounts/${accountId}/watchlists`) }
[ "function", "getWatchlists", "(", "accountId", ")", "{", "return", "this", ".", "axios", ".", "get", "(", "`", "${", "accountId", "}", "`", ")", "}" ]
[ 73, 0 ]
[ 75, 1 ]
null
javascript
de
['de', 'de', 'de']
False
true
program
simpleMap
(pMinimal, pMaximal, pVal)
null
----Rudimentaere Funktion, um syntaktisch prinzipiell korrekte Werte sichezustellen
----Rudimentaere Funktion, um syntaktisch prinzipiell korrekte Werte sichezustellen
function simpleMap(pMinimal, pMaximal, pVal) { if (pVal < pMinimal) { pVal = pMinimal; } else if (pVal > pMaximal) { pVal = pMaximal; } return pVal; }
[ "function", "simpleMap", "(", "pMinimal", ",", "pMaximal", ",", "pVal", ")", "{", "if", "(", "pVal", "<", "pMinimal", ")", "{", "pVal", "=", "pMinimal", ";", "}", "else", "if", "(", "pVal", ">", "pMaximal", ")", "{", "pVal", "=", "pMaximal", ";", "}", "return", "pVal", ";", "}" ]
[ 109, 0 ]
[ 116, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
isValidSchema
(key, value)
null
Validate schema props
Validate schema props
function isValidSchema(key, value) { // TODO: Make more flexible by defining null and undefined types. // No schema defined for key if (!schema[key]) return true if (schema[key].required && typeof value === schema[key].type) { return true } else if (!schema[key].required && schema[key].type === 'optional') { if (value && !schema[key].types.includes(typeof value)) return false return true } else if (schema[key].required && schema[key].type) { if (typeof schema[key].expects === 'function') { return schema[key].expects(value) } } return false }
[ "function", "isValidSchema", "(", "key", ",", "value", ")", "{", "// TODO: Make more flexible by defining null and undefined types.", "// No schema defined for key", "if", "(", "!", "schema", "[", "key", "]", ")", "return", "true", "if", "(", "schema", "[", "key", "]", ".", "required", "&&", "typeof", "value", "===", "schema", "[", "key", "]", ".", "type", ")", "{", "return", "true", "}", "else", "if", "(", "!", "schema", "[", "key", "]", ".", "required", "&&", "schema", "[", "key", "]", ".", "type", "===", "'optional'", ")", "{", "if", "(", "value", "&&", "!", "schema", "[", "key", "]", ".", "types", ".", "includes", "(", "typeof", "value", ")", ")", "return", "false", "return", "true", "}", "else", "if", "(", "schema", "[", "key", "]", ".", "required", "&&", "schema", "[", "key", "]", ".", "type", ")", "{", "if", "(", "typeof", "schema", "[", "key", "]", ".", "expects", "===", "'function'", ")", "{", "return", "schema", "[", "key", "]", ".", "expects", "(", "value", ")", "}", "}", "return", "false", "}" ]
[ 33, 2 ]
[ 53, 3 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
()
null
end schema
end schema
function () { //get the number of 'sides' (groups) of the shape this is attached to this.sides = this.el.getObject3D('mesh').geometry.groups.length //make an empty array to load some new materials into this.materials = [] //make new materials and add them to array this.makeMaterials(); //style the new materials by inheriting from default material component this.styleMaterials(); //update the mesh with new materials array this.el.getObject3D('mesh').material = this.materials //set up listeners for changes in default material this.materialListener(); //reduce material componentchanged event throttle so animations can run in real time this.reduceMaterialChangedThrottle(0); }
[ "function", "(", ")", "{", "//get the number of 'sides' (groups) of the shape this is attached to\r", "this", ".", "sides", "=", "this", ".", "el", ".", "getObject3D", "(", "'mesh'", ")", ".", "geometry", ".", "groups", ".", "length", "//make an empty array to load some new materials into\r", "this", ".", "materials", "=", "[", "]", "//make new materials and add them to array\r", "this", ".", "makeMaterials", "(", ")", ";", "//style the new materials by inheriting from default material component\r", "this", ".", "styleMaterials", "(", ")", ";", "//update the mesh with new materials array\r", "this", ".", "el", ".", "getObject3D", "(", "'mesh'", ")", ".", "material", "=", "this", ".", "materials", "//set up listeners for changes in default material\r", "this", ".", "materialListener", "(", ")", ";", "//reduce material componentchanged event throttle so animations can run in real time\r", "this", ".", "reduceMaterialChangedThrottle", "(", "0", ")", ";", "}" ]
[ 21, 8 ]
[ 44, 3 ]
null
javascript
de
['de', 'de', 'de']
False
true
pair
howManyProperties
(obj)
null
Alternative mit Counter
Alternative mit Counter
function howManyProperties(obj) { let props = 0; for (let key in obj) { props++; } return props; }
[ "function", "howManyProperties", "(", "obj", ")", "{", "let", "props", "=", "0", ";", "for", "(", "let", "key", "in", "obj", ")", "{", "props", "++", ";", "}", "return", "props", ";", "}" ]
[ 15, 0 ]
[ 21, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
showTwo
()
null
zeigt im Browser das Ergebnis (hier: "Hello world!")
zeigt im Browser das Ergebnis (hier: "Hello world!")
function showTwo(); { let num = 2; console.log(num); }
[ "function", "showTwo", "(", ")", ";", "{", "let", "num", "=", "2", ";", "console", ".", "log", "(", "num", ")", ";", "}" ]
[ 7, 0 ]
[ 10, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
incrementandSum
(x, y)
null
Increment Funktion Diese Funktion ändert a und b nicht (a und b könnten auch x und y heißen)
Increment Funktion Diese Funktion ändert a und b nicht (a und b könnten auch x und y heißen)
function incrementandSum(x, y) { x += 1; y += 1; console.log(x + y); }
[ "function", "incrementandSum", "(", "x", ",", "y", ")", "{", "x", "+=", "1", ";", "y", "+=", "1", ";", "console", ".", "log", "(", "x", "+", "y", ")", ";", "}" ]
[ 97, 4 ]
[ 101, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
incrementAndSum
()
null
Diese Funktion ändert x und y
Diese Funktion ändert x und y
function incrementAndSum() { x += 1; y += 1; console.log(x + y); }
[ "function", "incrementAndSum", "(", ")", "{", "x", "+=", "1", ";", "y", "+=", "1", ";", "console", ".", "log", "(", "x", "+", "y", ")", ";", "}" ]
[ 108, 4 ]
[ 112, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
hasEven
(arr)
null
/* Nächste Übung vom Übungsslide in Chapter 14 - Auf gerade Zahlen prüfen
/* Nächste Übung vom Übungsslide in Chapter 14 - Auf gerade Zahlen prüfen
function hasEven(arr) { const hasEven = arr.some(isEven); console.log(hasEven); }
[ "function", "hasEven", "(", "arr", ")", "{", "const", "hasEven", "=", "arr", ".", "some", "(", "isEven", ")", ";", "console", ".", "log", "(", "hasEven", ")", ";", "}" ]
[ 37, 0 ]
[ 40, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
speak
()
null
Gibt undefined aus
Gibt undefined aus
function speak() { console.log(this); console.log(`Hi, my name is ${this.name}!`); }
[ "function", "speak", "(", ")", "{", "console", ".", "log", "(", "this", ")", ";", "console", ".", "log", "(", "`", "${", "this", ".", "name", "}", "`", ")", ";", "}" ]
[ 22, 0 ]
[ 25, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
drawPie
(dataSet, selectString, outerRadius, cityName)
null
all die schönen kreise entstehen hier
all die schönen kreise entstehen hier
function drawPie(dataSet, selectString, outerRadius, cityName) { // Color Scale Handling... var color = d3.scale.ordinal().range(['#be708b', '#91b2da', '#78d2bb', '#41a069', '#c06d45', '#e3a747', '#a9c54a' ]); var pieCenterX = outerRadius; var pieCenterY = outerRadius; var canvasWidth = outerRadius * 2; var canvasHeight = outerRadius * 2; var margin = { top: 120, right: 50, bottom: 20, left: 50 }; var textLabel; var textMagnitude; //kommas zu punken function formatNumber (number) { var reg = new RegExp(",", 'g'); return d3.format(",")(number).replace(reg, "."); } //kreisbögen füllen, animieren, an und ausknipsen lalala function fillArc() { var arc = d3.selectAll("." + this.getAttribute('class')); d3.selectAll("#pie-arc") .transition() .duration(350) .style('opacity', .6); arc.style('opacity', 1) .transition() .duration(350) .style('fill', function() { return d3.rgb(d3.select(this).style("fill")).brighter(.7); }); } var tip = d3.tip() .attr('class', 'd3-tip') .offset([-10, 0]) .html(function(d) { return '<h3>'+d.data.legendLabel+'</h3><p>'+formatNumber(d.data.magnitude)+' poster</p>'; } ); function refillArc() { d3.selectAll("#pie-arc") .style('fill', function (d,i){ return color(i);}); } function restoreArcColor() { var arc = d3.select(this); var colorValue = arc.attr('color_value'); arc .transition() .duration(350) .style('opacity', 1).style('fill', colorValue); d3.selectAll("#pie-arc") .transition() .duration(350) .style('opacity', 1).style('fill', function (d, i) { return color(i);}); } // Create a drawing canvas... var canvas = d3.select(selectString) .append('svg:svg') //create the SVG element inside the <body> .data([dataSet]) //associate our data with the document .attr('width', canvasWidth) //set the width of the canvas .attr('height', canvasHeight) //set the height of the canvas .append('svg:g') //make a group to hold our pie chart .attr('transform', 'translate(' + pieCenterX + ',' + pieCenterY + ')'); // Set center of pie // Define an arc generator. This will create <path> elements for using arc data. var arc = d3.svg.arc() .innerRadius(outerRadius / 1.2 ) // Causes center of pie to be hollow .outerRadius(outerRadius); // Define a pie layout: the pie angle encodes the value of dataSet. // Since our data is in the form of a post-parsed CSV string, the // values are Strings which we coerce to Numbers. var pie = d3.layout.pie() .value(function(d) { return d.magnitude; }); // Select all <g> elements with class slice (there aren't any yet) var arcs = canvas.selectAll('g.slice') // Associate the generated pie data (an array of arcs, each having startAngle, // endAngle and value properties) .data(pie) // This will create <g> elements for every 'extra' data element that should be associated // with a selection. The result is creating a <g> for every object in the data array // Create a group to hold each slice (we will have a <path> and a <text> // element associated with each slice) .enter() .append("svg:a") .attr("xlink:href", function(d) { return d.data.link; }) .attr("target", "_blank") .append('svg:g') .attr('class', 'slice') .style('stroke', 'none') .style("fill", "#000"); arcs.call(tip); arcs.append('svg:path') // Set the color for each slice to be chosen from the color function defined above // This creates the actual SVG path using the associated data (pie) with the arc drawing function .attr('fill', function (d, i) { return color(i);}) .attr('color_value', function (d, i) { return color(i);}) .attr('index_value', function (d, i) { return 'index-' + i;}) .attr('id', 'pie-arc') .attr('class', function (d) {return d.data.legendLabel;}) .attr('d', arc) .on('mouseover', tip.show) .on('mouseout', tip.hide) .on('mouseout.restoreArcColor', restoreArcColor) .on('mouseover.refillArc', refillArc) .on('mouseover.fillArc', fillArc); }
[ "function", "drawPie", "(", "dataSet", ",", "selectString", ",", "outerRadius", ",", "cityName", ")", "{", "// Color Scale Handling...", "var", "color", "=", "d3", ".", "scale", ".", "ordinal", "(", ")", ".", "range", "(", "[", "'#be708b'", ",", "'#91b2da'", ",", "'#78d2bb'", ",", "'#41a069'", ",", "'#c06d45'", ",", "'#e3a747'", ",", "'#a9c54a'", "]", ")", ";", "var", "pieCenterX", "=", "outerRadius", ";", "var", "pieCenterY", "=", "outerRadius", ";", "var", "canvasWidth", "=", "outerRadius", "*", "2", ";", "var", "canvasHeight", "=", "outerRadius", "*", "2", ";", "var", "margin", "=", "{", "top", ":", "120", ",", "right", ":", "50", ",", "bottom", ":", "20", ",", "left", ":", "50", "}", ";", "var", "textLabel", ";", "var", "textMagnitude", ";", "//kommas zu punken", "function", "formatNumber", "(", "number", ")", "{", "var", "reg", "=", "new", "RegExp", "(", "\",\"", ",", "'g'", ")", ";", "return", "d3", ".", "format", "(", "\",\"", ")", "(", "number", ")", ".", "replace", "(", "reg", ",", "\".\"", ")", ";", "}", "//kreisbögen füllen, animieren, an und ausknipsen lalala", "function", "fillArc", "(", ")", "{", "var", "arc", "=", "d3", ".", "selectAll", "(", "\".\"", "+", "this", ".", "getAttribute", "(", "'class'", ")", ")", ";", "d3", ".", "selectAll", "(", "\"#pie-arc\"", ")", ".", "transition", "(", ")", ".", "duration", "(", "350", ")", ".", "style", "(", "'opacity'", ",", ".6", ")", ";", "arc", ".", "style", "(", "'opacity'", ",", "1", ")", ".", "transition", "(", ")", ".", "duration", "(", "350", ")", ".", "style", "(", "'fill'", ",", "function", "(", ")", "{", "return", "d3", ".", "rgb", "(", "d3", ".", "select", "(", "this", ")", ".", "style", "(", "\"fill\"", ")", ")", ".", "brighter", "(", ".7", ")", ";", "}", ")", ";", "}", "var", "tip", "=", "d3", ".", "tip", "(", ")", ".", "attr", "(", "'class'", ",", "'d3-tip'", ")", ".", "offset", "(", "[", "-", "10", ",", "0", "]", ")", ".", "html", "(", "function", "(", "d", ")", "{", "return", "'<h3>'", "+", "d", ".", "data", ".", "legendLabel", "+", "'</h3><p>'", "+", "formatNumber", "(", "d", ".", "data", ".", "magnitude", ")", "+", "' poster</p>'", ";", "}", ")", ";", "function", "refillArc", "(", ")", "{", "d3", ".", "selectAll", "(", "\"#pie-arc\"", ")", ".", "style", "(", "'fill'", ",", "function", "(", "d", ",", "i", ")", "{", "return", "color", "(", "i", ")", ";", "}", ")", ";", "}", "function", "restoreArcColor", "(", ")", "{", "var", "arc", "=", "d3", ".", "select", "(", "this", ")", ";", "var", "colorValue", "=", "arc", ".", "attr", "(", "'color_value'", ")", ";", "arc", ".", "transition", "(", ")", ".", "duration", "(", "350", ")", ".", "style", "(", "'opacity'", ",", "1", ")", ".", "style", "(", "'fill'", ",", "colorValue", ")", ";", "d3", ".", "selectAll", "(", "\"#pie-arc\"", ")", ".", "transition", "(", ")", ".", "duration", "(", "350", ")", ".", "style", "(", "'opacity'", ",", "1", ")", ".", "style", "(", "'fill'", ",", "function", "(", "d", ",", "i", ")", "{", "return", "color", "(", "i", ")", ";", "}", ")", ";", "}", "// Create a drawing canvas...", "var", "canvas", "=", "d3", ".", "select", "(", "selectString", ")", ".", "append", "(", "'svg:svg'", ")", "//create the SVG element inside the <body>", ".", "data", "(", "[", "dataSet", "]", ")", "//associate our data with the document", ".", "attr", "(", "'width'", ",", "canvasWidth", ")", "//set the width of the canvas", ".", "attr", "(", "'height'", ",", "canvasHeight", ")", "//set the height of the canvas", ".", "append", "(", "'svg:g'", ")", "//make a group to hold our pie chart", ".", "attr", "(", "'transform'", ",", "'translate('", "+", "pieCenterX", "+", "','", "+", "pieCenterY", "+", "')'", ")", ";", "// Set center of pie", "// Define an arc generator. This will create <path> elements for using arc data.", "var", "arc", "=", "d3", ".", "svg", ".", "arc", "(", ")", ".", "innerRadius", "(", "outerRadius", "/", "1.2", ")", "// Causes center of pie to be hollow", ".", "outerRadius", "(", "outerRadius", ")", ";", "// Define a pie layout: the pie angle encodes the value of dataSet.", "// Since our data is in the form of a post-parsed CSV string, the", "// values are Strings which we coerce to Numbers.", "var", "pie", "=", "d3", ".", "layout", ".", "pie", "(", ")", ".", "value", "(", "function", "(", "d", ")", "{", "return", "d", ".", "magnitude", ";", "}", ")", ";", "// Select all <g> elements with class slice (there aren't any yet)", "var", "arcs", "=", "canvas", ".", "selectAll", "(", "'g.slice'", ")", "// Associate the generated pie data (an array of arcs, each having startAngle,", "// endAngle and value properties)", ".", "data", "(", "pie", ")", "// This will create <g> elements for every 'extra' data element that should be associated", "// with a selection. The result is creating a <g> for every object in the data array", "// Create a group to hold each slice (we will have a <path> and a <text> // element associated with each slice)", ".", "enter", "(", ")", ".", "append", "(", "\"svg:a\"", ")", ".", "attr", "(", "\"xlink:href\"", ",", "function", "(", "d", ")", "{", "return", "d", ".", "data", ".", "link", ";", "}", ")", ".", "attr", "(", "\"target\"", ",", "\"_blank\"", ")", ".", "append", "(", "'svg:g'", ")", ".", "attr", "(", "'class'", ",", "'slice'", ")", ".", "style", "(", "'stroke'", ",", "'none'", ")", ".", "style", "(", "\"fill\"", ",", "\"#000\"", ")", ";", "arcs", ".", "call", "(", "tip", ")", ";", "arcs", ".", "append", "(", "'svg:path'", ")", "// Set the color for each slice to be chosen from the color function defined above", "// This creates the actual SVG path using the associated data (pie) with the arc drawing function", ".", "attr", "(", "'fill'", ",", "function", "(", "d", ",", "i", ")", "{", "return", "color", "(", "i", ")", ";", "}", ")", ".", "attr", "(", "'color_value'", ",", "function", "(", "d", ",", "i", ")", "{", "return", "color", "(", "i", ")", ";", "}", ")", ".", "attr", "(", "'index_value'", ",", "function", "(", "d", ",", "i", ")", "{", "return", "'index-'", "+", "i", ";", "}", ")", ".", "attr", "(", "'id'", ",", "'pie-arc'", ")", ".", "attr", "(", "'class'", ",", "function", "(", "d", ")", "{", "return", "d", ".", "data", ".", "legendLabel", ";", "}", ")", ".", "attr", "(", "'d'", ",", "arc", ")", ".", "on", "(", "'mouseover'", ",", "tip", ".", "show", ")", ".", "on", "(", "'mouseout'", ",", "tip", ".", "hide", ")", ".", "on", "(", "'mouseout.restoreArcColor'", ",", "restoreArcColor", ")", ".", "on", "(", "'mouseover.refillArc'", ",", "refillArc", ")", ".", "on", "(", "'mouseover.fillArc'", ",", "fillArc", ")", ";", "}" ]
[ 91, 0 ]
[ 211, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
generateContent
(inhalt="",link="")
null
Erstelle die Inhaltbox mit den übergebenen Inhalt und Link zum Faden
Erstelle die Inhaltbox mit den übergebenen Inhalt und Link zum Faden
function generateContent(inhalt="",link=""){ return "<div class=\"p-2 text-truncate\" style=\"width: 80%;\">"+inhalt+"</div><div class=\"p-2\" style=\"width: 15%;\"><a href=\"./"+link+"\"><button class=\"btn btn-primary\">Zum Faden</button></a></div>"; }
[ "function", "generateContent", "(", "inhalt", "=", "\"\"", ",", "link", "=", "\"\"", ")", "{", "return", "\"<div class=\\\"p-2 text-truncate\\\" style=\\\"width: 80%;\\\">\"", "+", "inhalt", "+", "\"</div><div class=\\\"p-2\\\" style=\\\"width: 15%;\\\"><a href=\\\"./\"", "+", "link", "+", "\"\\\"><button class=\\\"btn btn-primary\\\">Zum Faden</button></a></div>\"", ";", "}" ]
[ 9, 0 ]
[ 11, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
noOfElementsUnderTheSource
(source, container, minDistance)
null
prüft ob ausreichend Elemente für eine Bestimme Verbindung da sind
prüft ob ausreichend Elemente für eine Bestimme Verbindung da sind
function noOfElementsUnderTheSource(source, container, minDistance) { let i = 0; if (container.length == 0) { return i; }; // Nur Elemente berücksichtigen, die noch nicht miteinander verbunden sind let notConnectedElements = []; container.forEach((element) => { if (!some(element.incoming, function (c) { return c.businessObject.sourceRef.id == source.id })) { notConnectedElements.push(element); } }) notConnectedElements.forEach((element) => { // if (element.di.bounds.y > (source.y + minDistance)) { if (element.y > (source.y + minDistance)) { i++ } }) return i; }
[ "function", "noOfElementsUnderTheSource", "(", "source", ",", "container", ",", "minDistance", ")", "{", "let", "i", "=", "0", ";", "if", "(", "container", ".", "length", "==", "0", ")", "{", "return", "i", ";", "}", ";", "// Nur Elemente berücksichtigen, die noch nicht miteinander verbunden sind", "let", "notConnectedElements", "=", "[", "]", ";", "container", ".", "forEach", "(", "(", "element", ")", "=>", "{", "if", "(", "!", "some", "(", "element", ".", "incoming", ",", "function", "(", "c", ")", "{", "return", "c", ".", "businessObject", ".", "sourceRef", ".", "id", "==", "source", ".", "id", "}", ")", ")", "{", "notConnectedElements", ".", "push", "(", "element", ")", ";", "}", "}", ")", "notConnectedElements", ".", "forEach", "(", "(", "element", ")", "=>", "{", "// if (element.di.bounds.y > (source.y + minDistance)) {", "if", "(", "element", ".", "y", ">", "(", "source", ".", "y", "+", "minDistance", ")", ")", "{", "i", "++", "}", "}", ")", "return", "i", ";", "}" ]
[ 128, 2 ]
[ 151, 3 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
getRandom
(min, max)
null
Gibt eine Zufallszahl zwischen min (inklusive) und max (exklusive) zurück
Gibt eine Zufallszahl zwischen min (inklusive) und max (exklusive) zurück
function getRandom(min, max) { return Math.random() * (max - min) + min; }
[ "function", "getRandom", "(", "min", ",", "max", ")", "{", "return", "Math", ".", "random", "(", ")", "*", "(", "max", "-", "min", ")", "+", "min", ";", "}" ]
[ 116, 4 ]
[ 118, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
multiplyNumeric
(obj)
null
Bedingte Multiplikation mit 2 - eigener Versuch
Bedingte Multiplikation mit 2 - eigener Versuch
function multiplyNumeric(obj) { for (let key in obj) { if (isNaN(obj[key]) === false) { obj[key] = obj[key] * 2; } } return obj; }
[ "function", "multiplyNumeric", "(", "obj", ")", "{", "for", "(", "let", "key", "in", "obj", ")", "{", "if", "(", "isNaN", "(", "obj", "[", "key", "]", ")", "===", "false", ")", "{", "obj", "[", "key", "]", "=", "obj", "[", "key", "]", "*", "2", ";", "}", "}", "return", "obj", ";", "}" ]
[ 33, 0 ]
[ 40, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
checkIfItsWithinSystemLimits
(shape, target, position)
null
Prüft ob Product, Energy, Information oder ProcessOperator innerhalb der Systemgrenzen liegt.
Prüft ob Product, Energy, Information oder ProcessOperator innerhalb der Systemgrenzen liegt.
function checkIfItsWithinSystemLimits(shape, target, position) { let limit_x_1 = target.x - target.width / 2; let limit_x_2 = target.x + target.width / 2; let limit_y_1 = target.y - target.heigth / 2; let limit_y_2 = target.y + target.height / 2; let shape_x_1 = position.x - shape.width / 2; let shape_x_2 = position.x + shape.width / 2; let shape_y_1 = position.y - shape.height / 2; let shape_y_2 = position.y + shape.height / 2; if (shape_x_1 >= limit_x_1 || shape_x_2 <= limit_x_2) { if (shape_y_1 >= limit_y_1 || shape_y_2 <= limit_y_2) { return true; } } else { return false; } }
[ "function", "checkIfItsWithinSystemLimits", "(", "shape", ",", "target", ",", "position", ")", "{", "let", "limit_x_1", "=", "target", ".", "x", "-", "target", ".", "width", "/", "2", ";", "let", "limit_x_2", "=", "target", ".", "x", "+", "target", ".", "width", "/", "2", ";", "let", "limit_y_1", "=", "target", ".", "y", "-", "target", ".", "heigth", "/", "2", ";", "let", "limit_y_2", "=", "target", ".", "y", "+", "target", ".", "height", "/", "2", ";", "let", "shape_x_1", "=", "position", ".", "x", "-", "shape", ".", "width", "/", "2", ";", "let", "shape_x_2", "=", "position", ".", "x", "+", "shape", ".", "width", "/", "2", ";", "let", "shape_y_1", "=", "position", ".", "y", "-", "shape", ".", "height", "/", "2", ";", "let", "shape_y_2", "=", "position", ".", "y", "+", "shape", ".", "height", "/", "2", ";", "if", "(", "shape_x_1", ">=", "limit_x_1", "||", "shape_x_2", "<=", "limit_x_2", ")", "{", "if", "(", "shape_y_1", ">=", "limit_y_1", "||", "shape_y_2", "<=", "limit_y_2", ")", "{", "return", "true", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}" ]
[ 221, 2 ]
[ 240, 3 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
printNumbers
(from, to)
null
Nächste Aufgabe
Nächste Aufgabe
function printNumbers(from, to) { let num = from; console.log(num); num++; waitAndPrint(num, to); }
[ "function", "printNumbers", "(", "from", ",", "to", ")", "{", "let", "num", "=", "from", ";", "console", ".", "log", "(", "num", ")", ";", "num", "++", ";", "waitAndPrint", "(", "num", ",", "to", ")", ";", "}" ]
[ 27, 0 ]
[ 33, 1 ]
null
javascript
de
['de', 'de', 'de']
False
true
program
(value, id, label, angle)
null
----------------------------- zeichne kreis neu entsprechend daten
----------------------------- zeichne kreis neu entsprechend daten
function (value, id, label, angle) { var handlerContainer = d3.selectAll('#handles .handlercontainer'); //selektiert alle handles var startValue = 0; var endValue = 0; var angleLength = 0; var newarc; /* * recalulate data for arc indicator and assign new values * get new data values from handlers */ handlerContainer.each(function(d, i) { if(d.label == "a") {startValue = d.angle; } if(d.label == "e") {endValue = d.angle; } }); if(startValue*1 > endValue*1) { startValue = (startValue*1)-360; } //replace arc _this.graph.arc = d3.arc() .innerRadius(innerRadius) .outerRadius(outerRadius) .startAngle(function(d){ return startValue*(Math.PI/180); }) .endAngle(function(d){ return endValue*(Math.PI/180); }); indicatorArc.attr("d", _this.graph.arc); }
[ "function", "(", "value", ",", "id", ",", "label", ",", "angle", ")", "{", "var", "handlerContainer", "=", "d3", ".", "selectAll", "(", "'#handles .handlercontainer'", ")", ";", "//selektiert alle handles", "var", "startValue", "=", "0", ";", "var", "endValue", "=", "0", ";", "var", "angleLength", "=", "0", ";", "var", "newarc", ";", "/*\n\t\t\t\t\t * recalulate data for arc indicator and assign new values\n\t\t\t\t\t * get new data values from handlers\n\t\t\t\t\t*/", "handlerContainer", ".", "each", "(", "function", "(", "d", ",", "i", ")", "{", "if", "(", "d", ".", "label", "==", "\"a\"", ")", "{", "startValue", "=", "d", ".", "angle", ";", "}", "if", "(", "d", ".", "label", "==", "\"e\"", ")", "{", "endValue", "=", "d", ".", "angle", ";", "}", "}", ")", ";", "if", "(", "startValue", "*", "1", ">", "endValue", "*", "1", ")", "{", "startValue", "=", "(", "startValue", "*", "1", ")", "-", "360", ";", "}", "//replace arc", "_this", ".", "graph", ".", "arc", "=", "d3", ".", "arc", "(", ")", ".", "innerRadius", "(", "innerRadius", ")", ".", "outerRadius", "(", "outerRadius", ")", ".", "startAngle", "(", "function", "(", "d", ")", "{", "return", "startValue", "*", "(", "Math", ".", "PI", "/", "180", ")", ";", "}", ")", ".", "endAngle", "(", "function", "(", "d", ")", "{", "return", "endValue", "*", "(", "Math", ".", "PI", "/", "180", ")", ";", "}", ")", ";", "indicatorArc", ".", "attr", "(", "\"d\"", ",", "_this", ".", "graph", ".", "arc", ")", ";", "}" ]
[ 240, 20 ]
[ 279, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
variable_declarator
sumItems
(arr)
null
/* Nächste Übung vom Übungsslide in Chapter 14 - Alle Zahlen im Array aufsummieren
/* Nächste Übung vom Übungsslide in Chapter 14 - Alle Zahlen im Array aufsummieren
function sumItems(arr) { // let sum = arr[0]; // for (let i = 1; i < arr.length; i++) { // sum += arr[i]; // } let sum = 0; for (let item of arr) { sum += item; } console.log(arr.reduce(sum, 0)); // Die "0" kann auch weggelassen werden }
[ "function", "sumItems", "(", "arr", ")", "{", "// let sum = arr[0];", "// for (let i = 1; i < arr.length; i++) {", "// sum += arr[i];", "// }", "let", "sum", "=", "0", ";", "for", "(", "let", "item", "of", "arr", ")", "{", "sum", "+=", "item", ";", "}", "console", ".", "log", "(", "arr", ".", "reduce", "(", "sum", ",", "0", ")", ")", ";", "// Die \"0\" kann auch weggelassen werden", "}" ]
[ 87, 0 ]
[ 99, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
listener
(e1)
null
el.addEventListener('touchstart', listener)
el.addEventListener('touchstart', listener)
function listener(e1) { // tap should only happen with a single finger if (!e1.touches || e1.touches.length > 1) return var el = e1.target var context = this var args = arguments; var timeout_id = setTimeout(cleanup, timeout) el.addEventListener('touchmove', cleanup) endEvents.forEach(function (event) { el.addEventListener(event, done) }) function done(e2) { // since touchstart is added on the same tick // and because of bubbling, // it'll execute this on the same touchstart. // this filters out the same touchstart event. if (e1 === e2) return cleanup() // already handled if (e2.defaultPrevented) return // overwrite these functions so that they all to both start and events. var preventDefault = e1.preventDefault var stopPropagation = e1.stopPropagation e1.stopPropagation = function () { stopPropagation.call(e1) stopPropagation.call(e2) } e1.preventDefault = function () { preventDefault.call(e1) preventDefault.call(e2) } // calls the handler with the `end` event, // but i don't think it matters. callback.apply(context, args) } // cleanup end events // to cancel the tap, just run this early function cleanup(e2) { // if it's the same event as the origin, // then don't actually cleanup. // hit issues with this - don't remember if (e1 === e2) return clearTimeout(timeout_id) el.removeEventListener('touchmove', cleanup) endEvents.forEach(function (event) { el.removeEventListener(event, done) }) } }
[ "function", "listener", "(", "e1", ")", "{", "// tap should only happen with a single finger", "if", "(", "!", "e1", ".", "touches", "||", "e1", ".", "touches", ".", "length", ">", "1", ")", "return", "var", "el", "=", "e1", ".", "target", "var", "context", "=", "this", "var", "args", "=", "arguments", ";", "var", "timeout_id", "=", "setTimeout", "(", "cleanup", ",", "timeout", ")", "el", ".", "addEventListener", "(", "'touchmove'", ",", "cleanup", ")", "endEvents", ".", "forEach", "(", "function", "(", "event", ")", "{", "el", ".", "addEventListener", "(", "event", ",", "done", ")", "}", ")", "function", "done", "(", "e2", ")", "{", "// since touchstart is added on the same tick", "// and because of bubbling,", "// it'll execute this on the same touchstart.", "// this filters out the same touchstart event.", "if", "(", "e1", "===", "e2", ")", "return", "cleanup", "(", ")", "// already handled", "if", "(", "e2", ".", "defaultPrevented", ")", "return", "// overwrite these functions so that they all to both start and events.", "var", "preventDefault", "=", "e1", ".", "preventDefault", "var", "stopPropagation", "=", "e1", ".", "stopPropagation", "e1", ".", "stopPropagation", "=", "function", "(", ")", "{", "stopPropagation", ".", "call", "(", "e1", ")", "stopPropagation", ".", "call", "(", "e2", ")", "}", "e1", ".", "preventDefault", "=", "function", "(", ")", "{", "preventDefault", ".", "call", "(", "e1", ")", "preventDefault", ".", "call", "(", "e2", ")", "}", "// calls the handler with the `end` event,", "// but i don't think it matters.", "callback", ".", "apply", "(", "context", ",", "args", ")", "}", "// cleanup end events", "// to cancel the tap, just run this early", "function", "cleanup", "(", "e2", ")", "{", "// if it's the same event as the origin,", "// then don't actually cleanup.", "// hit issues with this - don't remember", "if", "(", "e1", "===", "e2", ")", "return", "clearTimeout", "(", "timeout_id", ")", "el", ".", "removeEventListener", "(", "'touchmove'", ",", "cleanup", ")", "endEvents", ".", "forEach", "(", "function", "(", "event", ")", "{", "el", ".", "removeEventListener", "(", "event", ",", "done", ")", "}", ")", "}", "}" ]
[ 1146, 3 ]
[ 1209, 4 ]
null
javascript
de
['de', 'de', 'de']
False
true
statement_block
getGenderClassOfPartner
(partner)
null
Falls der Partner noch Elterninformationen hinterlegt hat, werden diese nicht als Baum dargestellt. Das Vorhandensein eines weiteren Wurzelzweigs (Eltern) wird aber visuell hervorgehoben. Für den Transport dieser Information wird die Gender-Eigentschaft zweckentfremdet.
Falls der Partner noch Elterninformationen hinterlegt hat, werden diese nicht als Baum dargestellt. Das Vorhandensein eines weiteren Wurzelzweigs (Eltern) wird aber visuell hervorgehoben. Für den Transport dieser Information wird die Gender-Eigentschaft zweckentfremdet.
function getGenderClassOfPartner(partner) { var hGender = partner.gender; if (partner.parentConnection !== undefined) { hGender += "-alternativeRoot"; } return hGender; }
[ "function", "getGenderClassOfPartner", "(", "partner", ")", "{", "var", "hGender", "=", "partner", ".", "gender", ";", "if", "(", "partner", ".", "parentConnection", "!==", "undefined", ")", "{", "hGender", "+=", "\"-alternativeRoot\"", ";", "}", "return", "hGender", ";", "}" ]
[ 79, 0 ]
[ 85, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(response)
null
Collection anhandy Key in eine neue kopieren, damit der Benutzer eine eigene erhält und diese bearbeiten kann ohne die gesamte zubearbeiten.
Collection anhandy Key in eine neue kopieren, damit der Benutzer eine eigene erhält und diese bearbeiten kann ohne die gesamte zubearbeiten.
function(response) { if (t.handleError(response) == false) { if (response.collection && response.collection.key) { var key = response.collection.key; // Durch das setzten im Cookie und Storage, wird sein alter Key verworfen. // Im Cookie setzten. $.cookie(t.cookie_name, key, { expires: 30, path: "/" }); // Key setzten. t.setKey(key); // Initialisierung zurücksetzten, damit das neuladen durchgeführt wird. t.setInitDone(null); } } // Key in der Session setzten, da dieser verarbeitet wurde. t.setParameterKey(parameterKey); // Callback aufrufen wenn fertig. if (doneCallback) { doneCallback(); } }
[ "function", "(", "response", ")", "{", "if", "(", "t", ".", "handleError", "(", "response", ")", "==", "false", ")", "{", "if", "(", "response", ".", "collection", "&&", "response", ".", "collection", ".", "key", ")", "{", "var", "key", "=", "response", ".", "collection", ".", "key", ";", "// Durch das setzten im Cookie und Storage, wird sein alter Key verworfen.", "// Im Cookie setzten.", "$", ".", "cookie", "(", "t", ".", "cookie_name", ",", "key", ",", "{", "expires", ":", "30", ",", "path", ":", "\"/\"", "}", ")", ";", "// Key setzten.", "t", ".", "setKey", "(", "key", ")", ";", "// Initialisierung zurücksetzten, damit das neuladen durchgeführt wird.", "t", ".", "setInitDone", "(", "null", ")", ";", "}", "}", "// Key in der Session setzten, da dieser verarbeitet wurde.", "t", ".", "setParameterKey", "(", "parameterKey", ")", ";", "// Callback aufrufen wenn fertig.", "if", "(", "doneCallback", ")", "{", "doneCallback", "(", ")", ";", "}", "}" ]
[ 311, 21 ]
[ 340, 7 ]
null
javascript
de
['de', 'de', 'de']
True
true
variable_declarator
answer
(forms)
null
neue Antwort
neue Antwort
function answer(forms) { forms.forEach(form => { form.addEventListener('submit', (el) => { el.preventDefault(); var ui = firebase.auth().currentUser.uid; db.collection('Users').doc(ui).get().then(doc => { var user = doc.data().user; db.collection('Forum').doc(form.getAttribute('name')).set({ answerNum: firebase.firestore.FieldValue.increment(1), answers: firebase.firestore.FieldValue.arrayUnion({ atext: form['answer'].value, atime: firebase.firestore.Timestamp.fromMillis(Date.now()), auser: user }) }, { merge: true }).then(() => { form.reset(); sorting(); }); }); }) }) }
[ "function", "answer", "(", "forms", ")", "{", "forms", ".", "forEach", "(", "form", "=>", "{", "form", ".", "addEventListener", "(", "'submit'", ",", "(", "el", ")", "=>", "{", "el", ".", "preventDefault", "(", ")", ";", "var", "ui", "=", "firebase", ".", "auth", "(", ")", ".", "currentUser", ".", "uid", ";", "db", ".", "collection", "(", "'Users'", ")", ".", "doc", "(", "ui", ")", ".", "get", "(", ")", ".", "then", "(", "doc", "=>", "{", "var", "user", "=", "doc", ".", "data", "(", ")", ".", "user", ";", "db", ".", "collection", "(", "'Forum'", ")", ".", "doc", "(", "form", ".", "getAttribute", "(", "'name'", ")", ")", ".", "set", "(", "{", "answerNum", ":", "firebase", ".", "firestore", ".", "FieldValue", ".", "increment", "(", "1", ")", ",", "answers", ":", "firebase", ".", "firestore", ".", "FieldValue", ".", "arrayUnion", "(", "{", "atext", ":", "form", "[", "'answer'", "]", ".", "value", ",", "atime", ":", "firebase", ".", "firestore", ".", "Timestamp", ".", "fromMillis", "(", "Date", ".", "now", "(", ")", ")", ",", "auser", ":", "user", "}", ")", "}", ",", "{", "merge", ":", "true", "}", ")", ".", "then", "(", "(", ")", "=>", "{", "form", ".", "reset", "(", ")", ";", "sorting", "(", ")", ";", "}", ")", ";", "}", ")", ";", "}", ")", "}", ")", "}" ]
[ 107, 2 ]
[ 128, 3 ]
null
javascript
de
['de', 'de', 'de']
False
true
program
updateTable
(table)
null
Die Tabllen im widget-table haben spezielle Funktionen wie Paginierung,
Die Tabllen im widget-table haben spezielle Funktionen wie Paginierung,
function updateTable(table) { var activepage = table.data('activepage'); var filter = table.data('filter'); var rowsperpage = table.data('rowsperpage'); var searchvalue = table.data('searchvalue'); // set all rows to show and then apply filters, search and pagination table.find('tbody tr').show(); // disable rows by filter // iterate filters $.each(filter, function(colnumber, value) { // iterate rows table.find('tbody tr').each(function() { // hide rows not matching filter var row = $(this); var showcolline = false; row.find('td:nth-child(' + colnumber + ')').find('.widget-table-col-line').each(function() { var colline = $(this); var collinetext = colline.text(); if ( $.trim(collinetext) == $.trim(value) ) { showcolline = true; } }); if (!showcolline) { $(row).hide(); } }); }); if (searchvalue) { var $rows = $('tbody tr'); var val = '^(?=.*' + $.trim(searchvalue).split(/\s+/).join(')(?=.*') + ').*$', reg = RegExp(val, 'i'), text; $rows.show().filter(function() { text = $(this).text().replace(/\s+/g, ' '); return !reg.test(text); }).hide(); } // Pagination var rowsintable = table.find('tbody tr:visible').length; // rows in the table, all pages // show or hide message that no rows to show if (rowsintable) { table.find('.widget-table-noentriesmessage td').hide(); } else { table.find('.widget-table-noentriesmessage td').show(); } var numberofpages = Math.ceil(rowsintable / rowsperpage); // save back table.data('numberofpages', numberofpages); // hide rows in other pages table.find('tbody tr:visible').each(function(rownumber) { if ((rowsperpage * (activepage-1) > rownumber) || (rowsperpage * activepage <= rownumber)) { $(this).hide(); } }); // show the pagination links needed table.find('.widget-pagination-pagelink').each(function() { if (($(this).data('pagenumber') > numberofpages) || (numberofpages < 2)) { $(this).hide(); } else { $(this).show(); } }); // table.find('tbody tr:not(.widget-table-show)').hide(); // table.find('tbody tr.widget-table-show').show().removeClass('widget-table-show'); table.find('.widget-pagination-pagelink:not([data-pagenumber='+ activepage +'])').removeClass('widget-pagination-pagelink-active'); table.find('.widget-pagination-pagelink[data-pagenumber='+ activepage +']').addClass('widget-pagination-pagelink-active'); // Update status in prev next buttons: if (activepage == 1) { table.find('.widget-pagination-prevbutton').addClass('disabled'); } else { table.find('.widget-pagination-prevbutton').removeClass('disabled'); } if (activepage >= numberofpages) { // ( when numberofpages = 0 is activepage still 1 ) table.find('.widget-pagination-nextbutton').addClass('disabled'); } else { table.find('.widget-pagination-nextbutton').removeClass('disabled'); } // Update links to download CSV or PDF with current filter $('a[data-tableid]').each(function() { var filternames = table.data('filternames'); var param = ""; $.each(filter, function(colnumber, value) { param += "&" + encodeURIComponent([filternames[colnumber]]) + "=" + encodeURIComponent(value); }); if (searchvalue) { param += "&searchvalue=" + encodeURIComponent( searchvalue ) } if (param) { // replace first & with ? param = param.replace('&','?'); } var baseurl = $(this).attr('href'); // Strip parameter if (baseurl.indexOf('?') > 0) { baseurl = baseurl.substring(0, baseurl.indexOf('?')); } $(this).attr('href', baseurl + param); }); // console.log('Table updated. activepage:',activepage,'filter:',filter,'rowsperpage:',rowsperpage,'rowsintable:',rowsintable,'numberofpages:',numberofpages, 'searchvalue:', searchvalue); $(window).trigger('colsreordered'); // Update URL // TODO }
[ "function", "updateTable", "(", "table", ")", "{", "var", "activepage", "=", "table", ".", "data", "(", "'activepage'", ")", ";", "var", "filter", "=", "table", ".", "data", "(", "'filter'", ")", ";", "var", "rowsperpage", "=", "table", ".", "data", "(", "'rowsperpage'", ")", ";", "var", "searchvalue", "=", "table", ".", "data", "(", "'searchvalue'", ")", ";", "// set all rows to show and then apply filters, search and pagination", "table", ".", "find", "(", "'tbody tr'", ")", ".", "show", "(", ")", ";", "// disable rows by filter", "// iterate filters", "$", ".", "each", "(", "filter", ",", "function", "(", "colnumber", ",", "value", ")", "{", "// iterate rows", "table", ".", "find", "(", "'tbody tr'", ")", ".", "each", "(", "function", "(", ")", "{", "// hide rows not matching filter", "var", "row", "=", "$", "(", "this", ")", ";", "var", "showcolline", "=", "false", ";", "row", ".", "find", "(", "'td:nth-child('", "+", "colnumber", "+", "')'", ")", ".", "find", "(", "'.widget-table-col-line'", ")", ".", "each", "(", "function", "(", ")", "{", "var", "colline", "=", "$", "(", "this", ")", ";", "var", "collinetext", "=", "colline", ".", "text", "(", ")", ";", "if", "(", "$", ".", "trim", "(", "collinetext", ")", "==", "$", ".", "trim", "(", "value", ")", ")", "{", "showcolline", "=", "true", ";", "}", "}", ")", ";", "if", "(", "!", "showcolline", ")", "{", "$", "(", "row", ")", ".", "hide", "(", ")", ";", "}", "}", ")", ";", "}", ")", ";", "if", "(", "searchvalue", ")", "{", "var", "$rows", "=", "$", "(", "'tbody tr'", ")", ";", "var", "val", "=", "'^(?=.*'", "+", "$", ".", "trim", "(", "searchvalue", ")", ".", "split", "(", "/", "\\s+", "/", ")", ".", "join", "(", "')(?=.*'", ")", "+", "').*$'", ",", "reg", "=", "RegExp", "(", "val", ",", "'i'", ")", ",", "text", ";", "$rows", ".", "show", "(", ")", ".", "filter", "(", "function", "(", ")", "{", "text", "=", "$", "(", "this", ")", ".", "text", "(", ")", ".", "replace", "(", "/", "\\s+", "/", "g", ",", "' '", ")", ";", "return", "!", "reg", ".", "test", "(", "text", ")", ";", "}", ")", ".", "hide", "(", ")", ";", "}", "// Pagination", "var", "rowsintable", "=", "table", ".", "find", "(", "'tbody tr:visible'", ")", ".", "length", ";", "// rows in the table, all pages", "// show or hide message that no rows to show", "if", "(", "rowsintable", ")", "{", "table", ".", "find", "(", "'.widget-table-noentriesmessage td'", ")", ".", "hide", "(", ")", ";", "}", "else", "{", "table", ".", "find", "(", "'.widget-table-noentriesmessage td'", ")", ".", "show", "(", ")", ";", "}", "var", "numberofpages", "=", "Math", ".", "ceil", "(", "rowsintable", "/", "rowsperpage", ")", ";", "// save back", "table", ".", "data", "(", "'numberofpages'", ",", "numberofpages", ")", ";", "// hide rows in other pages", "table", ".", "find", "(", "'tbody tr:visible'", ")", ".", "each", "(", "function", "(", "rownumber", ")", "{", "if", "(", "(", "rowsperpage", "*", "(", "activepage", "-", "1", ")", ">", "rownumber", ")", "||", "(", "rowsperpage", "*", "activepage", "<=", "rownumber", ")", ")", "{", "$", "(", "this", ")", ".", "hide", "(", ")", ";", "}", "}", ")", ";", "// show the pagination links needed", "table", ".", "find", "(", "'.widget-pagination-pagelink'", ")", ".", "each", "(", "function", "(", ")", "{", "if", "(", "(", "$", "(", "this", ")", ".", "data", "(", "'pagenumber'", ")", ">", "numberofpages", ")", "||", "(", "numberofpages", "<", "2", ")", ")", "{", "$", "(", "this", ")", ".", "hide", "(", ")", ";", "}", "else", "{", "$", "(", "this", ")", ".", "show", "(", ")", ";", "}", "}", ")", ";", "// table.find('tbody tr:not(.widget-table-show)').hide();", "// table.find('tbody tr.widget-table-show').show().removeClass('widget-table-show');", "table", ".", "find", "(", "'.widget-pagination-pagelink:not([data-pagenumber='", "+", "activepage", "+", "'])'", ")", ".", "removeClass", "(", "'widget-pagination-pagelink-active'", ")", ";", "table", ".", "find", "(", "'.widget-pagination-pagelink[data-pagenumber='", "+", "activepage", "+", "']'", ")", ".", "addClass", "(", "'widget-pagination-pagelink-active'", ")", ";", "// Update status in prev next buttons:", "if", "(", "activepage", "==", "1", ")", "{", "table", ".", "find", "(", "'.widget-pagination-prevbutton'", ")", ".", "addClass", "(", "'disabled'", ")", ";", "}", "else", "{", "table", ".", "find", "(", "'.widget-pagination-prevbutton'", ")", ".", "removeClass", "(", "'disabled'", ")", ";", "}", "if", "(", "activepage", ">=", "numberofpages", ")", "{", "// ( when numberofpages = 0 is activepage still 1 )", "table", ".", "find", "(", "'.widget-pagination-nextbutton'", ")", ".", "addClass", "(", "'disabled'", ")", ";", "}", "else", "{", "table", ".", "find", "(", "'.widget-pagination-nextbutton'", ")", ".", "removeClass", "(", "'disabled'", ")", ";", "}", "// Update links to download CSV or PDF with current filter", "$", "(", "'a[data-tableid]'", ")", ".", "each", "(", "function", "(", ")", "{", "var", "filternames", "=", "table", ".", "data", "(", "'filternames'", ")", ";", "var", "param", "=", "\"\"", ";", "$", ".", "each", "(", "filter", ",", "function", "(", "colnumber", ",", "value", ")", "{", "param", "+=", "\"&\"", "+", "encodeURIComponent", "(", "[", "filternames", "[", "colnumber", "]", "]", ")", "+", "\"=\"", "+", "encodeURIComponent", "(", "value", ")", ";", "}", ")", ";", "if", "(", "searchvalue", ")", "{", "param", "+=", "\"&searchvalue=\"", "+", "encodeURIComponent", "(", "searchvalue", ")", "}", "if", "(", "param", ")", "{", "// replace first & with ?", "param", "=", "param", ".", "replace", "(", "'&'", ",", "'?'", ")", ";", "}", "var", "baseurl", "=", "$", "(", "this", ")", ".", "attr", "(", "'href'", ")", ";", "// Strip parameter", "if", "(", "baseurl", ".", "indexOf", "(", "'?'", ")", ">", "0", ")", "{", "baseurl", "=", "baseurl", ".", "substring", "(", "0", ",", "baseurl", ".", "indexOf", "(", "'?'", ")", ")", ";", "}", "$", "(", "this", ")", ".", "attr", "(", "'href'", ",", "baseurl", "+", "param", ")", ";", "}", ")", ";", "// console.log('Table updated. activepage:',activepage,'filter:',filter,'rowsperpage:',rowsperpage,'rowsintable:',rowsintable,'numberofpages:',numberofpages, 'searchvalue:', searchvalue);", "$", "(", "window", ")", ".", "trigger", "(", "'colsreordered'", ")", ";", "// Update URL", "// TODO", "}" ]
[ 35, 1 ]
[ 167, 2 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
Init
()
null
################################################ Step 1 - Einloggen in die Cloud und abrufen aller Gerätedaten, dann vorbereiten der allgemeinen und devicespezifischen Datenpunkte mit anschließendem anlegen derselben
################################################ Step 1 - Einloggen in die Cloud und abrufen aller Gerätedaten, dann vorbereiten der allgemeinen und devicespezifischen Datenpunkte mit anschließendem anlegen derselben
async function Init() { //Cloudlogin und auslesen der gesamten Clouddaten if (logging) log("Reaching init"); mihome.miioProtocol.init();// local miIO try {// cloud MIoT Login await mihome.miCloudProtocol.login(username, password); //Versuch einzuloggen } catch { log("You are already logged in, login canceled"); //Wenn schon eingeloggt }; log("Retrieving your in " + options.country + " registered MiHome Devices"); AllDevicesRaw = await mihome.miCloudProtocol.getDevices(null, options); //Gibt alle vorhandenen Devices zurück und weist die Werte einem lokalen Array zu log("Found " + AllDevicesRaw.length + " MiHome Devices, those are:"); for (let x = 0; x < AllDevicesRaw.length; x++) { //Alle beim User vorhandenen Xiaomi Devices durchgehen log(AllDevicesRaw[x].name); await PrepareGenericDps(AllDevicesRaw[x].did); //und allgemeine generische Infos Dps vorbereiten }; log("Now searching for supported Devices..."); for (let x = 0; x < AllDevicesRaw.length; x++) { //Jetzt erneut alle beim User vorhandenen Xiaomi Devices durchgehen for (let y = 0; y < DefineDevice.length; y++) { //und abgleichen mit von Skript und node-mihome unterstützten Geräten if (AllDevicesRaw[x].model == DefineDevice[y].model) { //Bei match Devicespezifische DPs vorbereiten log("Device " + AllDevicesRaw[x].name + " is supported, creating DataPoints"); await PrepareDeviceDps(AllDevicesRaw[x].did, AllDevicesRaw[x].model); }; }; }; CreateStates(); }
[ "async", "function", "Init", "(", ")", "{", "//Cloudlogin und auslesen der gesamten Clouddaten", "if", "(", "logging", ")", "log", "(", "\"Reaching init\"", ")", ";", "mihome", ".", "miioProtocol", ".", "init", "(", ")", ";", "// local miIO", "try", "{", "// cloud MIoT Login", "await", "mihome", ".", "miCloudProtocol", ".", "login", "(", "username", ",", "password", ")", ";", "//Versuch einzuloggen", "}", "catch", "{", "log", "(", "\"You are already logged in, login canceled\"", ")", ";", "//Wenn schon eingeloggt", "}", ";", "log", "(", "\"Retrieving your in \"", "+", "options", ".", "country", "+", "\" registered MiHome Devices\"", ")", ";", "AllDevicesRaw", "=", "await", "mihome", ".", "miCloudProtocol", ".", "getDevices", "(", "null", ",", "options", ")", ";", "//Gibt alle vorhandenen Devices zurück und weist die Werte einem lokalen Array zu", "log", "(", "\"Found \"", "+", "AllDevicesRaw", ".", "length", "+", "\" MiHome Devices, those are:\"", ")", ";", "for", "(", "let", "x", "=", "0", ";", "x", "<", "AllDevicesRaw", ".", "length", ";", "x", "++", ")", "{", "//Alle beim User vorhandenen Xiaomi Devices durchgehen", "log", "(", "AllDevicesRaw", "[", "x", "]", ".", "name", ")", ";", "await", "PrepareGenericDps", "(", "AllDevicesRaw", "[", "x", "]", ".", "did", ")", ";", "//und allgemeine generische Infos Dps vorbereiten", "}", ";", "log", "(", "\"Now searching for supported Devices...\"", ")", ";", "for", "(", "let", "x", "=", "0", ";", "x", "<", "AllDevicesRaw", ".", "length", ";", "x", "++", ")", "{", "//Jetzt erneut alle beim User vorhandenen Xiaomi Devices durchgehen", "for", "(", "let", "y", "=", "0", ";", "y", "<", "DefineDevice", ".", "length", ";", "y", "++", ")", "{", "//und abgleichen mit von Skript und node-mihome unterstützten Geräten", "if", "(", "AllDevicesRaw", "[", "x", "]", ".", "model", "==", "DefineDevice", "[", "y", "]", ".", "model", ")", "{", "//Bei match Devicespezifische DPs vorbereiten", "log", "(", "\"Device \"", "+", "AllDevicesRaw", "[", "x", "]", ".", "name", "+", "\" is supported, creating DataPoints\"", ")", ";", "await", "PrepareDeviceDps", "(", "AllDevicesRaw", "[", "x", "]", ".", "did", ",", "AllDevicesRaw", "[", "x", "]", ".", "model", ")", ";", "}", ";", "}", ";", "}", ";", "CreateStates", "(", ")", ";", "}" ]
[ 208, 0 ]
[ 237, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
SocketIOConnector
(n)
null
/* sckt connector
/* sckt connector
function SocketIOConnector(n){ RED.nodes.createNode(this, n); this.server = RED.nodes.getNode(n.server); this.server.namespace = n.namespace; this.name = n.name; var node = this; if(sockets[node.id]){ delete sockets[node.id];} sockets[node.id] = connect(this.server); sockets[node.id].on('connect', function(){ node.send({ payload:{socketId:node.id, status:'connected'} }); node.status({fill:"green",shape:"dot", text:"connected"}); node.warn("socketio2.x connected"); }); sockets[node.id].on('disconnect', function(){ node.send({payload:{socketId:node.id, status:'disconnected'}}); node.status({fill:'red',shape:'ring', text:'disconnected'}); node.warn("socketio2.x disconnect"); }); sockets[node.id].on('connect_error', function(err) { if (err) { node.status({fill:'red',shape:'ring',text:'disconnected'}); node.send({payload:{socketId:node.id, status:'disconnected'}}); node.error(err); } }); this.on('close', function(done) { sockets[node.id].disconnect(); node.status({}); done(); }); }
[ "function", "SocketIOConnector", "(", "n", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "n", ")", ";", "this", ".", "server", "=", "RED", ".", "nodes", ".", "getNode", "(", "n", ".", "server", ")", ";", "this", ".", "server", ".", "namespace", "=", "n", ".", "namespace", ";", "this", ".", "name", "=", "n", ".", "name", ";", "var", "node", "=", "this", ";", "if", "(", "sockets", "[", "node", ".", "id", "]", ")", "{", "delete", "sockets", "[", "node", ".", "id", "]", ";", "}", "sockets", "[", "node", ".", "id", "]", "=", "connect", "(", "this", ".", "server", ")", ";", "sockets", "[", "node", ".", "id", "]", ".", "on", "(", "'connect'", ",", "function", "(", ")", "{", "node", ".", "send", "(", "{", "payload", ":", "{", "socketId", ":", "node", ".", "id", ",", "status", ":", "'connected'", "}", "}", ")", ";", "node", ".", "status", "(", "{", "fill", ":", "\"green\"", ",", "shape", ":", "\"dot\"", ",", "text", ":", "\"connected\"", "}", ")", ";", "node", ".", "warn", "(", "\"socketio2.x connected\"", ")", ";", "}", ")", ";", "sockets", "[", "node", ".", "id", "]", ".", "on", "(", "'disconnect'", ",", "function", "(", ")", "{", "node", ".", "send", "(", "{", "payload", ":", "{", "socketId", ":", "node", ".", "id", ",", "status", ":", "'disconnected'", "}", "}", ")", ";", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'disconnected'", "}", ")", ";", "node", ".", "warn", "(", "\"socketio2.x disconnect\"", ")", ";", "}", ")", ";", "sockets", "[", "node", ".", "id", "]", ".", "on", "(", "'connect_error'", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'disconnected'", "}", ")", ";", "node", ".", "send", "(", "{", "payload", ":", "{", "socketId", ":", "node", ".", "id", ",", "status", ":", "'disconnected'", "}", "}", ")", ";", "node", ".", "error", "(", "err", ")", ";", "}", "}", ")", ";", "this", ".", "on", "(", "'close'", ",", "function", "(", "done", ")", "{", "sockets", "[", "node", ".", "id", "]", ".", "disconnect", "(", ")", ";", "node", ".", "status", "(", "{", "}", ")", ";", "done", "(", ")", ";", "}", ")", ";", "}" ]
[ 16, 4 ]
[ 52, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
base64_to_binary
(data)
null
/* Eingebettete Binaerdaten runterladen ***********************************
/* Eingebettete Binaerdaten runterladen ***********************************
function base64_to_binary (data) { var chars = atob(data); var bytes = new Array(chars.length); for (var i = 0; i < chars.length; i++) { bytes[i] = chars.charCodeAt(i); } return new Uint8Array(bytes); }
[ "function", "base64_to_binary", "(", "data", ")", "{", "var", "chars", "=", "atob", "(", "data", ")", ";", "var", "bytes", "=", "new", "Array", "(", "chars", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "chars", ".", "length", ";", "i", "++", ")", "{", "bytes", "[", "i", "]", "=", "chars", ".", "charCodeAt", "(", "i", ")", ";", "}", "return", "new", "Uint8Array", "(", "bytes", ")", ";", "}" ]
[ 42, 0 ]
[ 49, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
getJWTItem
(tokenname,itemname)
null
Hole ein Item aus dem Token
Hole ein Item aus dem Token
function getJWTItem(tokenname,itemname){ var payload = getpayloadJWT(getCookie(tokenname)); if(JSON.parse(atob(payload))[itemname]!== undefined){ return JSON.parse(atob(payload))[itemname]; } else{ return false; } }
[ "function", "getJWTItem", "(", "tokenname", ",", "itemname", ")", "{", "var", "payload", "=", "getpayloadJWT", "(", "getCookie", "(", "tokenname", ")", ")", ";", "if", "(", "JSON", ".", "parse", "(", "atob", "(", "payload", ")", ")", "[", "itemname", "]", "!==", "undefined", ")", "{", "return", "JSON", ".", "parse", "(", "atob", "(", "payload", ")", ")", "[", "itemname", "]", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
[ 81, 0 ]
[ 89, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
integer
(n)
null
/* Einige grundlegenden Funktionen müssen wegen Javascript Fehlern umgeschrieben werden. Man versuche z.B. 0xffffffff >> 4 zu berechnen.. Die nun verwendeten Funktionen sind zwar langsamer als die Originale, aber sie funktionieren.
/* Einige grundlegenden Funktionen müssen wegen Javascript Fehlern umgeschrieben werden. Man versuche z.B. 0xffffffff >> 4 zu berechnen.. Die nun verwendeten Funktionen sind zwar langsamer als die Originale, aber sie funktionieren.
function integer(n) { return n%(0xffffffff+1); }
[ "function", "integer", "(", "n", ")", "{", "return", "n", "%", "(", "0xffffffff", "+", "1", ")", ";", "}" ]
[ 33, 0 ]
[ 33, 48 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(title, link, app, host)
null
result schematic
result schematic
function(title, link, app, host) { return { 'title': title, 'link': link, 'app': app, 'host': host }; }
[ "function", "(", "title", ",", "link", ",", "app", ",", "host", ")", "{", "return", "{", "'title'", ":", "title", ",", "'link'", ":", "link", ",", "'app'", ":", "app", ",", "'host'", ":", "host", "}", ";", "}" ]
[ 11, 15 ]
[ 18, 1 ]
null
javascript
de
['de', 'de', 'de']
False
true
variable_declarator