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
buildZip
(name, dataME)
null
1) generate JSON from save file, use the node version of "append-images" 2) nous avons un JSON pret à l'emploi pour du raycasting 3) nous allons extraire les images base64 dans des fichiers 4) il faut préparer la structure des répertoire Zips a project @param name {string} name of the project to be zipped @param dataME {*} data content @returns {Promise<{filename, bytes}>} will be resolve when the archive is fully built
1) generate JSON from save file, use the node version of "append-images" 2) nous avons un JSON pret à l'emploi pour du raycasting 3) nous allons extraire les images base64 dans des fichiers 4) il faut préparer la structure des répertoire Zips a project
async function buildZip(name, dataME) { const ZIP_PATH = path.resolve(persist.getVaultPath(), name, 'zip'); await mkdirp(ZIP_PATH); const dataENG = await generate(dataME, appendImages); return generateZipPackage(name, dataENG, ZIP_PATH); }
[ "async", "function", "buildZip", "(", "name", ",", "dataME", ")", "{", "const", "ZIP_PATH", "=", "path", ".", "resolve", "(", "persist", ".", "getVaultPath", "(", ")", ",", "name", ",", "'zip'", ")", ";", "await", "mkdirp", "(", "ZIP_PATH", ")", ";", "const", "dataENG", "=", "await", "generate", "(", "dataME", ",", "appendImages", ")", ";", "return", "generateZipPackage", "(", "name", ",", "dataENG", ",", "ZIP_PATH", ")", ";", "}" ]
[ 187, 0 ]
[ 192, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
showDetail
(event)
null
/* affiche le détail produit
/* affiche le détail produit
function showDetail(event) { event.preventDefault(); window.location.href = 'detail.html?id=' + this.dataset.id; }
[ "function", "showDetail", "(", "event", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "window", ".", "location", ".", "href", "=", "'detail.html?id='", "+", "this", ".", "dataset", ".", "id", ";", "}" ]
[ 29, 0 ]
[ 32, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
toto
()
null
Comparateur
Comparateur
function toto() { throw 'Error' }
[ "function", "toto", "(", ")", "{", "throw", "'Error'", "}" ]
[ 72, 0 ]
[ 74, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
False
true
program
(pName, pValue)
null
Si pValue==null l'attribut n'est pas ajouté.
Si pValue==null l'attribut n'est pas ajouté.
function (pName, pValue) { if (pValue != null) this.fNode.setAttribute(pName, pValue); return this; }
[ "function", "(", "pName", ",", "pValue", ")", "{", "if", "(", "pValue", "!=", "null", ")", "this", ".", "fNode", ".", "setAttribute", "(", "pName", ",", "pValue", ")", ";", "return", "this", ";", "}" ]
[ 293, 6 ]
[ 296, 2 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
addList
(_x)
null
Listener bouton Ajoutez une liste
Listener bouton Ajoutez une liste
function addList(_x) { return _addList.apply(this, arguments); }
[ "function", "addList", "(", "_x", ")", "{", "return", "_addList", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
[ 910, 2 ]
[ 912, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
getPlayerIds
(perso)
null
retourne un tableau contenant la liste des ID de joueurs controlant le personnage lié au Token
retourne un tableau contenant la liste des ID de joueurs controlant le personnage lié au Token
function getPlayerIds(perso) { var player_ids = []; var character = getObj('character', perso.charId); var char_controlledby = character.get('controlledby'); if (char_controlledby === '') return player_ids; _.each(char_controlledby.split(","), function(controlledby) { var player = getObj('player', controlledby); if (player === undefined) return; player_ids.push(controlledby); }); return player_ids; }
[ "function", "getPlayerIds", "(", "perso", ")", "{", "var", "player_ids", "=", "[", "]", ";", "var", "character", "=", "getObj", "(", "'character'", ",", "perso", ".", "charId", ")", ";", "var", "char_controlledby", "=", "character", ".", "get", "(", "'controlledby'", ")", ";", "if", "(", "char_controlledby", "===", "''", ")", "return", "player_ids", ";", "_", ".", "each", "(", "char_controlledby", ".", "split", "(", "\",\"", ")", ",", "function", "(", "controlledby", ")", "{", "var", "player", "=", "getObj", "(", "'player'", ",", "controlledby", ")", ";", "if", "(", "player", "===", "undefined", ")", "return", ";", "player_ids", ".", "push", "(", "controlledby", ")", ";", "}", ")", ";", "return", "player_ids", ";", "}" ]
[ 80, 2 ]
[ 91, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
(pDocument)
null
Retourne un objet contenant les key/value des cookies d'un document.
Retourne un objet contenant les key/value des cookies d'un document.
function (pDocument) { var vMap = {}; var vC = pDocument.cookie; if (!vC) return vMap; var vEntries = vC.split(";"); for (var i = 0; i < vEntries.length; i++) { var vEntry = vEntries[i]; var vIdx = vEntry.indexOf("="); vMap[vEntry.substring(0, vIdx).trim()] = decodeURIComponent(vEntry.substring(vIdx + 1)); } return vMap; }
[ "function", "(", "pDocument", ")", "{", "var", "vMap", "=", "{", "}", ";", "var", "vC", "=", "pDocument", ".", "cookie", ";", "if", "(", "!", "vC", ")", "return", "vMap", ";", "var", "vEntries", "=", "vC", ".", "split", "(", "\";\"", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "vEntries", ".", "length", ";", "i", "++", ")", "{", "var", "vEntry", "=", "vEntries", "[", "i", "]", ";", "var", "vIdx", "=", "vEntry", ".", "indexOf", "(", "\"=\"", ")", ";", "vMap", "[", "vEntry", ".", "substring", "(", "0", ",", "vIdx", ")", ".", "trim", "(", ")", "]", "=", "decodeURIComponent", "(", "vEntry", ".", "substring", "(", "vIdx", "+", "1", ")", ")", ";", "}", "return", "vMap", ";", "}" ]
[ 402, 15 ]
[ 413, 2 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
find
(id)
null
Afficher un hobbie en fonction de son id
Afficher un hobbie en fonction de son id
async function find(id) { const cachedHobbie = await Cache.get("hobbies." + id); if(cachedHobbie) return cachedHobbie; return axios .get(HOBBIES_API + "/" + id) .then(response => { const hobbie = response.data; console.log(hobbie); Cache.set("user." + id, hobbie); return hobbie; } ); }
[ "async", "function", "find", "(", "id", ")", "{", "const", "cachedHobbie", "=", "await", "Cache", ".", "get", "(", "\"hobbies.\"", "+", "id", ")", ";", "if", "(", "cachedHobbie", ")", "return", "cachedHobbie", ";", "return", "axios", ".", "get", "(", "HOBBIES_API", "+", "\"/\"", "+", "id", ")", ".", "then", "(", "response", "=>", "{", "const", "hobbie", "=", "response", ".", "data", ";", "console", ".", "log", "(", "hobbie", ")", ";", "Cache", ".", "set", "(", "\"user.\"", "+", "id", ",", "hobbie", ")", ";", "return", "hobbie", ";", "}", ")", ";", "}" ]
[ 20, 0 ]
[ 33, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
rollDePlus
(de, options)
null
options: bonus:int, deExplosif:bool Renvoie 1dk + bonus, avec le texte champs val et roll
options: bonus:int, deExplosif:bool Renvoie 1dk + bonus, avec le texte champs val et roll
function rollDePlus(de, options) { options = options || {}; var bonus = options.bonus || 0; var explose = options.deExplosif || false; var texteJetDeTotal = ''; var jetTotal = 0; do { var jetDe = randomInteger(de); texteJetDeTotal += jetDe; jetTotal += jetDe; explose = explose && (jetDe === de); if (explose) texteJetDeTotal += ','; } while (explose && jetTotal < 1000); var res = { val: jetTotal + bonus }; var msg = '<span style="display: inline-block; border-radius: 5px; padding: 0 4px; background-color: #F1E6DA; color: #000;" title="1d'; msg += de; if (options.deExplosif) msg += '!'; if (bonus > 0) { msg += '+' + bonus; texteJetDeTotal += '+' + bonus; } else if (bonus < 0) { msg += bonus; texteJetDeTotal += bonus; } msg += ' = ' + texteJetDeTotal + '" class="a inlinerollresult showtip tipsy-n">'; msg += res.val + "</span>"; res.roll = msg; return res; }
[ "function", "rollDePlus", "(", "de", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "bonus", "=", "options", ".", "bonus", "||", "0", ";", "var", "explose", "=", "options", ".", "deExplosif", "||", "false", ";", "var", "texteJetDeTotal", "=", "''", ";", "var", "jetTotal", "=", "0", ";", "do", "{", "var", "jetDe", "=", "randomInteger", "(", "de", ")", ";", "texteJetDeTotal", "+=", "jetDe", ";", "jetTotal", "+=", "jetDe", ";", "explose", "=", "explose", "&&", "(", "jetDe", "===", "de", ")", ";", "if", "(", "explose", ")", "texteJetDeTotal", "+=", "','", ";", "}", "while", "(", "explose", "&&", "jetTotal", "<", "1000", ")", ";", "var", "res", "=", "{", "val", ":", "jetTotal", "+", "bonus", "}", ";", "var", "msg", "=", "'<span style=\"display: inline-block; border-radius: 5px; padding: 0 4px; background-color: #F1E6DA; color: #000;\" title=\"1d'", ";", "msg", "+=", "de", ";", "if", "(", "options", ".", "deExplosif", ")", "msg", "+=", "'!'", ";", "if", "(", "bonus", ">", "0", ")", "{", "msg", "+=", "'+'", "+", "bonus", ";", "texteJetDeTotal", "+=", "'+'", "+", "bonus", ";", "}", "else", "if", "(", "bonus", "<", "0", ")", "{", "msg", "+=", "bonus", ";", "texteJetDeTotal", "+=", "bonus", ";", "}", "msg", "+=", "' = '", "+", "texteJetDeTotal", "+", "'\" class=\"a inlinerollresult showtip tipsy-n\">'", ";", "msg", "+=", "res", ".", "val", "+", "\"</span>\"", ";", "res", ".", "roll", "=", "msg", ";", "return", "res", ";", "}" ]
[ 638, 2 ]
[ 668, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
my_info
()
null
On enregistre les données de l'utilisateur en local(téléphone,username,userid,rtc_id)
On enregistre les données de l'utilisateur en local(téléphone,username,userid,rtc_id)
function my_info() { $.ajax({ url: $('.my_info').attr('url_info'), type: 'POST', async : false, dataType:"json", error: function(data){ my_username = $.jStorage.get('username'); my_numero = $.jStorage.get('numero'); my_user_id = $.jStorage.get('user_id'); }, success:function(data) { if(data.statu =='connected') { my_username = $.trim(data.username); my_numero = $.trim(data.numero); my_user_id = $.trim(data.user_id); } } }); }
[ "function", "my_info", "(", ")", "{", "$", ".", "ajax", "(", "{", "url", ":", "$", "(", "'.my_info'", ")", ".", "attr", "(", "'url_info'", ")", ",", "type", ":", "'POST'", ",", "async", ":", "false", ",", "dataType", ":", "\"json\"", ",", "error", ":", "function", "(", "data", ")", "{", "my_username", "=", "$", ".", "jStorage", ".", "get", "(", "'username'", ")", ";", "my_numero", "=", "$", ".", "jStorage", ".", "get", "(", "'numero'", ")", ";", "my_user_id", "=", "$", ".", "jStorage", ".", "get", "(", "'user_id'", ")", ";", "}", ",", "success", ":", "function", "(", "data", ")", "{", "if", "(", "data", ".", "statu", "==", "'connected'", ")", "{", "my_username", "=", "$", ".", "trim", "(", "data", ".", "username", ")", ";", "my_numero", "=", "$", ".", "trim", "(", "data", ".", "numero", ")", ";", "my_user_id", "=", "$", ".", "trim", "(", "data", ".", "user_id", ")", ";", "}", "}", "}", ")", ";", "}" ]
[ 28, 1 ]
[ 57, 2 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
getPlayerIds
(perso)
null
retourne un tableau contenant la liste des ID de joueurs connectés controlant le personnage lié au Token
retourne un tableau contenant la liste des ID de joueurs connectés controlant le personnage lié au Token
function getPlayerIds(perso) { var character = getObj('character', perso.charId); if (character === undefined) return; var charControlledby = character.get('controlledby'); if (charControlledby === '') return []; var playerIds = []; charControlledby.split(",").forEach(function(controlledby) { var player = getObj('player', controlledby); if (player === undefined) return; if (player.get('online')) playerIds.push(controlledby); }); return playerIds; }
[ "function", "getPlayerIds", "(", "perso", ")", "{", "var", "character", "=", "getObj", "(", "'character'", ",", "perso", ".", "charId", ")", ";", "if", "(", "character", "===", "undefined", ")", "return", ";", "var", "charControlledby", "=", "character", ".", "get", "(", "'controlledby'", ")", ";", "if", "(", "charControlledby", "===", "''", ")", "return", "[", "]", ";", "var", "playerIds", "=", "[", "]", ";", "charControlledby", ".", "split", "(", "\",\"", ")", ".", "forEach", "(", "function", "(", "controlledby", ")", "{", "var", "player", "=", "getObj", "(", "'player'", ",", "controlledby", ")", ";", "if", "(", "player", "===", "undefined", ")", "return", ";", "if", "(", "player", ".", "get", "(", "'online'", ")", ")", "playerIds", ".", "push", "(", "controlledby", ")", ";", "}", ")", ";", "return", "playerIds", ";", "}" ]
[ 338, 2 ]
[ 350, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
()
null
les scripts des programmes sont dans le fichier ./build/scripts/programmesSemaines.js /* ---------------------------------------fin de la sous section agenda-------------------------- /* ---------------------------------------sous section conseils--------------------------
les scripts des programmes sont dans le fichier ./build/scripts/programmesSemaines.js /* ---------------------------------------fin de la sous section agenda-------------------------- /* ---------------------------------------sous section conseils--------------------------
function() { botui.message.add({ loading: true, delay: 1000, photo: 'build/rasht.png', content: "Quelques conseils pratique pour réussir son année!" }) .then(function () { return botui.action.button({ delay: 1000, action: [{ text: 'Dans le cadre des évaluations', value: 'eval' }, { text: 'Dans le cadre de la vie universitaire ', value: 'univ_life' }, { text: 'Retour', icon: 'angle-left', value: 'skip' }] }) }).then(function (res) { if(res.value == 'eval') { //showReminderInput(); évaluations(); } else if(res.value == 'univ_life') { univ_life(); } else { sup5(); } }); }
[ "function", "(", ")", "{", "botui", ".", "message", ".", "add", "(", "{", "loading", ":", "true", ",", "delay", ":", "1000", ",", "photo", ":", "'build/rasht.png'", ",", "content", ":", "\"Quelques conseils pratique pour réussir son année!\"", "}", ")", ".", "then", "(", "function", "(", ")", "{", "return", "botui", ".", "action", ".", "button", "(", "{", "delay", ":", "1000", ",", "action", ":", "[", "{", "text", ":", "'Dans le cadre des évaluations',", "", "value", ":", "'eval'", "}", ",", "{", "text", ":", "'Dans le cadre de la vie universitaire '", ",", "value", ":", "'univ_life'", "}", ",", "{", "text", ":", "'Retour'", ",", "icon", ":", "'angle-left'", ",", "value", ":", "'skip'", "}", "]", "}", ")", "}", ")", ".", "then", "(", "function", "(", "res", ")", "{", "if", "(", "res", ".", "value", "==", "'eval'", ")", "{", "//showReminderInput();", "évaluations(", ")", ";", "", "}", "else", "if", "(", "res", ".", "value", "==", "'univ_life'", ")", "{", "univ_life", "(", ")", ";", "}", "else", "{", "sup5", "(", ")", ";", "}", "}", ")", ";", "}" ]
[ 86, 17 ]
[ 120, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
preload
()
null
on précharge le fichier audio
on précharge le fichier audio
function preload() { source_file = loadSound('../assets/Soni_Ventorum_Wind_Quintet_-_08_-_Danzi_Wind_Quintet_Op_67_No_3_In_E-Flat_Major_4_Allegretto.mp3'); }
[ "function", "preload", "(", ")", "{", "source_file", "=", "loadSound", "(", "'../assets/Soni_Ventorum_Wind_Quintet_-_08_-_Danzi_Wind_Quintet_Op_67_No_3_In_E-Flat_Major_4_Allegretto.mp3'", ")", ";", "}" ]
[ 11, 0 ]
[ 13, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
hasLimit
(event)
null
colocar limite de Uploud de Photos
colocar limite de Uploud de Photos
function hasLimit(event) { var uploadLimit = PhotosUpload.uploadLimit, input = PhotosUpload.input, priview = PhotosUpload.priview; var fileList = input.files; if (fileList.length > uploadLimit) { alert("Envie no m\xE1ximo ".concat(uploadLimit, " fotos")); event.preventDefault(); return true; } var photoDiv = []; priview.childNodes.forEach(function (item) { if (item.classList && item.classList.value == "photo") photoDiv.push(item); }); var totalPhotos = fileList.length + photoDiv.length; if (totalPhotos > uploadLimit) { alert("Você atingiu o limite máximo de fotos"); event.preventDefault(); return true; } return false; }
[ "function", "hasLimit", "(", "event", ")", "{", "var", "uploadLimit", "=", "PhotosUpload", ".", "uploadLimit", ",", "input", "=", "PhotosUpload", ".", "input", ",", "priview", "=", "PhotosUpload", ".", "priview", ";", "var", "fileList", "=", "input", ".", "files", ";", "if", "(", "fileList", ".", "length", ">", "uploadLimit", ")", "{", "alert", "(", "\"Envie no m\\xE1ximo \"", ".", "concat", "(", "uploadLimit", ",", "\" fotos\"", ")", ")", ";", "event", ".", "preventDefault", "(", ")", ";", "return", "true", ";", "}", "var", "photoDiv", "=", "[", "]", ";", "priview", ".", "childNodes", ".", "forEach", "(", "function", "(", "item", ")", "{", "if", "(", "item", ".", "classList", "&&", "item", ".", "classList", ".", "value", "==", "\"photo\"", ")", "photoDiv", ".", "push", "(", "item", ")", ";", "}", ")", ";", "var", "totalPhotos", "=", "fileList", ".", "length", "+", "photoDiv", ".", "length", ";", "if", "(", "totalPhotos", ">", "uploadLimit", ")", "{", "alert", "(", "\"Você atingiu o limite máximo de fotos\");", "", "", "event", ".", "preventDefault", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
[ 167, 12 ]
[ 192, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
(event)
null
/*// // "bypassEmptyValues" permet de switcher entre suppression ou non des valeurs vides. True = suppression / False = pas de suppression var bypassEmptyValues = false; var html = '<input type="text" name="juniorInputDisponibilities" id="disponibilities">'; var json = '{'; var otArr = []; var tbl2 = $('#dispo_table tr').each(function (i) { x = $(this).children(); var itArr = []; x.each(function () { if (bypassEmptyValues == true && $(this).text() != '') { itArr.push('"' + $(this).text() + '"'); } else { itArr.push('"' + $(this).text() + '"'); } }); otArr.push('"' + i + '": [' + itArr.join(',') + ']'); }); json += otArr.join(",") + '}'; $("#results_dispo").append(html); $("#disponibilities").val(json); },
/*// // "bypassEmptyValues" permet de switcher entre suppression ou non des valeurs vides. True = suppression / False = pas de suppression var bypassEmptyValues = false; var html = '<input type="text" name="juniorInputDisponibilities" id="disponibilities">'; var json = '{'; var otArr = []; var tbl2 = $('#dispo_table tr').each(function (i) { x = $(this).children(); var itArr = []; x.each(function () { if (bypassEmptyValues == true && $(this).text() != '') { itArr.push('"' + $(this).text() + '"'); } else { itArr.push('"' + $(this).text() + '"'); } }); otArr.push('"' + i + '": [' + itArr.join(',') + ']'); }); json += otArr.join(",") + '}'; $("#results_dispo").append(html); $("#disponibilities").val(json); },
function(event) { var target = $(event.target); if (target.hasClass("available")) { target.removeClass("available"); target.empty(); } else { target.addClass("available"); var id = target.attr("dispo-day"); target.append(id); } }
[ "function", "(", "event", ")", "{", "var", "target", "=", "$", "(", "event", ".", "target", ")", ";", "if", "(", "target", ".", "hasClass", "(", "\"available\"", ")", ")", "{", "target", ".", "removeClass", "(", "\"available\"", ")", ";", "target", ".", "empty", "(", ")", ";", "}", "else", "{", "target", ".", "addClass", "(", "\"available\"", ")", ";", "var", "id", "=", "target", ".", "attr", "(", "\"dispo-day\"", ")", ";", "target", ".", "append", "(", "id", ")", ";", "}", "}" ]
[ 31, 19 ]
[ 41, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
Draw_Empty
()
null
Dessine le bouton permettant l'ajout d'une liste
Dessine le bouton permettant l'ajout d'une liste
function Draw_Empty(){ $("#Add").remove(); $("<div id='Add' class='col-lg-3'>").appendTo($("#main")); var oAdd = $("#Add"); var sHTML = "<div class='fixed-bottom'>"+ "<div class='scooter'></div>"+ "<span class='list-group-item list-group-item-action list-group-item-primary text-center btn-add'></span>"+ "</div>"; var btnAdd = $(sHTML).appendTo(oAdd); init_events(data); }
[ "function", "Draw_Empty", "(", ")", "{", "$", "(", "\"#Add\"", ")", ".", "remove", "(", ")", ";", "$", "(", "\"<div id='Add' class='col-lg-3'>\"", ")", ".", "appendTo", "(", "$", "(", "\"#main\"", ")", ")", ";", "var", "oAdd", "=", "$", "(", "\"#Add\"", ")", ";", "var", "sHTML", "=", "\"<div class='fixed-bottom'>\"", "+", "\"<div class='scooter'></div>\"", "+", "\"<span class='list-group-item list-group-item-action list-group-item-primary text-center btn-add'></span>\"", "+", "\"</div>\"", ";", "var", "btnAdd", "=", "$", "(", "sHTML", ")", ".", "appendTo", "(", "oAdd", ")", ";", "init_events", "(", "data", ")", ";", "}" ]
[ 205, 4 ]
[ 216, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
checkLiked
()
null
Modifie l'apparence du bouton Like si l'user a déjà aimé ce vin
Modifie l'apparence du bouton Like si l'user a déjà aimé ce vin
function checkLiked() { if (sessionStorage.length) { // Vérifie si l'user a aimé ce vin if (arrLikedWines.indexOf($("#idVin").val()) !== -1) { $("#likeButton").attr("class", "btn btn-success"); $("#iconLike").text(" Liked !"); } else { $("#iconLike").text(" Like Wine"); $("#likeButton").attr("class", "btn btn-danger"); } } }
[ "function", "checkLiked", "(", ")", "{", "if", "(", "sessionStorage", ".", "length", ")", "{", "// Vérifie si l'user a aimé ce vin", "if", "(", "arrLikedWines", ".", "indexOf", "(", "$", "(", "\"#idVin\"", ")", ".", "val", "(", ")", ")", "!==", "-", "1", ")", "{", "$", "(", "\"#likeButton\"", ")", ".", "attr", "(", "\"class\"", ",", "\"btn btn-success\"", ")", ";", "$", "(", "\"#iconLike\"", ")", ".", "text", "(", "\" Liked !\"", ")", ";", "}", "else", "{", "$", "(", "\"#iconLike\"", ")", ".", "text", "(", "\" Like Wine\"", ")", ";", "$", "(", "\"#likeButton\"", ")", ".", "attr", "(", "\"class\"", ",", "\"btn btn-danger\"", ")", ";", "}", "}", "}" ]
[ 202, 0 ]
[ 213, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
hydrating_form_dump
(id, file, url)
null
formulaire pour suppression backup
formulaire pour suppression backup
function hydrating_form_dump(id, file, url) { document.getElementById("id").value=id; document.getElementById("dump_name").innerHTML=file; document.getElementById("file").value=file; document.getElementById("url").value=url; }
[ "function", "hydrating_form_dump", "(", "id", ",", "file", ",", "url", ")", "{", "document", ".", "getElementById", "(", "\"id\"", ")", ".", "value", "=", "id", ";", "document", ".", "getElementById", "(", "\"dump_name\"", ")", ".", "innerHTML", "=", "file", ";", "document", ".", "getElementById", "(", "\"file\"", ")", ".", "value", "=", "file", ";", "document", ".", "getElementById", "(", "\"url\"", ")", ".", "value", "=", "url", ";", "}" ]
[ 7, 0 ]
[ 12, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
toggleAutoPlay
()
null
Problème Auto-Play sur Chrome et Firefox !!
Problème Auto-Play sur Chrome et Firefox !!
function toggleAutoPlay() { isAutoPlay = !isAutoPlay; if (isAutoPlay) { // Bloque le scroll quand l'utilisateur est en mode auto-play $("body").addClass("no-scroll"); var bottom = $("#scroller").height() - $(window).height(); var duration = getDuration(bottom); $("html, body").animate( { scrollTop: bottom, }, duration ); } else { $("html, body").stop(); $("body").removeClass("no-scroll"); } // Change l'icon du bouton $("#auto-play #auto-play-on, #auto-play #auto-play-off").toggleClass( "d-none" ); }
[ "function", "toggleAutoPlay", "(", ")", "{", "isAutoPlay", "=", "!", "isAutoPlay", ";", "if", "(", "isAutoPlay", ")", "{", "// Bloque le scroll quand l'utilisateur est en mode auto-play", "$", "(", "\"body\"", ")", ".", "addClass", "(", "\"no-scroll\"", ")", ";", "var", "bottom", "=", "$", "(", "\"#scroller\"", ")", ".", "height", "(", ")", "-", "$", "(", "window", ")", ".", "height", "(", ")", ";", "var", "duration", "=", "getDuration", "(", "bottom", ")", ";", "$", "(", "\"html, body\"", ")", ".", "animate", "(", "{", "scrollTop", ":", "bottom", ",", "}", ",", "duration", ")", ";", "}", "else", "{", "$", "(", "\"html, body\"", ")", ".", "stop", "(", ")", ";", "$", "(", "\"body\"", ")", ".", "removeClass", "(", "\"no-scroll\"", ")", ";", "}", "// Change l'icon du bouton", "$", "(", "\"#auto-play #auto-play-on, #auto-play #auto-play-off\"", ")", ".", "toggleClass", "(", "\"d-none\"", ")", ";", "}" ]
[ 192, 0 ]
[ 217, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
modCarac
(perso, carac)
null
Retourne le mod de la caractéristque entière. si carac n'est pas une carac, retourne 0
Retourne le mod de la caractéristque entière. si carac n'est pas une carac, retourne 0
function modCarac(perso, carac) { var res = Math.floor((ficheAttributeAsInt(perso, carac, 10) - 10) / 2); if (carac == 'FORCE' && attributeAsBool(perso, 'mutationMusclesHypertrophies')) res += 2; else if (carac == 'DEXTERITE' && attributeAsBool(perso, 'mutationSilhouetteFiliforme')) res += 4; return res; }
[ "function", "modCarac", "(", "perso", ",", "carac", ")", "{", "var", "res", "=", "Math", ".", "floor", "(", "(", "ficheAttributeAsInt", "(", "perso", ",", "carac", ",", "10", ")", "-", "10", ")", "/", "2", ")", ";", "if", "(", "carac", "==", "'FORCE'", "&&", "attributeAsBool", "(", "perso", ",", "'mutationMusclesHypertrophies'", ")", ")", "res", "+=", "2", ";", "else", "if", "(", "carac", "==", "'DEXTERITE'", "&&", "attributeAsBool", "(", "perso", ",", "'mutationSilhouetteFiliforme'", ")", ")", "res", "+=", "4", ";", "return", "res", ";", "}" ]
[ 1091, 2 ]
[ 1096, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
bonusAttaqueA
(attaquant, name, weaponName, evt, explications, options)
null
Bonus au jet d'attaque qui ne dépendent pas du défenseur
Bonus au jet d'attaque qui ne dépendent pas du défenseur
function bonusAttaqueA(attaquant, name, weaponName, evt, explications, options) { var attBonus = 0; if (options.bonusAttaque) attBonus += options.bonusAttaque; attBonus += bonusDAttaque(attaquant, explications, evt); if (getState(attaquant, 'aveugle')) { if (options.distance) { attBonus -= 10; explications.push("Attaquant aveuglé -> -10 à l'attaque à distance"); } else { attBonus -= 5; explications.push("Attaquant aveuglé -> -5 à l'attaque"); } } if (options.tirDouble) { attBonus += 2; explications.push(name + " tire avec 2 " + weaponName + "s à la fois!"); } if (options.chance) { attBonus += options.chance; var pc = options.chance / 10; explications.push(pc + " point" + ((pc > 1) ? "s" : "") + " de chance dépensé -> +" + options.chance); } if (options.semonce) { attBonus += 5; } if (attributeAsBool(attaquant, 'baroudHonneurActif')) { attBonus += 5; explications.push(name + " porte une dernière attaque et s'effondre");
[ "function", "bonusAttaqueA", "(", "attaquant", ",", "name", ",", "weaponName", ",", "evt", ",", "explications", ",", "options", ")", "{", "var", "attBonus", "=", "0", ";", "if", "(", "options", ".", "bonusAttaque", ")", "attBonus", "+=", "options", ".", "bonusAttaque", ";", "attBonus", "+=", "bonusDAttaque", "(", "attaquant", ",", "explications", ",", "evt", ")", ";", "if", "(", "getState", "(", "attaquant", ",", "'aveugle'", ")", ")", "{", "if", "(", "options", ".", "distance", ")", "{", "attBonus", "-=", "10", ";", "explications", ".", "push", "(", "\"Attaquant aveuglé -> -10 à l'attaque à distance\");", "", "", "}", "else", "{", "attBonus", "-=", "5", ";", "explications", ".", "push", "(", "\"Attaquant aveuglé -> -5 à l'attaque\");", "", "", "}", "}", "if", "(", "options", ".", "tirDouble", ")", "{", "attBonus", "+=", "2", ";", "explications", ".", "push", "(", "name", "+", "\" tire avec 2 \"", "+", "weaponName", "+", "\"s à la fois!\")", ";", "", "}", "if", "(", "options", ".", "chance", ")", "{", "attBonus", "+=", "options", ".", "chance", ";", "var", "pc", "=", "options", ".", "chance", "/", "10", ";", "explications", ".", "push", "(", "pc", "+", "\" point\"", "+", "(", "(", "pc", ">", "1", ")", "?", "\"s\"", ":", "\"\"", ")", "+", "\" de chance dépensé -> +\" +", "o", "tions.c", "h", "ance);", "", "", "}", "if", "(", "options", ".", "semonce", ")", "{", "attBonus", "+=", "5", ";", "}", "if", "(", "attributeAsBool", "(", "attaquant", ",", "'baroudHonneurActif'", ")", ")", "{", "attBonus", "+=", "5", ";", "explications", ".", "push", "(", "name", "+", "\" porte une dernière attaque et s'effondre\")", ";", "", "", "" ]
[ 1200, 2 ]
[ 1227, 77 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
searchParams
(json, categoryField, searchField, searchVal)
null
Renvoie l'objet json correspondant à la catégorie, au critère voulue
Renvoie l'objet json correspondant à la catégorie, au critère voulue
function searchParams(json, categoryField, searchField, searchVal) { for (var i=0 ; i < json[categoryField].length ; i++) { if (json[categoryField][i][searchField] == searchVal) { return json[categoryField][i] } } }
[ "function", "searchParams", "(", "json", ",", "categoryField", ",", "searchField", ",", "searchVal", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "json", "[", "categoryField", "]", ".", "length", ";", "i", "++", ")", "{", "if", "(", "json", "[", "categoryField", "]", "[", "i", "]", "[", "searchField", "]", "==", "searchVal", ")", "{", "return", "json", "[", "categoryField", "]", "[", "i", "]", "}", "}", "}" ]
[ 55, 0 ]
[ 62, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
shorterFloat
()
null
6 chiffres après la virgule max
6 chiffres après la virgule max
function shorterFloat() { let something = 1000000; let somethingelse = 0.000001; //i know it's not good but that's to only way to get a json that have always the same length :) or not roll += somethingelse; pitch += somethingelse; yaw += somethingelse; throttle += somethingelse; roll = Math.round(roll * something) / something; pitch = Math.round(pitch * something) / something; yaw = Math.round(yaw * something) / something; throttle = Math.round(throttle * something) / something; }
[ "function", "shorterFloat", "(", ")", "{", "let", "something", "=", "1000000", ";", "let", "somethingelse", "=", "0.000001", ";", "//i know it's not good but that's to only way to get a json that have always the same length :) or not", "roll", "+=", "somethingelse", ";", "pitch", "+=", "somethingelse", ";", "yaw", "+=", "somethingelse", ";", "throttle", "+=", "somethingelse", ";", "roll", "=", "Math", ".", "round", "(", "roll", "*", "something", ")", "/", "something", ";", "pitch", "=", "Math", ".", "round", "(", "pitch", "*", "something", ")", "/", "something", ";", "yaw", "=", "Math", ".", "round", "(", "yaw", "*", "something", ")", "/", "something", ";", "throttle", "=", "Math", ".", "round", "(", "throttle", "*", "something", ")", "/", "something", ";", "}" ]
[ 95, 0 ]
[ 107, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
updateCurrentBar
(token, barNumber, val, evt, maxVal)
null
Si evt est défini, alors on considère qu'il faut y mettre la valeur actuelle
Si evt est défini, alors on considère qu'il faut y mettre la valeur actuelle
function updateCurrentBar(token, barNumber, val, evt, maxVal) { var prevToken; var HTdeclared; try { HTdeclared = HealthColors; } catch (e) { if (e.name != "ReferenceError") throw (e); } if (HTdeclared) { //Pour pouvoir annuler les effets de HealthColor sur le statut affectToken(token, 'statusmarkers', token.get('statusmarkers'), evt); prevToken = JSON.parse(JSON.stringify(token)); } var fieldv = 'bar' + barNumber + '_value'; var fieldm; if (maxVal) fieldm = 'bar' + barNumber + '_max'; var attrId = token.get("bar" + barNumber + "_link"); if (attrId === "") { var prevVal = token.get(fieldv); if (evt) affectToken(token, fieldv, prevVal, evt); token.set(fieldv, val); if (maxVal) { var prevMax = token.get(fieldm); if (evt) affectToken(token, fieldm, token.get(fieldm), evt); token.set(fieldm, val); } if (HTdeclared) HealthColors.Update(token, prevToken); return; } var attr = getObj('attribute', attrId); if (evt) { evt.attributes = evt.attributes || []; evt.attributes.push({ attribute: attr, current: attr.get('current'), max: attr.get('max') }); } var aset = { current: val }; if (maxVal) aset.max = maxVal; attr.setWithWorker(aset); if (HTdeclared) HealthColors.Update(token, prevToken); }
[ "function", "updateCurrentBar", "(", "token", ",", "barNumber", ",", "val", ",", "evt", ",", "maxVal", ")", "{", "var", "prevToken", ";", "var", "HTdeclared", ";", "try", "{", "HTdeclared", "=", "HealthColors", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "e", ".", "name", "!=", "\"ReferenceError\"", ")", "throw", "(", "e", ")", ";", "}", "if", "(", "HTdeclared", ")", "{", "//Pour pouvoir annuler les effets de HealthColor sur le statut", "affectToken", "(", "token", ",", "'statusmarkers'", ",", "token", ".", "get", "(", "'statusmarkers'", ")", ",", "evt", ")", ";", "prevToken", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "token", ")", ")", ";", "}", "var", "fieldv", "=", "'bar'", "+", "barNumber", "+", "'_value'", ";", "var", "fieldm", ";", "if", "(", "maxVal", ")", "fieldm", "=", "'bar'", "+", "barNumber", "+", "'_max'", ";", "var", "attrId", "=", "token", ".", "get", "(", "\"bar\"", "+", "barNumber", "+", "\"_link\"", ")", ";", "if", "(", "attrId", "===", "\"\"", ")", "{", "var", "prevVal", "=", "token", ".", "get", "(", "fieldv", ")", ";", "if", "(", "evt", ")", "affectToken", "(", "token", ",", "fieldv", ",", "prevVal", ",", "evt", ")", ";", "token", ".", "set", "(", "fieldv", ",", "val", ")", ";", "if", "(", "maxVal", ")", "{", "var", "prevMax", "=", "token", ".", "get", "(", "fieldm", ")", ";", "if", "(", "evt", ")", "affectToken", "(", "token", ",", "fieldm", ",", "token", ".", "get", "(", "fieldm", ")", ",", "evt", ")", ";", "token", ".", "set", "(", "fieldm", ",", "val", ")", ";", "}", "if", "(", "HTdeclared", ")", "HealthColors", ".", "Update", "(", "token", ",", "prevToken", ")", ";", "return", ";", "}", "var", "attr", "=", "getObj", "(", "'attribute'", ",", "attrId", ")", ";", "if", "(", "evt", ")", "{", "evt", ".", "attributes", "=", "evt", ".", "attributes", "||", "[", "]", ";", "evt", ".", "attributes", ".", "push", "(", "{", "attribute", ":", "attr", ",", "current", ":", "attr", ".", "get", "(", "'current'", ")", ",", "max", ":", "attr", ".", "get", "(", "'max'", ")", "}", ")", ";", "}", "var", "aset", "=", "{", "current", ":", "val", "}", ";", "if", "(", "maxVal", ")", "aset", ".", "max", "=", "maxVal", ";", "attr", ".", "setWithWorker", "(", "aset", ")", ";", "if", "(", "HTdeclared", ")", "HealthColors", ".", "Update", "(", "token", ",", "prevToken", ")", ";", "}" ]
[ 1000, 2 ]
[ 1044, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
drawMatrix
()
null
Affichage de la matrix de corrélation
Affichage de la matrix de corrélation
function drawMatrix() { const c = document.getElementById("cmatrix") const ctx = c.getContext("2d") ctx.putImageData(drawMatrix.data, 0, 0) }
[ "function", "drawMatrix", "(", ")", "{", "const", "c", "=", "document", ".", "getElementById", "(", "\"cmatrix\"", ")", "const", "ctx", "=", "c", ".", "getContext", "(", "\"2d\"", ")", "ctx", ".", "putImageData", "(", "drawMatrix", ".", "data", ",", "0", ",", "0", ")", "}" ]
[ 257, 2 ]
[ 261, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
convertToken
(query)
null
Convertir les tokens oauth en token utilisables
Convertir les tokens oauth en token utilisables
async function convertToken(query){ var request_convert = await fetch(`https://api.twitter.com/oauth/access_token?oauth_token=${query.oauth_token}&oauth_verifier=${query.oauth_verifier}`, { method: 'post', }) .then(res => res.text()) .catch(err => console.log(chalk.red("Impossible de convertir les tokens oauth : vérifier votre connexion, sinon veuillez contacter @Johan_Stickman") + chalk.cyan(" (Code erreur #7.2)")) && process.exit()) // Arrêter le spinner spinner.text = " Conversion des tokens" spinner.succeed() // Retourner les tokens addConfig(new URLSearchParams(request_convert)) }
[ "async", "function", "convertToken", "(", "query", ")", "{", "var", "request_convert", "=", "await", "fetch", "(", "`", "${", "query", ".", "oauth_token", "}", "${", "query", ".", "oauth_verifier", "}", "`", ",", "{", "method", ":", "'post'", ",", "}", ")", ".", "then", "(", "res", "=>", "res", ".", "text", "(", ")", ")", ".", "catch", "(", "err", "=>", "console", ".", "log", "(", "chalk", ".", "red", "(", "\"Impossible de convertir les tokens oauth : vérifier votre connexion, sinon veuillez contacter @Johan_Stickman\")", " ", " ", "halk.", "c", "yan(", "\"", " (Code erreur #7.2)\")", ")", " ", "& ", "rocess.", "e", "xit(", ")", ")", "\r", "// Arrêter le spinner\r", "spinner", ".", "text", "=", "\" Conversion des tokens\"", "spinner", ".", "succeed", "(", ")", "// Retourner les tokens\r", "addConfig", "(", "new", "URLSearchParams", "(", "request_convert", ")", ")", "}" ]
[ 98, 0 ]
[ 111, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
isAdmin
()
null
Function qui vérifie le role retourné dans le currentUser appartient bien aux roles dans role.js
Function qui vérifie le role retourné dans le currentUser appartient bien aux roles dans role.js
function isAdmin() { //console.log(role()) return role() === Role.Admin; }
[ "function", "isAdmin", "(", ")", "{", "//console.log(role())", "return", "role", "(", ")", "===", "Role", ".", "Admin", ";", "}" ]
[ 73, 0 ]
[ 76, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
(node)
null
Function: unescapeNode Unescape a node part (also called local part) of a JID. Parameters: (String) node - A node (or local part). Returns: An unescaped node (or local part).
Function: unescapeNode Unescape a node part (also called local part) of a JID.
function (node) { return node.replace(/\\20/g, " ") .replace(/\\22/g, '"') .replace(/\\26/g, "&") .replace(/\\27/g, "'") .replace(/\\2f/g, "/") .replace(/\\3a/g, ":") .replace(/\\3c/g, "<") .replace(/\\3e/g, ">") .replace(/\\40/g, "@") .replace(/\\5c/g, "\\"); }
[ "function", "(", "node", ")", "{", "return", "node", ".", "replace", "(", "/", "\\\\20", "/", "g", ",", "\" \"", ")", ".", "replace", "(", "/", "\\\\22", "/", "g", ",", "'\"'", ")", ".", "replace", "(", "/", "\\\\26", "/", "g", ",", "\"&\"", ")", ".", "replace", "(", "/", "\\\\27", "/", "g", ",", "\"'\"", ")", ".", "replace", "(", "/", "\\\\2f", "/", "g", ",", "\"/\"", ")", ".", "replace", "(", "/", "\\\\3a", "/", "g", ",", "\":\"", ")", ".", "replace", "(", "/", "\\\\3c", "/", "g", ",", "\"<\"", ")", ".", "replace", "(", "/", "\\\\3e", "/", "g", ",", "\">\"", ")", ".", "replace", "(", "/", "\\\\40", "/", "g", ",", "\"@\"", ")", ".", "replace", "(", "/", "\\\\5c", "/", "g", ",", "\"\\\\\"", ")", ";", "}" ]
[ 935, 18 ]
[ 947, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
False
true
pair
resetCar
(delay, callback)
null
Ajout de la transition
Ajout de la transition
function resetCar(delay, callback) { myCarMode.transition().delay(delay) .attr('x', startMode.x) .attr('y', startMode.y) .duration(0) .each("end", callback); }
[ "function", "resetCar", "(", "delay", ",", "callback", ")", "{", "myCarMode", ".", "transition", "(", ")", ".", "delay", "(", "delay", ")", ".", "attr", "(", "'x'", ",", "startMode", ".", "x", ")", ".", "attr", "(", "'y'", ",", "startMode", ".", "y", ")", ".", "duration", "(", "0", ")", ".", "each", "(", "\"end\"", ",", "callback", ")", ";", "}" ]
[ 100, 0 ]
[ 106, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
resetSearch
()
null
Efface toute valeur dans l'input strSearch
Efface toute valeur dans l'input strSearch
function resetSearch() { document.getElementById("strSearch").value = ""; }
[ "function", "resetSearch", "(", ")", "{", "document", ".", "getElementById", "(", "\"strSearch\"", ")", ".", "value", "=", "\"\"", ";", "}" ]
[ 56, 0 ]
[ 58, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
findAll
()
null
Afficher tous les hobbies
Afficher tous les hobbies
async function findAll () { const cachedHobbies= await Cache.get("users"); if(cachedHobbies) return cachedHobbies; return axios .get(HOBBIES_API) .then(response => { const users = response.data["hydra:member"]; Cache.set("hobbies", hobbies); return hobbies; }); }
[ "async", "function", "findAll", "(", ")", "{", "const", "cachedHobbies", "=", "await", "Cache", ".", "get", "(", "\"users\"", ")", ";", "if", "(", "cachedHobbies", ")", "return", "cachedHobbies", ";", "return", "axios", ".", "get", "(", "HOBBIES_API", ")", ".", "then", "(", "response", "=>", "{", "const", "users", "=", "response", ".", "data", "[", "\"hydra:member\"", "]", ";", "Cache", ".", "set", "(", "\"hobbies\"", ",", "hobbies", ")", ";", "return", "hobbies", ";", "}", ")", ";", "}" ]
[ 6, 0 ]
[ 17, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
remove
(toRemove)
null
Supprime un element du tableau des erreurs
Supprime un element du tableau des erreurs
function remove(toRemove){ var indice = error.indexOf(toRemove); if(indice != -1){ error.splice(indice,1) } }
[ "function", "remove", "(", "toRemove", ")", "{", "var", "indice", "=", "error", ".", "indexOf", "(", "toRemove", ")", ";", "if", "(", "indice", "!=", "-", "1", ")", "{", "error", ".", "splice", "(", "indice", ",", "1", ")", "}", "}" ]
[ 192, 0 ]
[ 197, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
Add_List
(data)
null
Ajout d'une liste
Ajout d'une liste
function Add_List(data){ $.ajax({ type: 'post', data: GetFlux(data, ADD_LIST), contentType: "application/json; charset=utf-8", url: "http://92.222.69.104/todo/listes" }).done(function(response) { Draw(response); }); }
[ "function", "Add_List", "(", "data", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "'post'", ",", "data", ":", "GetFlux", "(", "data", ",", "ADD_LIST", ")", ",", "contentType", ":", "\"application/json; charset=utf-8\"", ",", "url", ":", "\"http://92.222.69.104/todo/listes\"", "}", ")", ".", "done", "(", "function", "(", "response", ")", "{", "Draw", "(", "response", ")", ";", "}", ")", ";", "}" ]
[ 44, 4 ]
[ 53, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
()
null
efface tout les localStorage donc efface le panier
efface tout les localStorage donc efface le panier
function () { localStorage.clear(); location.reload(true); }
[ "function", "(", ")", "{", "localStorage", ".", "clear", "(", ")", ";", "location", ".", "reload", "(", "true", ")", ";", "}" ]
[ 257, 16 ]
[ 260, 17 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
assignment_expression
keyPressed
()
null
les notes sons jouées ici
les notes sons jouées ici
function keyPressed() { // si la touche préssée est dans notre tableau if (keys[key]) { note = keys[key] // on récupère la valeur midi play(note) // on appelle une fonction spécifique } }
[ "function", "keyPressed", "(", ")", "{", "// si la touche préssée est dans notre tableau", "if", "(", "keys", "[", "key", "]", ")", "{", "note", "=", "keys", "[", "key", "]", "// on récupère la valeur midi", "play", "(", "note", ")", "// on appelle une fonction spécifique", "}", "}" ]
[ 73, 0 ]
[ 79, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
add
(toAdd)
null
Ajoute un element au tableau des erreurs
Ajoute un element au tableau des erreurs
function add(toAdd){ error.push(toAdd); error = [...new Set(error)]; }
[ "function", "add", "(", "toAdd", ")", "{", "error", ".", "push", "(", "toAdd", ")", ";", "error", "=", "[", "...", "new", "Set", "(", "error", ")", "]", ";", "}" ]
[ 187, 0 ]
[ 190, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
soigneToken
(perso, soins, evt, callTrue, callMax, options)
null
fonction avec callback, mais synchrone
fonction avec callback, mais synchrone
function soigneToken(perso, soins, evt, callTrue, callMax, options) { options = options || {}; var token = perso.token; var bar1 = parseInt(token.get("bar1_value")); var pvmax = parseInt(token.get("bar1_max")); if (isNaN(bar1) || isNaN(pvmax)) { error("Soins sur un token sans points de vie", token); return; } var updateBar1; if (bar1 >= pvmax) bar1 = pvmax; else updateBar1 = true; if (soins < 0) soins = 0; var nonSoignable = 0; //Update des dm suivis var attrs = findObjs({ _type: 'attribute', _characterid: perso.charId, }); var regSuivis = '^DMSuivis([^_]+)'; var link = token.get('bar1_link'); if (link === '') regSuivis += "_" + token.get('name') + '$'; else regSuivis += '$'; regSuivis = new RegExp(regSuivis); var soinsSuivis = soins; var soinsImpossible = new Set(options.saufDMType); attrs.forEach(function(a) { if (soinsSuivis === 0) return; var an = a.get('name'); an = an.match(regSuivis); if (an && an.length > 0) { var ds = parseInt(a.get('current')); if (ds > 0) { if (an[0].length < 2) { error("Match non trouvé pour les soins", an); return; } if (soinsImpossible.has(an[1])) { nonSoignable += ds; } else { if (ds > soinsSuivis) { evt.attributes = evt.attributes || []; evt.attributes.push({ attribute: a, current: ds }); ds -= soinsSuivis; a.set('current', ds); soinsSuivis = 0; } else { soinsSuivis -= ds; ds = 0; } } } else ds = 0; if (ds === 0) { evt.deletedAttributes = evt.deletedAttributes || []; evt.deletedAttributes.push(a); a.remove(); } } }); pvmax -= nonSoignable; if (bar1 === 0) { if (attributeAsBool(perso, 'etatExsangue')) { removeTokenAttr(perso, 'etatExsangue', evt, "retrouve des couleurs"); } } if (charAttributeAsBool(perso, 'vieArtificielle')) { soins = Math.floor(soins / 2); } bar1 += soins; var soinsEffectifs = soins; if (bar1 > pvmax) { if (attributeAsBool(perso, 'formeDArbre')) { var apv = tokenAttribute(perso, 'anciensPV'); if (apv.length > 0) { apv = apv[0]; var anciensPV = parseInt(apv.get('current')); var anciensMax = parseInt(apv.get('max')); if (!(isNaN(anciensPV) || isNaN(anciensMax)) && anciensPV < anciensMax) { var soinsTransferes = bar1 - pvmax; if (anciensMax - anciensPV < soinsTransferes) soinsTransferes = anciensMax - anciensPV; anciensPV += soinsTransferes; bar1 -= soinsTransferes; setTokenAttr(perso, 'anciensPV', anciensPV, evt, undefined, anciensMax); } } } // On cherche si il y a des DM temporaires à soigner if (bar1 > pvmax) { var hasMana = (ficheAttributeAsInt(perso, 'PM', 0) > 0); var dmgTemp; if (hasMana) dmgTemp = attributeAsInt(perso, 'DMTEMP', 0); else { dmgTemp = parseInt(token.get('bar2_value')); if (isNaN(dmgTemp)) dmgTemp = 0; } if (dmgTemp > 0) { var newDmgTemp = dmgTemp - bar1 + pvmax; if (newDmgTemp < 0) { newDmgTemp = 0; bar1 -= dmgTemp; } else bar1 = pvmax; if (hasMana) setTokenAttr(perso, 'DMTEMP', newDmgTemp, evt); else updateCurrentBar(token, 2, newDmgTemp, evt); } soinsEffectifs -= (bar1 - pvmax); bar1 = pvmax; } } if (updateBar1) updateCurrentBar(token, 1, bar1, evt); if (soinsEffectifs > 0) { if (callTrue) callTrue(soinsEffectifs); } else { if (callMax) callMax(); } }
[ "function", "soigneToken", "(", "perso", ",", "soins", ",", "evt", ",", "callTrue", ",", "callMax", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "token", "=", "perso", ".", "token", ";", "var", "bar1", "=", "parseInt", "(", "token", ".", "get", "(", "\"bar1_value\"", ")", ")", ";", "var", "pvmax", "=", "parseInt", "(", "token", ".", "get", "(", "\"bar1_max\"", ")", ")", ";", "if", "(", "isNaN", "(", "bar1", ")", "||", "isNaN", "(", "pvmax", ")", ")", "{", "error", "(", "\"Soins sur un token sans points de vie\"", ",", "token", ")", ";", "return", ";", "}", "var", "updateBar1", ";", "if", "(", "bar1", ">=", "pvmax", ")", "bar1", "=", "pvmax", ";", "else", "updateBar1", "=", "true", ";", "if", "(", "soins", "<", "0", ")", "soins", "=", "0", ";", "var", "nonSoignable", "=", "0", ";", "//Update des dm suivis", "var", "attrs", "=", "findObjs", "(", "{", "_type", ":", "'attribute'", ",", "_characterid", ":", "perso", ".", "charId", ",", "}", ")", ";", "var", "regSuivis", "=", "'^DMSuivis([^_]+)'", ";", "var", "link", "=", "token", ".", "get", "(", "'bar1_link'", ")", ";", "if", "(", "link", "===", "''", ")", "regSuivis", "+=", "\"_\"", "+", "token", ".", "get", "(", "'name'", ")", "+", "'$'", ";", "else", "regSuivis", "+=", "'$'", ";", "regSuivis", "=", "new", "RegExp", "(", "regSuivis", ")", ";", "var", "soinsSuivis", "=", "soins", ";", "var", "soinsImpossible", "=", "new", "Set", "(", "options", ".", "saufDMType", ")", ";", "attrs", ".", "forEach", "(", "function", "(", "a", ")", "{", "if", "(", "soinsSuivis", "===", "0", ")", "return", ";", "var", "an", "=", "a", ".", "get", "(", "'name'", ")", ";", "an", "=", "an", ".", "match", "(", "regSuivis", ")", ";", "if", "(", "an", "&&", "an", ".", "length", ">", "0", ")", "{", "var", "ds", "=", "parseInt", "(", "a", ".", "get", "(", "'current'", ")", ")", ";", "if", "(", "ds", ">", "0", ")", "{", "if", "(", "an", "[", "0", "]", ".", "length", "<", "2", ")", "{", "error", "(", "\"Match non trouvé pour les soins\",", " ", "n)", ";", "", "return", ";", "}", "if", "(", "soinsImpossible", ".", "has", "(", "an", "[", "1", "]", ")", ")", "{", "nonSoignable", "+=", "ds", ";", "}", "else", "{", "if", "(", "ds", ">", "soinsSuivis", ")", "{", "evt", ".", "attributes", "=", "evt", ".", "attributes", "||", "[", "]", ";", "evt", ".", "attributes", ".", "push", "(", "{", "attribute", ":", "a", ",", "current", ":", "ds", "}", ")", ";", "ds", "-=", "soinsSuivis", ";", "a", ".", "set", "(", "'current'", ",", "ds", ")", ";", "soinsSuivis", "=", "0", ";", "}", "else", "{", "soinsSuivis", "-=", "ds", ";", "ds", "=", "0", ";", "}", "}", "}", "else", "ds", "=", "0", ";", "if", "(", "ds", "===", "0", ")", "{", "evt", ".", "deletedAttributes", "=", "evt", ".", "deletedAttributes", "||", "[", "]", ";", "evt", ".", "deletedAttributes", ".", "push", "(", "a", ")", ";", "a", ".", "remove", "(", ")", ";", "}", "}", "}", ")", ";", "pvmax", "-=", "nonSoignable", ";", "if", "(", "bar1", "===", "0", ")", "{", "if", "(", "attributeAsBool", "(", "perso", ",", "'etatExsangue'", ")", ")", "{", "removeTokenAttr", "(", "perso", ",", "'etatExsangue'", ",", "evt", ",", "\"retrouve des couleurs\"", ")", ";", "}", "}", "if", "(", "charAttributeAsBool", "(", "perso", ",", "'vieArtificielle'", ")", ")", "{", "soins", "=", "Math", ".", "floor", "(", "soins", "/", "2", ")", ";", "}", "bar1", "+=", "soins", ";", "var", "soinsEffectifs", "=", "soins", ";", "if", "(", "bar1", ">", "pvmax", ")", "{", "if", "(", "attributeAsBool", "(", "perso", ",", "'formeDArbre'", ")", ")", "{", "var", "apv", "=", "tokenAttribute", "(", "perso", ",", "'anciensPV'", ")", ";", "if", "(", "apv", ".", "length", ">", "0", ")", "{", "apv", "=", "apv", "[", "0", "]", ";", "var", "anciensPV", "=", "parseInt", "(", "apv", ".", "get", "(", "'current'", ")", ")", ";", "var", "anciensMax", "=", "parseInt", "(", "apv", ".", "get", "(", "'max'", ")", ")", ";", "if", "(", "!", "(", "isNaN", "(", "anciensPV", ")", "||", "isNaN", "(", "anciensMax", ")", ")", "&&", "anciensPV", "<", "anciensMax", ")", "{", "var", "soinsTransferes", "=", "bar1", "-", "pvmax", ";", "if", "(", "anciensMax", "-", "anciensPV", "<", "soinsTransferes", ")", "soinsTransferes", "=", "anciensMax", "-", "anciensPV", ";", "anciensPV", "+=", "soinsTransferes", ";", "bar1", "-=", "soinsTransferes", ";", "setTokenAttr", "(", "perso", ",", "'anciensPV'", ",", "anciensPV", ",", "evt", ",", "undefined", ",", "anciensMax", ")", ";", "}", "}", "}", "// On cherche si il y a des DM temporaires à soigner", "if", "(", "bar1", ">", "pvmax", ")", "{", "var", "hasMana", "=", "(", "ficheAttributeAsInt", "(", "perso", ",", "'PM'", ",", "0", ")", ">", "0", ")", ";", "var", "dmgTemp", ";", "if", "(", "hasMana", ")", "dmgTemp", "=", "attributeAsInt", "(", "perso", ",", "'DMTEMP'", ",", "0", ")", ";", "else", "{", "dmgTemp", "=", "parseInt", "(", "token", ".", "get", "(", "'bar2_value'", ")", ")", ";", "if", "(", "isNaN", "(", "dmgTemp", ")", ")", "dmgTemp", "=", "0", ";", "}", "if", "(", "dmgTemp", ">", "0", ")", "{", "var", "newDmgTemp", "=", "dmgTemp", "-", "bar1", "+", "pvmax", ";", "if", "(", "newDmgTemp", "<", "0", ")", "{", "newDmgTemp", "=", "0", ";", "bar1", "-=", "dmgTemp", ";", "}", "else", "bar1", "=", "pvmax", ";", "if", "(", "hasMana", ")", "setTokenAttr", "(", "perso", ",", "'DMTEMP'", ",", "newDmgTemp", ",", "evt", ")", ";", "else", "updateCurrentBar", "(", "token", ",", "2", ",", "newDmgTemp", ",", "evt", ")", ";", "}", "soinsEffectifs", "-=", "(", "bar1", "-", "pvmax", ")", ";", "bar1", "=", "pvmax", ";", "}", "}", "if", "(", "updateBar1", ")", "updateCurrentBar", "(", "token", ",", "1", ",", "bar1", ",", "evt", ")", ";", "if", "(", "soinsEffectifs", ">", "0", ")", "{", "if", "(", "callTrue", ")", "callTrue", "(", "soinsEffectifs", ")", ";", "}", "else", "{", "if", "(", "callMax", ")", "callMax", "(", ")", ";", "}", "}" ]
[ 797, 2 ]
[ 916, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
pickOrRemove
(gene)
null
permet d'ajouter un gene a la liste des genes choisis par l'utilisateur si il n'est pas deja présent, l'enlève sinon.
permet d'ajouter un gene a la liste des genes choisis par l'utilisateur si il n'est pas deja présent, l'enlève sinon.
function pickOrRemove(gene){ let index = $.inArray(gene,listGene); //si l'élément gene est dans la liste if (index!==-1){ listGene.splice(index,1); //enlever gene }else{ listGene.push(gene); listGene.sort(); } }
[ "function", "pickOrRemove", "(", "gene", ")", "{", "let", "index", "=", "$", ".", "inArray", "(", "gene", ",", "listGene", ")", ";", "//si l'élément gene est dans la liste", "if", "(", "index", "!==", "-", "1", ")", "{", "listGene", ".", "splice", "(", "index", ",", "1", ")", ";", "//enlever gene", "}", "else", "{", "listGene", ".", "push", "(", "gene", ")", ";", "listGene", ".", "sort", "(", ")", ";", "}", "}" ]
[ 76, 0 ]
[ 85, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
(response)
null
fonction contenant les tests de la reponse
fonction contenant les tests de la reponse
function (response) { console.log(response); should.exist(response.locations); expect(response.locations).to.be.an("Array"); expect(response.locations).to.have.length(1); expect(response.locations[0]).to.have.property("position"); expect(response.locations[0].position).to.be.an("object"); expect(response.locations[0]).to.have.deep.property("position.x"); expect(response.locations[0]).to.have.deep.property("position.y"); expect(response.locations[0]).to.have.property("accuracy"); expect(response.locations[0]).to.have.property("matchType"); expect(response.locations[0]).to.have.property("type","StreetAddress"); expect(response.locations[0]).to.have.property("placeAttributes"); expect(response.locations[0].placeAttributes).to.be.an("object"); }
[ "function", "(", "response", ")", "{", "console", ".", "log", "(", "response", ")", ";", "should", ".", "exist", "(", "response", ".", "locations", ")", ";", "expect", "(", "response", ".", "locations", ")", ".", "to", ".", "be", ".", "an", "(", "\"Array\"", ")", ";", "expect", "(", "response", ".", "locations", ")", ".", "to", ".", "have", ".", "length", "(", "1", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "property", "(", "\"position\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ".", "position", ")", ".", "to", ".", "be", ".", "an", "(", "\"object\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "deep", ".", "property", "(", "\"position.x\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "deep", ".", "property", "(", "\"position.y\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "property", "(", "\"accuracy\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "property", "(", "\"matchType\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "property", "(", "\"type\"", ",", "\"StreetAddress\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ")", ".", "to", ".", "have", ".", "property", "(", "\"placeAttributes\"", ")", ";", "expect", "(", "response", ".", "locations", "[", "0", "]", ".", "placeAttributes", ")", ".", "to", ".", "be", ".", "an", "(", "\"object\"", ")", ";", "}" ]
[ 85, 37 ]
[ 99, 17 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
(p)
null
on crée une nouvelle variable sketch, celle qui est appelée dans le setup ce sera un programme p5js. Il est nécessaire de passer une "instance" de p5 pour pouvoir accès aux fonction de p5. C'est le "p" utilisé un peu partout. On doit "l'appeler" avant chaque fonction intégrée dans p5 (par ex : p.fill(255))
on crée une nouvelle variable sketch, celle qui est appelée dans le setup ce sera un programme p5js. Il est nécessaire de passer une "instance" de p5 pour pouvoir accès aux fonction de p5. C'est le "p" utilisé un peu partout. On doit "l'appeler" avant chaque fonction intégrée dans p5 (par ex : p.fill(255))
function(p) { var capture; p.setup = function() { // on créer le setup de notre programme avec "p." devant le mot clé setup var c = p.createCanvas(p.windowWidth/2, p.windowHeight/2); // on crée un canvas c.position(0,0); // on le place dans la page // initialisation de la capture capture = p.createCapture(p.VIDEO); capture.size(p.width, p.height); capture.hide() } p.draw = function() { p.background(255); p.scale(-1,1) p.image(capture, -p.width , 0, p.width, p.height); } }
[ "function", "(", "p", ")", "{", "var", "capture", ";", "p", ".", "setup", "=", "function", "(", ")", "{", "// on créer le setup de notre programme avec \"p.\" devant le mot clé setup", "var", "c", "=", "p", ".", "createCanvas", "(", "p", ".", "windowWidth", "/", "2", ",", "p", ".", "windowHeight", "/", "2", ")", ";", "// on crée un canvas", "c", ".", "position", "(", "0", ",", "0", ")", ";", "// on le place dans la page", "// initialisation de la capture", "capture", "=", "p", ".", "createCapture", "(", "p", ".", "VIDEO", ")", ";", "capture", ".", "size", "(", "p", ".", "width", ",", "p", ".", "height", ")", ";", "capture", ".", "hide", "(", ")", "}", "p", ".", "draw", "=", "function", "(", ")", "{", "p", ".", "background", "(", "255", ")", ";", "p", ".", "scale", "(", "-", "1", ",", "1", ")", "p", ".", "image", "(", "capture", ",", "-", "p", ".", "width", ",", "0", ",", "p", ".", "width", ",", "p", ".", "height", ")", ";", "}", "}" ]
[ 14, 13 ]
[ 29, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
()
null
recherche sur le test
recherche sur le test
function() { test1 = 'test', date2= 'la date du test', botui.message.bot({ loading:true, delay: 1000, photo: 'build/rasht.png', content: 'Quelle est votre recherche?' }).then(function () { return botui.action.text({ // putin de merde de return delay: 1000, action: { icon: 'search', placeholder: 'La date des tests' } }); }).then(function (res) { /*récupérer l'entrée de l'utilisateur comme un tableau, et faire des parsing avec des mots clés *si le mot test existe dans le tableau, on renvoi une liste d'action * si le mot test et date existe dans le tableau tous les deux, on renovie une liste d'action * encore plus précise ( juste la date des test en l'occurence.) */ if(res.value == test1 || res.value == date2) { search_test(); } else if(res.value == 'filière') { fillière(); }else if(res.value == 'autres') { autres(); } else { return botui.message.bot({ delay: 1000, photo: 'build/rasht.png', content: 'Oups, je n\'ai pas bien compris votre recherche' }).then(function () { return recherche() }) } }) ; }
[ "function", "(", ")", "{", "test1", "=", "'test'", ",", "date2", "=", "'la date du test'", ",", "botui", ".", "message", ".", "bot", "(", "{", "loading", ":", "true", ",", "delay", ":", "1000", ",", "photo", ":", "'build/rasht.png'", ",", "content", ":", "'Quelle est votre recherche?'", "}", ")", ".", "then", "(", "function", "(", ")", "{", "return", "botui", ".", "action", ".", "text", "(", "{", "// putin de merde de return", "delay", ":", "1000", ",", "action", ":", "{", "icon", ":", "'search'", ",", "placeholder", ":", "'La date des tests'", "}", "}", ")", ";", "}", ")", ".", "then", "(", "function", "(", "res", ")", "{", "/*récupérer l'entrée de l'utilisateur comme un tableau, et faire des parsing avec des mots clés\n *si le mot test existe dans le tableau, on renvoi une liste d'action\n * si le mot test et date existe dans le tableau tous les deux, on renovie une liste d'action \n * encore plus précise ( juste la date des test en l'occurence.)\n */", "if", "(", "res", ".", "value", "==", "test1", "||", "res", ".", "value", "==", "date2", ")", "{", "search_test", "(", ")", ";", "}", "else", "if", "(", "res", ".", "value", "==", "'filière')", " ", "", "fillière(", ")", ";", "", "}", "else", "if", "(", "res", ".", "value", "==", "'autres'", ")", "{", "autres", "(", ")", ";", "}", "else", "{", "return", "botui", ".", "message", ".", "bot", "(", "{", "delay", ":", "1000", ",", "photo", ":", "'build/rasht.png'", ",", "content", ":", "'Oups, je n\\'ai pas bien compris votre recherche'", "}", ")", ".", "then", "(", "function", "(", ")", "{", "return", "recherche", "(", ")", "}", ")", "}", "}", ")", ";", "}" ]
[ 3, 16 ]
[ 45, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
(stats)
null
dest : dest,
dest : dest,
function(stats){ if (stats.size >= r.asset.size){ return false } return true }
[ "function", "(", "stats", ")", "{", "if", "(", "stats", ".", "size", ">=", "r", ".", "asset", ".", "size", ")", "{", "return", "false", "}", "return", "true", "}" ]
[ 188, 24 ]
[ 194, 17 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
verif
()
null
Fonction pour les messages d'erreurs du formulaire de connexion
Fonction pour les messages d'erreurs du formulaire de connexion
function verif() { // Récupère la valeur saisie dans le champ input var mail = $("#mail").val(); var mail_v = /^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,252}\.[a-z]{2,4}$/; var mdp = $("#mdp").val(); var mdp_v = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).{8,}$/; // On teste si la valeur est bonne // EMAIL if (mail === "") { var html = '<div class="alert alert-danger" role="alert">Votre email doit être renseigné !</div>'; $("#alert6").append(html); // On doit bloquer l'èvènement par défaut - ici l'envoi du formulaire avec l'instruction preventDefault(). Le paramètre 'event' est un objet (nommé librement) représentant l'évènement event.preventDefault(); } else if (mail_v.test(mail) == false) { var html = '<div class="alert alert-warning" role="alert">Format non valide !</div>'; $("#alert6").append(html); event.preventDefault(); } // PASSWORD if (mdp === "") { var html = '<div class="alert alert-danger" role="alert">Veuillez saisir votre mot de passe !</div>'; $("#alert7").append(html); event.preventDefault(); } else if (mdp_v.test(mdp) == false) { var html = '<div class="alert alert-warning" role="alert">Format non valide !</div>'; $("#alert7").append(html); event.preventDefault(); } // Si aucun test n'a renvoyé faux, c'est qu'il n'y a pas d'erreur, le script arrive ici, le formulaire est envoyé via submit() document.forms[0].submit(); }
[ "function", "verif", "(", ")", "{", "// Récupère la valeur saisie dans le champ input ", "var", "mail", "=", "$", "(", "\"#mail\"", ")", ".", "val", "(", ")", ";", "var", "mail_v", "=", "/", "^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,252}\\.[a-z]{2,4}$", "/", ";", "var", "mdp", "=", "$", "(", "\"#mdp\"", ")", ".", "val", "(", ")", ";", "var", "mdp_v", "=", "/", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\W).{8,}$", "/", ";", "// On teste si la valeur est bonne", "// EMAIL", "if", "(", "mail", "===", "\"\"", ")", "{", "var", "html", "=", "'<div class=\"alert alert-danger\" role=\"alert\">Votre email doit être renseigné !</div>';", "", "$", "(", "\"#alert6\"", ")", ".", "append", "(", "html", ")", ";", "// On doit bloquer l'èvènement par défaut - ici l'envoi du formulaire avec l'instruction preventDefault(). Le paramètre 'event' est un objet (nommé librement) représentant l'évènement ", "event", ".", "preventDefault", "(", ")", ";", "}", "else", "if", "(", "mail_v", ".", "test", "(", "mail", ")", "==", "false", ")", "{", "var", "html", "=", "'<div class=\"alert alert-warning\" role=\"alert\">Format non valide !</div>'", ";", "$", "(", "\"#alert6\"", ")", ".", "append", "(", "html", ")", ";", "event", ".", "preventDefault", "(", ")", ";", "}", "// PASSWORD", "if", "(", "mdp", "===", "\"\"", ")", "{", "var", "html", "=", "'<div class=\"alert alert-danger\" role=\"alert\">Veuillez saisir votre mot de passe !</div>'", ";", "$", "(", "\"#alert7\"", ")", ".", "append", "(", "html", ")", ";", "event", ".", "preventDefault", "(", ")", ";", "}", "else", "if", "(", "mdp_v", ".", "test", "(", "mdp", ")", "==", "false", ")", "{", "var", "html", "=", "'<div class=\"alert alert-warning\" role=\"alert\">Format non valide !</div>'", ";", "$", "(", "\"#alert7\"", ")", ".", "append", "(", "html", ")", ";", "event", ".", "preventDefault", "(", ")", ";", "}", "// Si aucun test n'a renvoyé faux, c'est qu'il n'y a pas d'erreur, le script arrive ici, le formulaire est envoyé via submit()", "document", ".", "forms", "[", "0", "]", ".", "submit", "(", ")", ";", "}" ]
[ 2, 0 ]
[ 46, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
verif2
()
null
Vérification du nouveau mot de passe
Vérification du nouveau mot de passe
function verif2() { // Récupère la valeur saisie dans le champ input var pass = $("#pass").val(); var pass_v = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).{8,}$/; // On teste si la valeur est bonne // MOT DE PASSE if(pass === "") { //On doit bloquer l'èvènement par défaut - ici l'envoi du formulaire avec l'instruction preventDefault(). Le paramètre 'event' est un objet (nommé librement) représentant l'évènement event.preventDefault(); var html = '<div class="alert alert-danger" role="alert">Votre nouveau mot de passe doit être renseigné !</div>'; $("#alertmdp").append(html); return false; } else if (pass_v.test(pass) === false) { event.preventDefault(); var html = '<div class="alert alert-warning" role="alert">Format non valide !</div>'; $("#alertmdp").append(html); return false; } // Si aucun test n'a renvoyé faux, c'est qu'il n'y a pas d'erreur, le script arrive ici, le formulaire est envoyé via submit() document.forms[0].submit(); }
[ "function", "verif2", "(", ")", "{", "// Récupère la valeur saisie dans le champ input", "var", "pass", "=", "$", "(", "\"#pass\"", ")", ".", "val", "(", ")", ";", "var", "pass_v", "=", "/", "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\W).{8,}$", "/", ";", "// On teste si la valeur est bonne", "// MOT DE PASSE", "if", "(", "pass", "===", "\"\"", ")", "{", "//On doit bloquer l'èvènement par défaut - ici l'envoi du formulaire avec l'instruction preventDefault(). Le paramètre 'event' est un objet (nommé librement) représentant l'évènement", "event", ".", "preventDefault", "(", ")", ";", "var", "html", "=", "'<div class=\"alert alert-danger\" role=\"alert\">Votre nouveau mot de passe doit être renseigné !</div>';", "", "$", "(", "\"#alertmdp\"", ")", ".", "append", "(", "html", ")", ";", "return", "false", ";", "}", "else", "if", "(", "pass_v", ".", "test", "(", "pass", ")", "===", "false", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "var", "html", "=", "'<div class=\"alert alert-warning\" role=\"alert\">Format non valide !</div>'", ";", "$", "(", "\"#alertmdp\"", ")", ".", "append", "(", "html", ")", ";", "return", "false", ";", "}", "// Si aucun test n'a renvoyé faux, c'est qu'il n'y a pas d'erreur, le script arrive ici, le formulaire est envoyé via submit()", "document", ".", "forms", "[", "0", "]", ".", "submit", "(", ")", ";", "}" ]
[ 39, 0 ]
[ 68, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
dix
(n)
null
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// traitement des nombres entre 0 et 99, pour chaque tranche de 3 chiffres;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// traitement des nombres entre 0 et 99, pour chaque tranche de 3 chiffres;
function dix(n){ if(n<10){ return t[parseInt(n)] } else if(n>9 && n<20){ return t2[n.charAt(1)] } else { plus= n.charAt(1)==0 && n.charAt(0)!=7 && n.charAt(0)!=9 ? "" : (n.charAt(1)==1 && n.charAt(0)<8) ? " et " : "-"; diz= n.charAt(0)==7 || n.charAt(0)==9 ? t2[n.charAt(1)] : t[n.charAt(1)]; s= n==80 ? "s" : ""; return t3[n.charAt(0)] + s + plus + diz; } }
[ "function", "dix", "(", "n", ")", "{", "if", "(", "n", "<", "10", ")", "{", "return", "t", "[", "parseInt", "(", "n", ")", "]", "}", "else", "if", "(", "n", ">", "9", "&&", "n", "<", "20", ")", "{", "return", "t2", "[", "n", ".", "charAt", "(", "1", ")", "]", "}", "else", "{", "plus", "=", "n", ".", "charAt", "(", "1", ")", "==", "0", "&&", "n", ".", "charAt", "(", "0", ")", "!=", "7", "&&", "n", ".", "charAt", "(", "0", ")", "!=", "9", "?", "\"\"", ":", "(", "n", ".", "charAt", "(", "1", ")", "==", "1", "&&", "n", ".", "charAt", "(", "0", ")", "<", "8", ")", "?", "\" et \"", ":", "\"-\"", ";", "diz", "=", "n", ".", "charAt", "(", "0", ")", "==", "7", "||", "n", ".", "charAt", "(", "0", ")", "==", "9", "?", "t2", "[", "n", ".", "charAt", "(", "1", ")", "]", ":", "t", "[", "n", ".", "charAt", "(", "1", ")", "]", ";", "s", "=", "n", "==", "80", "?", "\"s\"", ":", "\"\"", ";", "return", "t3", "[", "n", ".", "charAt", "(", "0", ")", "]", "+", "s", "+", "plus", "+", "diz", ";", "}", "}" ]
[ 44, 0 ]
[ 58, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
scroll
()
null
Affiche le bouton btnScroll si l'utilisateur défile la page d'au moins 20pixels vers le bas, le cache dans le cas contraire
Affiche le bouton btnScroll si l'utilisateur défile la page d'au moins 20pixels vers le bas, le cache dans le cas contraire
function scroll() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { btnScroll.style.display = "block"; } else { btnScroll.style.display = "none"; } }
[ "function", "scroll", "(", ")", "{", "if", "(", "document", ".", "body", ".", "scrollTop", ">", "20", "||", "document", ".", "documentElement", ".", "scrollTop", ">", "20", ")", "{", "btnScroll", ".", "style", ".", "display", "=", "\"block\"", ";", "}", "else", "{", "btnScroll", ".", "style", ".", "display", "=", "\"none\"", ";", "}", "}" ]
[ 1023, 0 ]
[ 1029, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
array_unique
( array )
null
}}} {{{ array_unique
}}} {{{ array_unique
function array_unique( array ) { // Removes duplicate values from an array // // + discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_array_unique/ // + version: 805.211 // + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com) // + input by: duncan // + bufixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: array_unique(['Kevin','Kevin','van','Zonneveld']); // * returns 1: ['Kevin','van','Zonneveld'] var p, i, j, tmp_arr = array; for(i = tmp_arr.length; i;){ for(p = --i; p > 0;){ if(tmp_arr[i] === tmp_arr[--p]){ for(j = p; --p && tmp_arr[i] === tmp_arr[p];); i -= tmp_arr.splice(p + 1, j - p).length; } } } return tmp_arr; }
[ "function", "array_unique", "(", "array", ")", "{", "// Removes duplicate values from an array", "// ", "// + discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_array_unique/", "// + version: 805.211", "// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)", "// + input by: duncan", "// + bufixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)", "// * example 1: array_unique(['Kevin','Kevin','van','Zonneveld']);", "// * returns 1: ['Kevin','van','Zonneveld']", "var", "p", ",", "i", ",", "j", ",", "tmp_arr", "=", "array", ";", "for", "(", "i", "=", "tmp_arr", ".", "length", ";", "i", ";", ")", "{", "for", "(", "p", "=", "--", "i", ";", "p", ">", "0", ";", ")", "{", "if", "(", "tmp_arr", "[", "i", "]", "===", "tmp_arr", "[", "--", "p", "]", ")", "{", "for", "(", "j", "=", "p", ";", "--", "p", "&&", "tmp_arr", "[", "i", "]", "===", "tmp_arr", "[", "p", "]", ";", ")", ";", "i", "-=", "tmp_arr", ".", "splice", "(", "p", "+", "1", ",", "j", "-", "p", ")", ".", "length", ";", "}", "}", "}", "return", "tmp_arr", ";", "}" ]
[ 625, 0 ]
[ 647, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
(pQueryString)
null
Retourne un objet contenant les key/value des paramètres d'une QueryString de la forme "?aa=bb&cc=dd"
Retourne un objet contenant les key/value des paramètres d'une QueryString de la forme "?aa=bb&cc=dd"
function (pQueryString) { var vMap = {}; pQueryString.replace(/[?&]+([^=&]+)=?([^&]*)/gi, function (pMatch, pKey, pValue) { var vKey = decodeURIComponent(pKey); var vValue = pValue ? decodeURIComponent(pValue) : true; vMap[vKey] ? vMap[vKey] instanceof Array ? vMap[vKey].push(vValue) : vMap[vKey] = [vMap[vKey], vValue] : vMap[vKey] = vValue; }); return vMap; }
[ "function", "(", "pQueryString", ")", "{", "var", "vMap", "=", "{", "}", ";", "pQueryString", ".", "replace", "(", "/", "[?&]+([^=&]+)=?([^&]*)", "/", "gi", ",", "function", "(", "pMatch", ",", "pKey", ",", "pValue", ")", "{", "var", "vKey", "=", "decodeURIComponent", "(", "pKey", ")", ";", "var", "vValue", "=", "pValue", "?", "decodeURIComponent", "(", "pValue", ")", ":", "true", ";", "vMap", "[", "vKey", "]", "?", "vMap", "[", "vKey", "]", "instanceof", "Array", "?", "vMap", "[", "vKey", "]", ".", "push", "(", "vValue", ")", ":", "vMap", "[", "vKey", "]", "=", "[", "vMap", "[", "vKey", "]", ",", "vValue", "]", ":", "vMap", "[", "vKey", "]", "=", "vValue", ";", "}", ")", ";", "return", "vMap", ";", "}" ]
[ 374, 19 ]
[ 382, 2 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
jump
(h, j, k)
null
/*Fonction de jump pour faire le scroll
/*Fonction de jump pour faire le scroll
function jump(h, j, k) { var top = document.querySelector(h).offsetTop, left = document.querySelector(h).offsetLeft; var animator = createAnimator({ start: [k, j], end: [left, top - 100], duration: 800 }, function (vals) { window.scrollTo(vals[0], vals[1]); }); //run animator(); }
[ "function", "jump", "(", "h", ",", "j", ",", "k", ")", "{", "var", "top", "=", "document", ".", "querySelector", "(", "h", ")", ".", "offsetTop", ",", "left", "=", "document", ".", "querySelector", "(", "h", ")", ".", "offsetLeft", ";", "var", "animator", "=", "createAnimator", "(", "{", "start", ":", "[", "k", ",", "j", "]", ",", "end", ":", "[", "left", ",", "top", "-", "100", "]", ",", "duration", ":", "800", "}", ",", "function", "(", "vals", ")", "{", "window", ".", "scrollTo", "(", "vals", "[", "0", "]", ",", "vals", "[", "1", "]", ")", ";", "}", ")", ";", "//run", "animator", "(", ")", ";", "}" ]
[ 2, 3 ]
[ 15, 4 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
Table
(table)
null
valeur en px du scroll avant laquelle le shadow s'active ou se desactive
valeur en px du scroll avant laquelle le shadow s'active ou se desactive
function Table (table) { this.init(table); }
[ "function", "Table", "(", "table", ")", "{", "this", ".", "init", "(", "table", ")", ";", "}" ]
[ 1479, 14 ]
[ 1481, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
scrollToTop
()
null
Remonte vers le haut de la page lorsque l'utilisateur clique sur le bouton btnScroll
Remonte vers le haut de la page lorsque l'utilisateur clique sur le bouton btnScroll
function scrollToTop() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; }
[ "function", "scrollToTop", "(", ")", "{", "document", ".", "body", ".", "scrollTop", "=", "0", ";", "document", ".", "documentElement", ".", "scrollTop", "=", "0", ";", "}" ]
[ 1032, 0 ]
[ 1035, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
getVillesG
()
null
fin des variables de map et de stat
fin des variables de map et de stat
function getVillesG() { return villesG; }
[ "function", "getVillesG", "(", ")", "{", "return", "villesG", ";", "}" ]
[ 1126, 21 ]
[ 1128, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
resetBtnLike
()
null
Réinitialise l'affichage du bouton Luke
Réinitialise l'affichage du bouton Luke
function resetBtnLike() { $("#iconLike").text(" Like Wine"); $("#likeButton").attr("class", "btn btn-danger"); }
[ "function", "resetBtnLike", "(", ")", "{", "$", "(", "\"#iconLike\"", ")", ".", "text", "(", "\" Like Wine\"", ")", ";", "$", "(", "\"#likeButton\"", ")", ".", "attr", "(", "\"class\"", ",", "\"btn btn-danger\"", ")", ";", "}" ]
[ 769, 0 ]
[ 772, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
scrollFunction
()
null
Retour haut de page /* POUR AFFICHER LE BOUTTON SUR VOS PAGES, INSERER A LA FIN DE VOTRE HTML LE BOUTTON SUIVANT: <button onclick="retourHaut()" id="haut" title="Retour haut de page">Haut de page</button>
Retour haut de page /* POUR AFFICHER LE BOUTTON SUR VOS PAGES, INSERER A LA FIN DE VOTRE HTML LE BOUTTON SUIVANT: <button onclick="retourHaut()" id="haut" title="Retour haut de page">Haut de page</button>
function scrollFunction() { if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) { document.getElementById('haut').style.display = 'block'; } else { document.getElementById('haut').style.display = 'none'; } }
[ "function", "scrollFunction", "(", ")", "{", "if", "(", "document", ".", "body", ".", "scrollTop", ">", "300", "||", "document", ".", "documentElement", ".", "scrollTop", ">", "300", ")", "{", "document", ".", "getElementById", "(", "'haut'", ")", ".", "style", ".", "display", "=", "'block'", ";", "}", "else", "{", "document", ".", "getElementById", "(", "'haut'", ")", ".", "style", ".", "display", "=", "'none'", ";", "}", "}" ]
[ 36, 0 ]
[ 43, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
setBoxSortable
()
null
Créer un conflit entre l'éditeur de texte et le plugin sortable
Créer un conflit entre l'éditeur de texte et le plugin sortable
function setBoxSortable() { console.log('sortable'); $("#dywee_cmsbundle_page_pageElements").sortable({ placeholder: "dywee-pageElement-placeholder", forcePlaceholderSize: true, handle: ".box-header", update: function ( event, ui ) { $.each($('.box'), function (index, box) { $(box).find('input[id$="_displayOrder"]').val(index + 1); }) } }); }
[ "function", "setBoxSortable", "(", ")", "{", "console", ".", "log", "(", "'sortable'", ")", ";", "$", "(", "\"#dywee_cmsbundle_page_pageElements\"", ")", ".", "sortable", "(", "{", "placeholder", ":", "\"dywee-pageElement-placeholder\"", ",", "forcePlaceholderSize", ":", "true", ",", "handle", ":", "\".box-header\"", ",", "update", ":", "function", "(", "event", ",", "ui", ")", "{", "$", ".", "each", "(", "$", "(", "'.box'", ")", ",", "function", "(", "index", ",", "box", ")", "{", "$", "(", "box", ")", ".", "find", "(", "'input[id$=\"_displayOrder\"]'", ")", ".", "val", "(", "index", "+", "1", ")", ";", "}", ")", "}", "}", ")", ";", "}" ]
[ 5, 4 ]
[ 18, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
()
null
Gère le changement de taille
Gère le changement de taille
function(){ //Manage window size this.width = window.innerWidth; //Manage timeline size this.el.style.height = this.height+"px;"; //Manage layout size this.layout.style.height = this.height+"px"; this.layout.style.width = 2*this.width+this.items.length*this.spaceBetween+"px"; }
[ "function", "(", ")", "{", "//Manage window size", "this", ".", "width", "=", "window", ".", "innerWidth", ";", "//Manage timeline size", "this", ".", "el", ".", "style", ".", "height", "=", "this", ".", "height", "+", "\"px;\"", ";", "//Manage layout size", "this", ".", "layout", ".", "style", ".", "height", "=", "this", ".", "height", "+", "\"px\"", ";", "this", ".", "layout", ".", "style", ".", "width", "=", "2", "*", "this", ".", "width", "+", "this", ".", "items", ".", "length", "*", "this", ".", "spaceBetween", "+", "\"px\"", ";", "}" ]
[ 281, 13 ]
[ 293, 2 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
Square
(height, width)
null
Constructeur avec définition des attributs
Constructeur avec définition des attributs
function Square(height, width) { this.height = height; this.width = width; }
[ "function", "Square", "(", "height", ",", "width", ")", "{", "this", ".", "height", "=", "height", ";", "this", ".", "width", "=", "width", ";", "}" ]
[ 1, 0 ]
[ 4, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
(path)
null
Force le rafraichissement du navigateur
Force le rafraichissement du navigateur
function (path) { console.log('* ' + path + ' changed') hotMiddleware.publish({action: 'reload'}) }
[ "function", "(", "path", ")", "{", "console", ".", "log", "(", "'* '", "+", "path", "+", "' changed'", ")", "hotMiddleware", ".", "publish", "(", "{", "action", ":", "'reload'", "}", ")", "}" ]
[ 10, 14 ]
[ 13, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
initCalendar
()
null
/* Affichage du calendirer sans donnée
/* Affichage du calendirer sans donnée
function initCalendar(){ var calendarEl = document.getElementById('calendar'); var calendar = new FullCalendar.Calendar(calendarEl, { plugins: [ 'dayGrid', 'timeGrid', 'list', 'bootstrap' ], locale: 'fr', height: "parent", buttonText: { today: 'Aujourd\'hui', month: 'Mois', week: 'Semaine', day: 'Jour', list: 'Liste' }, header: { left: 'prev,next today', center: 'title', right: 'timeGridWeek,listWeek' }, defaultView : 'timeGridWeek', nowIndicator: true, allDaySlot: false, minTime: "08:00:00", maxTime: "21:00:00", firstDay: 1, hiddenDays: [0], timeGridEventMinHeight: 15, textEscape: false, eventRender: function(info) { $(info.el).popover({ title: info.event.extendedProps.groupe, content: setEventDescription(info.event), html: true, trigger: 'hover', container: 'body', }); }, }); calendar.render(); return calendar; }
[ "function", "initCalendar", "(", ")", "{", "var", "calendarEl", "=", "document", ".", "getElementById", "(", "'calendar'", ")", ";", "var", "calendar", "=", "new", "FullCalendar", ".", "Calendar", "(", "calendarEl", ",", "{", "plugins", ":", "[", "'dayGrid'", ",", "'timeGrid'", ",", "'list'", ",", "'bootstrap'", "]", ",", "locale", ":", "'fr'", ",", "height", ":", "\"parent\"", ",", "buttonText", ":", "{", "today", ":", "'Aujourd\\'hui'", ",", "month", ":", "'Mois'", ",", "week", ":", "'Semaine'", ",", "day", ":", "'Jour'", ",", "list", ":", "'Liste'", "}", ",", "header", ":", "{", "left", ":", "'prev,next today'", ",", "center", ":", "'title'", ",", "right", ":", "'timeGridWeek,listWeek'", "}", ",", "defaultView", ":", "'timeGridWeek'", ",", "nowIndicator", ":", "true", ",", "allDaySlot", ":", "false", ",", "minTime", ":", "\"08:00:00\"", ",", "maxTime", ":", "\"21:00:00\"", ",", "firstDay", ":", "1", ",", "hiddenDays", ":", "[", "0", "]", ",", "timeGridEventMinHeight", ":", "15", ",", "textEscape", ":", "false", ",", "eventRender", ":", "function", "(", "info", ")", "{", "$", "(", "info", ".", "el", ")", ".", "popover", "(", "{", "title", ":", "info", ".", "event", ".", "extendedProps", ".", "groupe", ",", "content", ":", "setEventDescription", "(", "info", ".", "event", ")", ",", "html", ":", "true", ",", "trigger", ":", "'hover'", ",", "container", ":", "'body'", ",", "}", ")", ";", "}", ",", "}", ")", ";", "calendar", ".", "render", "(", ")", ";", "return", "calendar", ";", "}" ]
[ 11, 0 ]
[ 52, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
update
(userId, hobbie)
null
Mettre à jour un hobbie
Mettre à jour un hobbie
function update (userId, hobbie) { return axios.put(HOBBIES_API + "/" + userId , hobbie ).then( async response => { const cachedHobbies= await Cache.get("hobbies"); const cachedHobbie = await Cache.get("hobbies." + userId); if(cachedHobbie) { Cache.set("hobbie." + userId, response.data); } if (cachedHobbies) { const index= cachedHobbies.findIndex(c => c.userId === + userId); cachedHobbies[index] = response.data; } return response; }); }
[ "function", "update", "(", "userId", ",", "hobbie", ")", "{", "return", "axios", ".", "put", "(", "HOBBIES_API", "+", "\"/\"", "+", "userId", ",", "hobbie", ")", ".", "then", "(", "async", "response", "=>", "{", "const", "cachedHobbies", "=", "await", "Cache", ".", "get", "(", "\"hobbies\"", ")", ";", "const", "cachedHobbie", "=", "await", "Cache", ".", "get", "(", "\"hobbies.\"", "+", "userId", ")", ";", "if", "(", "cachedHobbie", ")", "{", "Cache", ".", "set", "(", "\"hobbie.\"", "+", "userId", ",", "response", ".", "data", ")", ";", "}", "if", "(", "cachedHobbies", ")", "{", "const", "index", "=", "cachedHobbies", ".", "findIndex", "(", "c", "=>", "c", ".", "userId", "===", "+", "userId", ")", ";", "cachedHobbies", "[", "index", "]", "=", "response", ".", "data", ";", "}", "return", "response", ";", "}", ")", ";", "}" ]
[ 60, 0 ]
[ 75, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
()
null
creation d'un cercle
creation d'un cercle
function () { var data = this.options.data; if (!data.x || !data.y || !data.radius) { throw new Error("One parameter is undefined !"); } var template = this.getTemplate("circle"); template = template.replace(/__X__/g, data.x); template = template.replace(/__Y__/g, data.y); template = template.replace(/__RADIUS__/g, data.radius); return template; }
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "options", ".", "data", ";", "if", "(", "!", "data", ".", "x", "||", "!", "data", ".", "y", "||", "!", "data", ".", "radius", ")", "{", "throw", "new", "Error", "(", "\"One parameter is undefined !\"", ")", ";", "}", "var", "template", "=", "this", ".", "getTemplate", "(", "\"circle\"", ")", ";", "template", "=", "template", ".", "replace", "(", "/", "__X__", "/", "g", ",", "data", ".", "x", ")", ";", "template", "=", "template", ".", "replace", "(", "/", "__Y__", "/", "g", ",", "data", ".", "y", ")", ";", "template", "=", "template", ".", "replace", "(", "/", "__RADIUS__", "/", "g", ",", "data", ".", "radius", ")", ";", "return", "template", ";", "}" ]
[ 168, 19 ]
[ 178, 9 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
pair
calculer
(operator, ...number)
null
- Objet arguments et utilisation de l'opérateur Rest -
- Objet arguments et utilisation de l'opérateur Rest -
function calculer(operator, ...number) { let result = 0 if (operator === '+') { for (let i = 0; i < number.length; i++) { result += number[i] } } return result }
[ "function", "calculer", "(", "operator", ",", "...", "number", ")", "{", "let", "result", "=", "0", "if", "(", "operator", "===", "'+'", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "number", ".", "length", ";", "i", "++", ")", "{", "result", "+=", "number", "[", "i", "]", "}", "}", "return", "result", "}" ]
[ 77, 0 ]
[ 85, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
setEventDescription
(event)
null
/* Description d'une séance pour son popover
/* Description d'une séance pour son popover
function setEventDescription(event){ return event.extendedProps.type_seance + '<br>' + event.extendedProps.enseignant + '<br>' + event.extendedProps.batiment + ' ' + event.extendedProps.salle + '<br><hr>' + event.extendedProps.capacite + ' places' + '<br>' + event.extendedProps.nb_postes + ' postes' + '<br>' + event.extendedProps.projecteur + ' projecteur'; }
[ "function", "setEventDescription", "(", "event", ")", "{", "return", "event", ".", "extendedProps", ".", "type_seance", "+", "'<br>'", "+", "event", ".", "extendedProps", ".", "enseignant", "+", "'<br>'", "+", "event", ".", "extendedProps", ".", "batiment", "+", "' '", "+", "event", ".", "extendedProps", ".", "salle", "+", "'<br><hr>'", "+", "event", ".", "extendedProps", ".", "capacite", "+", "' places'", "+", "'<br>'", "+", "event", ".", "extendedProps", ".", "nb_postes", "+", "' postes'", "+", "'<br>'", "+", "event", ".", "extendedProps", ".", "projecteur", "+", "' projecteur'", ";", "}" ]
[ 1, 0 ]
[ 8, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
()
null
Language defaults (en-US)
Language defaults (en-US)
function() { return { 'defaultButtons': { 'bold': { 'tip': 'Bold' }, 'italic': { 'tip': 'Italic' }, 'link': { 'tip': 'Insert Hyperlink' }, 'image': { 'tip': 'Insert Image' }, 'code': { 'tip': 'Code Sample' }, 'quote': { 'tip': 'Blockquote' }, 'numberlist': { 'tip': 'Numered List' }, 'bulletlist': { 'tip': 'Bullet List' }, 'line': { 'tip': 'Horizontal Line' }, 'heading': { 'tip': 'Heading' }, 'undo': { 'tip': 'Undo' }, 'redo': { 'tip': 'Redo' }, 'edit': { 'text': 'Compose', 'tip': 'View in Edit Mode' }, 'preview': { 'text': 'Preview', 'tip': 'View in Preview Mode' } }, 'dialog': { 'insertLink': { 'title': 'Insert Link', 'helpText': 'Enter the URL to be inserted.', 'insertButton': 'Insert', 'cancelButton': 'Cancel' }, 'insertImage': { 'title':'Insert Image', 'helpText': 'Enter the URL of the image to be inserted.', 'insertButton': 'Insert', 'cancelButton': 'Cancel' } }, 'errors' : { 'markeditNotTextarea':'MarkEdit tag must be a <textarea>', 'cannotLocateTextarea':'<textarea> tag could not be located in order to fetch the markeditGetState.' } }; }
[ "function", "(", ")", "{", "return", "{", "'defaultButtons'", ":", "{", "'bold'", ":", "{", "'tip'", ":", "'Bold'", "}", ",", "'italic'", ":", "{", "'tip'", ":", "'Italic'", "}", ",", "'link'", ":", "{", "'tip'", ":", "'Insert Hyperlink'", "}", ",", "'image'", ":", "{", "'tip'", ":", "'Insert Image'", "}", ",", "'code'", ":", "{", "'tip'", ":", "'Code Sample'", "}", ",", "'quote'", ":", "{", "'tip'", ":", "'Blockquote'", "}", ",", "'numberlist'", ":", "{", "'tip'", ":", "'Numered List'", "}", ",", "'bulletlist'", ":", "{", "'tip'", ":", "'Bullet List'", "}", ",", "'line'", ":", "{", "'tip'", ":", "'Horizontal Line'", "}", ",", "'heading'", ":", "{", "'tip'", ":", "'Heading'", "}", ",", "'undo'", ":", "{", "'tip'", ":", "'Undo'", "}", ",", "'redo'", ":", "{", "'tip'", ":", "'Redo'", "}", ",", "'edit'", ":", "{", "'text'", ":", "'Compose'", ",", "'tip'", ":", "'View in Edit Mode'", "}", ",", "'preview'", ":", "{", "'text'", ":", "'Preview'", ",", "'tip'", ":", "'View in Preview Mode'", "}", "}", ",", "'dialog'", ":", "{", "'insertLink'", ":", "{", "'title'", ":", "'Insert Link'", ",", "'helpText'", ":", "'Enter the URL to be inserted.'", ",", "'insertButton'", ":", "'Insert'", ",", "'cancelButton'", ":", "'Cancel'", "}", ",", "'insertImage'", ":", "{", "'title'", ":", "'Insert Image'", ",", "'helpText'", ":", "'Enter the URL of the image to be inserted.'", ",", "'insertButton'", ":", "'Insert'", ",", "'cancelButton'", ":", "'Cancel'", "}", "}", ",", "'errors'", ":", "{", "'markeditNotTextarea'", ":", "'MarkEdit tag must be a <textarea>'", ",", "'cannotLocateTextarea'", ":", "'<textarea> tag could not be located in order to fetch the markeditGetState.'", "}", "}", ";", "}" ]
[ 9, 35 ]
[ 82, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
variable_declarator
search_the_string
()
null
C'est ici qu'on lit contenu de rechercher en appuyant sur recherche pour traiter
C'est ici qu'on lit contenu de rechercher en appuyant sur recherche pour traiter
function search_the_string() { if(window.device=='mobile'){ if(window.page_open=='yes'){ window.hide_page(); //We hide the principal page } } $('.other_choice').fadeIn(); if($.trim($('.input_search').val())!=='' || $.trim($('.input_search_mobil').val())!=='') { var string_to_search = $.trim($('.input_search').val()) + $.trim($('.input_search_mobil').val()); var chaine = string_to_search.toLowerCase(); if(chaine.length <= 2 ){ window.notificate_it($('.notif_search').attr('short'),'error','bottomRight');//ON affiche le msg d'échec } else{ window.chaine = chaine; //On affiche certains menu cachés $('.install').fadeIn(); window.search_term = chaine; if(window.zim_tab){ go_search(chaine,window.zim_tab,false); }else{ window.zim_tab = 'wikipedia'; go_search(chaine,'wikipedia',false); $('.zim_click').removeClass('green'); $('.zim_click').removeClass('disabled'); $('.zim_wikipedia').addClass('green'); $('.zim_wikipedia').addClass('disabled'); } } } }
[ "function", "search_the_string", "(", ")", "{", "if", "(", "window", ".", "device", "==", "'mobile'", ")", "{", "if", "(", "window", ".", "page_open", "==", "'yes'", ")", "{", "window", ".", "hide_page", "(", ")", ";", "//We hide the principal page", "}", "}", "$", "(", "'.other_choice'", ")", ".", "fadeIn", "(", ")", ";", "if", "(", "$", ".", "trim", "(", "$", "(", "'.input_search'", ")", ".", "val", "(", ")", ")", "!==", "''", "||", "$", ".", "trim", "(", "$", "(", "'.input_search_mobil'", ")", ".", "val", "(", ")", ")", "!==", "''", ")", "{", "var", "string_to_search", "=", "$", ".", "trim", "(", "$", "(", "'.input_search'", ")", ".", "val", "(", ")", ")", "+", "$", ".", "trim", "(", "$", "(", "'.input_search_mobil'", ")", ".", "val", "(", ")", ")", ";", "var", "chaine", "=", "string_to_search", ".", "toLowerCase", "(", ")", ";", "if", "(", "chaine", ".", "length", "<=", "2", ")", "{", "window", ".", "notificate_it", "(", "$", "(", "'.notif_search'", ")", ".", "attr", "(", "'short'", ")", ",", "'error'", ",", "'bottomRight'", ")", ";", "//ON affiche le msg d'échec", "}", "else", "{", "window", ".", "chaine", "=", "chaine", ";", "//On affiche certains menu cachés", "$", "(", "'.install'", ")", ".", "fadeIn", "(", ")", ";", "window", ".", "search_term", "=", "chaine", ";", "if", "(", "window", ".", "zim_tab", ")", "{", "go_search", "(", "chaine", ",", "window", ".", "zim_tab", ",", "false", ")", ";", "}", "else", "{", "window", ".", "zim_tab", "=", "'wikipedia'", ";", "go_search", "(", "chaine", ",", "'wikipedia'", ",", "false", ")", ";", "$", "(", "'.zim_click'", ")", ".", "removeClass", "(", "'green'", ")", ";", "$", "(", "'.zim_click'", ")", ".", "removeClass", "(", "'disabled'", ")", ";", "$", "(", "'.zim_wikipedia'", ")", ".", "addClass", "(", "'green'", ")", ";", "$", "(", "'.zim_wikipedia'", ")", ".", "addClass", "(", "'disabled'", ")", ";", "}", "}", "}", "}" ]
[ 112, 2 ]
[ 157, 9 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
addElement
($container, type)
null
La fonction qui ajoute un formulaire Categorie
La fonction qui ajoute un formulaire Categorie
function addElement($container, type) { // Dans le contenu de l'attribut « data-prototype », on remplace : // - le texte "__name__label__" qu'il contient par le label du champ // - le texte "__name__" qu'il contient par le numéro du champ var $prototype = $($container.find('div#page_pageElements').attr('data-prototype').replace(/__name__label__/g, 'Catégorie n°' + (index + 1)) .replace(/__name__/g, index)); $prototype.find('.box-title').html('type: ' + type); // On ajoute au prototype un lien pour pouvoir supprimer la catégorie addDeleteLink($prototype); // On ajoute le prototype modifié à la fin de la balise <div> $container.append($prototype); processPrototype($prototype, type, index); // Enfin, on incrémente le compteur pour que le prochain ajout se fasse avec un autre numéro index++; setBoxSortable(); }
[ "function", "addElement", "(", "$container", ",", "type", ")", "{", "// Dans le contenu de l'attribut « data-prototype », on remplace :", "// - le texte \"__name__label__\" qu'il contient par le label du champ", "// - le texte \"__name__\" qu'il contient par le numéro du champ", "var", "$prototype", "=", "$", "(", "$container", ".", "find", "(", "'div#page_pageElements'", ")", ".", "attr", "(", "'data-prototype'", ")", ".", "replace", "(", "/", "__name__label__", "/", "g", ",", "'Catégorie n°' +", "(", "n", "dex +", "1", ")", "", "", ".", "replace", "(", "/", "__name__", "/", "g", ",", "index", ")", ")", ";", "$prototype", ".", "find", "(", "'.box-title'", ")", ".", "html", "(", "'type: '", "+", "type", ")", ";", "// On ajoute au prototype un lien pour pouvoir supprimer la catégorie", "addDeleteLink", "(", "$prototype", ")", ";", "// On ajoute le prototype modifié à la fin de la balise <div>", "$container", ".", "append", "(", "$prototype", ")", ";", "processPrototype", "(", "$prototype", ",", "type", ",", "index", ")", ";", "// Enfin, on incrémente le compteur pour que le prochain ajout se fasse avec un autre numéro", "index", "++", ";", "setBoxSortable", "(", ")", ";", "}" ]
[ 238, 4 ]
[ 261, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
escapeRegExp
(str)
null
on, remplace tous les selected par @{character name|attr}
on, remplace tous les selected par
function escapeRegExp(str) { return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string }
[ "function", "escapeRegExp", "(", "str", ")", "{", "return", "str", ".", "replace", "(", "/", "[.*+?^${}()|[\\]\\\\]", "/", "g", ",", "\"\\\\$&\"", ")", ";", "// $& means the whole matched string", "}" ]
[ 1154, 2 ]
[ 1156, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
startFramedDisplay
(playerId, action, perso, options)
null
Si options.chuchote est vrai, la frame est chuchotée au joueur qui fait l'action Si options.chuchote est un nom, on chuchote la frame à ce nom Pour retarder la décision sur la cible de chuchotement, utiliser options.retarder
Si options.chuchote est vrai, la frame est chuchotée au joueur qui fait l'action Si options.chuchote est un nom, on chuchote la frame à ce nom Pour retarder la décision sur la cible de chuchotement, utiliser options.retarder
function startFramedDisplay(playerId, action, perso, options) { options = options || {}; var display = { output: '', isOdd: true, isfirst: true, perso1: perso, perso2: options.perso2, action: action }; if (options.retarde === undefined) addFramedHeader(display, playerId, options.chuchote); return display; }
[ "function", "startFramedDisplay", "(", "playerId", ",", "action", ",", "perso", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "display", "=", "{", "output", ":", "''", ",", "isOdd", ":", "true", ",", "isfirst", ":", "true", ",", "perso1", ":", "perso", ",", "perso2", ":", "options", ".", "perso2", ",", "action", ":", "action", "}", ";", "if", "(", "options", ".", "retarde", "===", "undefined", ")", "addFramedHeader", "(", "display", ",", "playerId", ",", "options", ".", "chuchote", ")", ";", "return", "display", ";", "}" ]
[ 1058, 2 ]
[ 1071, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
bouton
(action, text, perso, ressource, overlay, style)
null
ressource est optionnel, et si présent doit être un attribut
ressource est optionnel, et si présent doit être un attribut
function bouton(action, text, perso, ressource, overlay, style) { if (action === undefined || action.trim().length === 0) return text; else action = action.trim(); //Expansion des macros et abilities action = replaceAction(action, perso); var tid = perso.token.id; perso.tokName = perso.tokName || perso.token.get('name'); if (perso.name === undefined) { var character = getObj('character', perso.charId); if (character) perso.name = character.get('name'); else perso.name = perso.tokName; } //Cas de plusieurs a
[ "function", "bouton", "(", "action", ",", "text", ",", "perso", ",", "ressource", ",", "overlay", ",", "style", ")", "{", "if", "(", "action", "===", "undefined", "||", "action", ".", "trim", "(", ")", ".", "length", "===", "0", ")", "return", "text", ";", "else", "action", "=", "action", ".", "trim", "(", ")", ";", "//Expansion des macros et abilities", "action", "=", "replaceAction", "(", "action", ",", "perso", ")", ";", "var", "tid", "=", "perso", ".", "token", ".", "id", ";", "perso", ".", "tokName", "=", "perso", ".", "tokName", "||", "perso", ".", "token", ".", "get", "(", "'name'", ")", ";", "if", "(", "perso", ".", "name", "===", "undefined", ")", "{", "var", "character", "=", "getObj", "(", "'character'", ",", "perso", ".", "charId", ")", ";", "if", "(", "character", ")", "perso", ".", "name", "=", "character", ".", "get", "(", "'name'", ")", ";", "else", "perso", ".", "name", "=", "perso", ".", "tokName", ";", "}", "//Cas de plusieurs a", "" ]
[ 1207, 2 ]
[ 1219, 24 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
generer
(s,$tab,obj)
null
génération d'une phrase
génération d'une phrase
function generer(s,$tab,obj){ // console.log("generer(%o)",obj); var $tr=$("<tr/>"); for (var i = 0; i < types.length; i++) { var v=obj[types[i]]; $tr.append(v?("<td>"+v+"</td>"):"<td/>"); } $tr.append("<td>"+s.clone().typ(obj)+"</td>"); $tab.append($tr); nb++; }
[ "function", "generer", "(", "s", ",", "$tab", ",", "obj", ")", "{", "// console.log(\"generer(%o)\",obj);", "var", "$tr", "=", "$", "(", "\"<tr/>\"", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "var", "v", "=", "obj", "[", "types", "[", "i", "]", "]", ";", "$tr", ".", "append", "(", "v", "?", "(", "\"<td>\"", "+", "v", "+", "\"</td>\"", ")", ":", "\"<td/>\"", ")", ";", "}", "$tr", ".", "append", "(", "\"<td>\"", "+", "s", ".", "clone", "(", ")", ".", "typ", "(", "obj", ")", "+", "\"</td>\"", ")", ";", "$tab", ".", "append", "(", "$tr", ")", ";", "nb", "++", ";", "}" ]
[ 19, 0 ]
[ 29, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
disableDOMElements
(labelElement, buttonElement)
null
Disables DOM elements
Disables DOM elements
function disableDOMElements(labelElement, buttonElement) { labelElement.removeClass(ACTIVE_TEXT).addClass(INACTIVE_TEXT); buttonElement.prop("disabled", true); buttonElement.removeClass(ENABLED).addClass(DISABLED); }
[ "function", "disableDOMElements", "(", "labelElement", ",", "buttonElement", ")", "{", "labelElement", ".", "removeClass", "(", "ACTIVE_TEXT", ")", ".", "addClass", "(", "INACTIVE_TEXT", ")", ";", "buttonElement", ".", "prop", "(", "\"disabled\"", ",", "true", ")", ";", "buttonElement", ".", "removeClass", "(", "ENABLED", ")", ".", "addClass", "(", "DISABLED", ")", ";", "}" ]
[ 509, 4 ]
[ 513, 5 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
statement_block
collapsibleContentInit
()
null
Usage $('#conteneur'); Retourne un élément de classe « maClasse » $('.maClasse'); Retourne un élément DIV de classe « maClasse » $('.maClasse', 'div'); Retourne tous les éléments P $('p'); /* Javascript function for collapsible content in modal
Usage $('#conteneur'); Retourne un élément de classe « maClasse » $('.maClasse'); Retourne un élément DIV de classe « maClasse » $('.maClasse', 'div'); Retourne tous les éléments P $('p'); /* Javascript function for collapsible content in modal
function collapsibleContentInit() { var coll = document.getElementsByClassName("collapsibleButton"); for (i = 0; i < coll.length; i++) { coll[i].addEventListener("click", function() { this.classList.toggle("active"); var content = this.nextElementSibling; if (content.style.maxHeight) { content.style.maxHeight = null; content.style.visibility = "hidden"; if (content.id == "boardCollapsibleContent") { document.getElementById("board_mini_picture_div").style.transform = "scale(1)"; document.getElementById("board_mini_picture_div").style.top = ""; } } else { content.style.maxHeight = content.scrollHeight + "px"; content.style.visibility = "visible"; if (content.id == "boardCollapsibleContent") { document.getElementById("board_mini_picture_div").style.transform = "scale(1.7)"; document.getElementById("board_mini_picture_div").style.top = "150px"; } } }); } }
[ "function", "collapsibleContentInit", "(", ")", "{", "var", "coll", "=", "document", ".", "getElementsByClassName", "(", "\"collapsibleButton\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "coll", ".", "length", ";", "i", "++", ")", "{", "coll", "[", "i", "]", ".", "addEventListener", "(", "\"click\"", ",", "function", "(", ")", "{", "this", ".", "classList", ".", "toggle", "(", "\"active\"", ")", ";", "var", "content", "=", "this", ".", "nextElementSibling", ";", "if", "(", "content", ".", "style", ".", "maxHeight", ")", "{", "content", ".", "style", ".", "maxHeight", "=", "null", ";", "content", ".", "style", ".", "visibility", "=", "\"hidden\"", ";", "if", "(", "content", ".", "id", "==", "\"boardCollapsibleContent\"", ")", "{", "document", ".", "getElementById", "(", "\"board_mini_picture_div\"", ")", ".", "style", ".", "transform", "=", "\"scale(1)\"", ";", "document", ".", "getElementById", "(", "\"board_mini_picture_div\"", ")", ".", "style", ".", "top", "=", "\"\"", ";", "}", "}", "else", "{", "content", ".", "style", ".", "maxHeight", "=", "content", ".", "scrollHeight", "+", "\"px\"", ";", "content", ".", "style", ".", "visibility", "=", "\"visible\"", ";", "if", "(", "content", ".", "id", "==", "\"boardCollapsibleContent\"", ")", "{", "document", ".", "getElementById", "(", "\"board_mini_picture_div\"", ")", ".", "style", ".", "transform", "=", "\"scale(1.7)\"", ";", "document", ".", "getElementById", "(", "\"board_mini_picture_div\"", ")", ".", "style", ".", "top", "=", "\"150px\"", ";", "}", "}", "}", ")", ";", "}", "}" ]
[ 153, 0 ]
[ 176, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
()
null
implémentation test
implémentation test
function() { botui.message .bot({ loading: true, delay: 1000, photo: 'build/rasht.png', type:'html', icon:'smile', content:'<b>Recherchez vous ceci?<b> ' }) .then(function () { return botui.action.button({ delay: 1000, action: [{ text: 'Tout sur le test', icon:'server', value: 'testt' }, { text: 'Les matières du test', icon:'book', value: 'matières_test' }, { text: 'Les dossiers du test ', icon:'folder', value: 'dossiers_test' },{ text: 'Les dates du test', icon:'calendar', value: 'date_test' },{ text: 'Retour', icon: 'angle-left', value: 'skip' }] }) }).then(function (res) { if(res.value == 'matières_test') { matières_test(); } else if(res.value == 'dossiers_test') { dossiers_test(); }else if(res.value == 'date_test') { date_test(); } else if(res.value == 'testt') { test(); } else { // retour sup1(); } }); }
[ "function", "(", ")", "{", "botui", ".", "message", ".", "bot", "(", "{", "loading", ":", "true", ",", "delay", ":", "1000", ",", "photo", ":", "'build/rasht.png'", ",", "type", ":", "'html'", ",", "icon", ":", "'smile'", ",", "content", ":", "'<b>Recherchez vous ceci?<b> '", "}", ")", ".", "then", "(", "function", "(", ")", "{", "return", "botui", ".", "action", ".", "button", "(", "{", "delay", ":", "1000", ",", "action", ":", "[", "{", "text", ":", "'Tout sur le test'", ",", "icon", ":", "'server'", ",", "value", ":", "'testt'", "}", ",", "{", "text", ":", "'Les matières du test',", "", "icon", ":", "'book'", ",", "value", ":", "'matières_test'", "}", ",", "{", "text", ":", "'Les dossiers du test '", ",", "icon", ":", "'folder'", ",", "value", ":", "'dossiers_test'", "}", ",", "{", "text", ":", "'Les dates du test'", ",", "icon", ":", "'calendar'", ",", "value", ":", "'date_test'", "}", ",", "{", "text", ":", "'Retour'", ",", "icon", ":", "'angle-left'", ",", "value", ":", "'skip'", "}", "]", "}", ")", "}", ")", ".", "then", "(", "function", "(", "res", ")", "{", "if", "(", "res", ".", "value", "==", "'matières_test')", " ", "", "matières_test(", ")", ";", "", "}", "else", "if", "(", "res", ".", "value", "==", "'dossiers_test'", ")", "{", "dossiers_test", "(", ")", ";", "}", "else", "if", "(", "res", ".", "value", "==", "'date_test'", ")", "{", "date_test", "(", ")", ";", "}", "else", "if", "(", "res", ".", "value", "==", "'testt'", ")", "{", "test", "(", ")", ";", "}", "else", "{", "// retour", "sup1", "(", ")", ";", "}", "}", ")", ";", "}" ]
[ 1, 18 ]
[ 53, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
False
true
variable_declarator
UDVS
(options)
null
Unique devices Service
Unique devices Service
function UDVS(options) { this.options = options; }
[ "function", "UDVS", "(", "options", ")", "{", "this", ".", "options", "=", "options", ";", "}" ]
[ 17, 0 ]
[ 19, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
greetings
()
null
Déclaration de la fonction
Déclaration de la fonction
function greetings() { console.log("Un texte très long"); }
[ "function", "greetings", "(", ")", "{", "console", ".", "log", "(", "\"Un texte très long\")", ";", "", "}" ]
[ 3, 0 ]
[ 5, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
addFramedHeader
(display, playerId, chuchote)
null
Fonction séparée pour pouvoir envoyer un frame à plusieurs joueurs
Fonction séparée pour pouvoir envoyer un frame à plusieurs joueurs
function addFramedHeader(display, playerId, chuchote) { var perso1 = display.perso1; var perso2 = display.perso2; var action = display.action; var playerBGColor = '#333'; var playerTXColor = '#FFF'; var displayname; var player = getObj('player', playerId); if (player !== undefined) { playerBGColor = player.get("color"); playerTXColor = (getBrightness(playerBGColor) < 50) ? "#FFF" : "#000"; displayname = player.get('displayname'); } var res = '/direct '; if (chuchote) { var who; if (chuchote !== true) who = chuchote; else who = displayname; if (who) res = '/w "' + who + '" '; else chuchote = false; } var name1, name2 = ''; var avatar1, avatar2; if (perso2) { var img2 = improve_image(perso2.token.get('imgsrc')); if (AVATAR_IN_DISPLAY) { var character2 = getObj('character', perso2.charId); if (character2) img2 = improve_image(character2.get('avatar')) || img2; } if (img2) { avatar2 = '<img src="' + img2 + '" style="width: 50%; display: block; max-width: 100%; height: auto; border-radius: 6px; margin: 0 auto;">'; name2 = perso2.tokName; if (name2 === undefined) name2 = perso2.token.get('name'); name2 = '<b>' + name2 + '</b>'; } } if (perso1) { var img1 = improve_image(perso1.token.get('imgsrc')); if (AVATAR_IN_DISPLAY) { var character1 = getObj('character', perso1.charId); if (character1) img1 = improve_image(character1.get('avatar')) || img1; } if (img1) { avatar1 = '<img src="' + img1 + '" style="width: ' + (avatar2 ? 50 : 100) + '%; display: block; max-width: 100%; height: auto; border-radius: 6px; margin: 0 auto;">'; if (perso1.tokName) name1 = perso1.tokName; else name1 = perso1.token.get('name'); name1 = '<b>' + name1 + '</b>'; } } res += '<div class="all_content" style="-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); border: 1px solid #000; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; overflow: hidden; position: relative;">'; if (avatar1) { res += '<div class="line_header" style="overflow:auto; text-align: center; vertical-align: middle; padding: 5px 5px; border-bottom: 1px solid #000; color: ' + playerTXColor + '; background-color: ' + playerBGColor + ';" title=""> ' + '<table>'; if (avatar2) { res += '<tr style="text-align: center">' + '<td style="width: 44%; vertical-align: middle;">' + name1 + '</td>' + '<td style="width: 12%;height: 28px;line-height: 30px;border: 2px solid #900;border-radius: 100%;position: absolute;margin-top: 25px;font-weight: bold;background-color: #EEE;color: #900;">' + 'VS' + '</td>' + '<td style="width: 44%; vertical-align: middle;">' + name2 + '</td>' + '</tr>' + '<tr style="text-align: center">' + '<td style="width: 42%; vertical-align: middle;">' + avatar1 + '</td>' + '<td style="width: 16%; vertical-align: middle;">&nbsp;</td>' + '<td style="width: 42%; vertical-align: middle;">' + avatar2 + '</td>' + '</tr>'; } else { var bar1_info = '', bar2_info = '', bar3_info = ''; if (chuchote) { // on chuchote donc on peut afficher les informations concernant les barres du Token if (perso1.token.get('bar1_link').length > 0) { var bar1 = findObjs({ _type: 'attribute', _id: perso1.token.get('bar1_link') }); if (bar1[0] !== undefined) bar1_info = '<b>' + bar1[0].get('name') + '</b> : ' + bar1[0].get('current') + ' / ' + bar1[0].get('max') + ''; } if (perso1.token.get('bar2_link').length > 0) { var bar2 = findObjs({ _type: 'attribute', _id: perso1.token.get('bar2_link') }); if (bar2[0] !== undefined) bar2_info = '<b>' + bar2[0].get('name') + '</b> : ' + bar2[0].get('current') + ' / ' + bar2[0].get('max') + ''; } if (perso1.token.get('bar3_link').length > 0) { var bar3 = findObjs({ _type: 'attribute', _id: perso1.token.get('bar3_link') }); if (bar3[0] !== undefined) bar3_info = '<b>' + bar3[0].get('name') + '</b> : ' + bar3[0].get('current') + ' / ' + bar3[0].get('max') + ''; } } res += '<tr style="text-align: left">' + '<td style="width:25%; vertical-align: middle;">' + avatar1 + '</td>' + '<td style="width:75%; vertical-align: middle; position: relative;">' + '<div>' + name1 + '</div>' + '<div style="position: absolute;top: -6px;right: -5px;border: 1px solid #000;background-color: #333;">' + '<div style="text-align: right; margin: 0 5px; color: #7cc489">' + bar1_info + '</div>' + '<div style="text-align: right; margin: 0 5px; color: #7c9bc4">' + bar2_info + '</div>' + '<div style="text-align: right; margin: 0 5px; color: #b21d1d">' + bar3_info + '</div>' + '</div>' + '</td>' + '</tr>'; } res += '</table>' + '</div>'; // line_header } res += '<div class="line_title" style="font-size: 85%; text-align: left; vertical-align: middle; padding: 5px 5px; border-bottom: 1px solid #000; color: #a94442; background-color: #f2dede;" title=""> ' + action + '</div>'; // line_title res += '<div class="line_content">'; display.header = res; }
[ "function", "addFramedHeader", "(", "display", ",", "playerId", ",", "chuchote", ")", "{", "var", "perso1", "=", "display", ".", "perso1", ";", "var", "perso2", "=", "display", ".", "perso2", ";", "var", "action", "=", "display", ".", "action", ";", "var", "playerBGColor", "=", "'#333'", ";", "var", "playerTXColor", "=", "'#FFF'", ";", "var", "displayname", ";", "var", "player", "=", "getObj", "(", "'player'", ",", "playerId", ")", ";", "if", "(", "player", "!==", "undefined", ")", "{", "playerBGColor", "=", "player", ".", "get", "(", "\"color\"", ")", ";", "playerTXColor", "=", "(", "getBrightness", "(", "playerBGColor", ")", "<", "50", ")", "?", "\"#FFF\"", ":", "\"#000\"", ";", "displayname", "=", "player", ".", "get", "(", "'displayname'", ")", ";", "}", "var", "res", "=", "'/direct '", ";", "if", "(", "chuchote", ")", "{", "var", "who", ";", "if", "(", "chuchote", "!==", "true", ")", "who", "=", "chuchote", ";", "else", "who", "=", "displayname", ";", "if", "(", "who", ")", "res", "=", "'/w \"'", "+", "who", "+", "'\" '", ";", "else", "chuchote", "=", "false", ";", "}", "var", "name1", ",", "name2", "=", "''", ";", "var", "avatar1", ",", "avatar2", ";", "if", "(", "perso2", ")", "{", "var", "img2", "=", "improve_image", "(", "perso2", ".", "token", ".", "get", "(", "'imgsrc'", ")", ")", ";", "if", "(", "AVATAR_IN_DISPLAY", ")", "{", "var", "character2", "=", "getObj", "(", "'character'", ",", "perso2", ".", "charId", ")", ";", "if", "(", "character2", ")", "img2", "=", "improve_image", "(", "character2", ".", "get", "(", "'avatar'", ")", ")", "||", "img2", ";", "}", "if", "(", "img2", ")", "{", "avatar2", "=", "'<img src=\"'", "+", "img2", "+", "'\" style=\"width: 50%; display: block; max-width: 100%; height: auto; border-radius: 6px; margin: 0 auto;\">'", ";", "name2", "=", "perso2", ".", "tokName", ";", "if", "(", "name2", "===", "undefined", ")", "name2", "=", "perso2", ".", "token", ".", "get", "(", "'name'", ")", ";", "name2", "=", "'<b>'", "+", "name2", "+", "'</b>'", ";", "}", "}", "if", "(", "perso1", ")", "{", "var", "img1", "=", "improve_image", "(", "perso1", ".", "token", ".", "get", "(", "'imgsrc'", ")", ")", ";", "if", "(", "AVATAR_IN_DISPLAY", ")", "{", "var", "character1", "=", "getObj", "(", "'character'", ",", "perso1", ".", "charId", ")", ";", "if", "(", "character1", ")", "img1", "=", "improve_image", "(", "character1", ".", "get", "(", "'avatar'", ")", ")", "||", "img1", ";", "}", "if", "(", "img1", ")", "{", "avatar1", "=", "'<img src=\"'", "+", "img1", "+", "'\" style=\"width: '", "+", "(", "avatar2", "?", "50", ":", "100", ")", "+", "'%; display: block; max-width: 100%; height: auto; border-radius: 6px; margin: 0 auto;\">'", ";", "if", "(", "perso1", ".", "tokName", ")", "name1", "=", "perso1", ".", "tokName", ";", "else", "name1", "=", "perso1", ".", "token", ".", "get", "(", "'name'", ")", ";", "name1", "=", "'<b>'", "+", "name1", "+", "'</b>'", ";", "}", "}", "res", "+=", "'<div class=\"all_content\" style=\"-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.75); border: 1px solid #000; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; overflow: hidden; position: relative;\">'", ";", "if", "(", "avatar1", ")", "{", "res", "+=", "'<div class=\"line_header\" style=\"overflow:auto; text-align: center; vertical-align: middle; padding: 5px 5px; border-bottom: 1px solid #000; color: '", "+", "playerTXColor", "+", "'; background-color: '", "+", "playerBGColor", "+", "';\" title=\"\"> '", "+", "'<table>'", ";", "if", "(", "avatar2", ")", "{", "res", "+=", "'<tr style=\"text-align: center\">'", "+", "'<td style=\"width: 44%; vertical-align: middle;\">'", "+", "name1", "+", "'</td>'", "+", "'<td style=\"width: 12%;height: 28px;line-height: 30px;border: 2px solid #900;border-radius: 100%;position: absolute;margin-top: 25px;font-weight: bold;background-color: #EEE;color: #900;\">'", "+", "'VS'", "+", "'</td>'", "+", "'<td style=\"width: 44%; vertical-align: middle;\">'", "+", "name2", "+", "'</td>'", "+", "'</tr>'", "+", "'<tr style=\"text-align: center\">'", "+", "'<td style=\"width: 42%; vertical-align: middle;\">'", "+", "avatar1", "+", "'</td>'", "+", "'<td style=\"width: 16%; vertical-align: middle;\">&nbsp;</td>'", "+", "'<td style=\"width: 42%; vertical-align: middle;\">'", "+", "avatar2", "+", "'</td>'", "+", "'</tr>'", ";", "}", "else", "{", "var", "bar1_info", "=", "''", ",", "bar2_info", "=", "''", ",", "bar3_info", "=", "''", ";", "if", "(", "chuchote", ")", "{", "// on chuchote donc on peut afficher les informations concernant les barres du Token", "if", "(", "perso1", ".", "token", ".", "get", "(", "'bar1_link'", ")", ".", "length", ">", "0", ")", "{", "var", "bar1", "=", "findObjs", "(", "{", "_type", ":", "'attribute'", ",", "_id", ":", "perso1", ".", "token", ".", "get", "(", "'bar1_link'", ")", "}", ")", ";", "if", "(", "bar1", "[", "0", "]", "!==", "undefined", ")", "bar1_info", "=", "'<b>'", "+", "bar1", "[", "0", "]", ".", "get", "(", "'name'", ")", "+", "'</b> : '", "+", "bar1", "[", "0", "]", ".", "get", "(", "'current'", ")", "+", "' / '", "+", "bar1", "[", "0", "]", ".", "get", "(", "'max'", ")", "+", "''", ";", "}", "if", "(", "perso1", ".", "token", ".", "get", "(", "'bar2_link'", ")", ".", "length", ">", "0", ")", "{", "var", "bar2", "=", "findObjs", "(", "{", "_type", ":", "'attribute'", ",", "_id", ":", "perso1", ".", "token", ".", "get", "(", "'bar2_link'", ")", "}", ")", ";", "if", "(", "bar2", "[", "0", "]", "!==", "undefined", ")", "bar2_info", "=", "'<b>'", "+", "bar2", "[", "0", "]", ".", "get", "(", "'name'", ")", "+", "'</b> : '", "+", "bar2", "[", "0", "]", ".", "get", "(", "'current'", ")", "+", "' / '", "+", "bar2", "[", "0", "]", ".", "get", "(", "'max'", ")", "+", "''", ";", "}", "if", "(", "perso1", ".", "token", ".", "get", "(", "'bar3_link'", ")", ".", "length", ">", "0", ")", "{", "var", "bar3", "=", "findObjs", "(", "{", "_type", ":", "'attribute'", ",", "_id", ":", "perso1", ".", "token", ".", "get", "(", "'bar3_link'", ")", "}", ")", ";", "if", "(", "bar3", "[", "0", "]", "!==", "undefined", ")", "bar3_info", "=", "'<b>'", "+", "bar3", "[", "0", "]", ".", "get", "(", "'name'", ")", "+", "'</b> : '", "+", "bar3", "[", "0", "]", ".", "get", "(", "'current'", ")", "+", "' / '", "+", "bar3", "[", "0", "]", ".", "get", "(", "'max'", ")", "+", "''", ";", "}", "}", "res", "+=", "'<tr style=\"text-align: left\">'", "+", "'<td style=\"width:25%; vertical-align: middle;\">'", "+", "avatar1", "+", "'</td>'", "+", "'<td style=\"width:75%; vertical-align: middle; position: relative;\">'", "+", "'<div>'", "+", "name1", "+", "'</div>'", "+", "'<div style=\"position: absolute;top: -6px;right: -5px;border: 1px solid #000;background-color: #333;\">'", "+", "'<div style=\"text-align: right; margin: 0 5px; color: #7cc489\">'", "+", "bar1_info", "+", "'</div>'", "+", "'<div style=\"text-align: right; margin: 0 5px; color: #7c9bc4\">'", "+", "bar2_info", "+", "'</div>'", "+", "'<div style=\"text-align: right; margin: 0 5px; color: #b21d1d\">'", "+", "bar3_info", "+", "'</div>'", "+", "'</div>'", "+", "'</td>'", "+", "'</tr>'", ";", "}", "res", "+=", "'</table>'", "+", "'</div>'", ";", "// line_header", "}", "res", "+=", "'<div class=\"line_title\" style=\"font-size: 85%; text-align: left; vertical-align: middle; padding: 5px 5px; border-bottom: 1px solid #000; color: #a94442; background-color: #f2dede;\" title=\"\"> '", "+", "action", "+", "'</div>'", ";", "// line_title", "res", "+=", "'<div class=\"line_content\">'", ";", "display", ".", "header", "=", "res", ";", "}" ]
[ 934, 2 ]
[ 1053, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
ERROR
updateXY
(cnst,y)
null
reçoit x,y retourne le x de son dernier enfant remet son x au milieu de ses enfants
reçoit x,y retourne le x de son dernier enfant remet son x au milieu de ses enfants
function updateXY(cnst,y){ // console.log("setXY("+this.label+":"+x+","+y+")"); let children=cnst.children; cnst.y=y+deltaConstTree; if (!children[0].children){ // this is a terminal,so align with the middle of the word cnst.x=children[0].mid; } else { children.forEach(c=>updateXY(c,cnst.y)) // align in the middle of its children let last=children.length-1; cnst.x=(children[0].x+children[last].x)/2; } }
[ "function", "updateXY", "(", "cnst", ",", "y", ")", "{", "// console.log(\"setXY(\"+this.label+\":\"+x+\",\"+y+\")\");", "let", "children", "=", "cnst", ".", "children", ";", "cnst", ".", "y", "=", "y", "+", "deltaConstTree", ";", "if", "(", "!", "children", "[", "0", "]", ".", "children", ")", "{", "// this is a terminal,so align with the middle of the word", "cnst", ".", "x", "=", "children", "[", "0", "]", ".", "mid", ";", "}", "else", "{", "children", ".", "forEach", "(", "c", "=>", "updateXY", "(", "c", ",", "cnst", ".", "y", ")", ")", "// align in the middle of its children", "let", "last", "=", "children", ".", "length", "-", "1", ";", "cnst", ".", "x", "=", "(", "children", "[", "0", "]", ".", "x", "+", "children", "[", "last", "]", ".", "x", ")", "/", "2", ";", "}", "}" ]
[ 34, 0 ]
[ 47, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
download
()
null
Téléchargement
Téléchargement
function download() { //Récupération des headers utiles let headers = header.global.slice() for (let i in recorded) { if (recorded[i]) headers = headers.concat(header[i]) } headers = headers.join(",") //Enregistrement du ficheir const data = record.data.map(d => d.join(",")).join("\r\n") const date = new Date() const file = new File([[headers, data].join("\r\n")], `${document.querySelector("[name=metadata]").value.replace(/;/g, "_")}-${(date.getDate()).toString().padStart(2, "0")}-${(1+date.getMonth()).toString().padStart(2, "0")}-${date.getFullYear()}_${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}.csv`, {type: "text/csv"}) saveAs(file, file.name) }
[ "function", "download", "(", ")", "{", "//Récupération des headers utiles", "let", "headers", "=", "header", ".", "global", ".", "slice", "(", ")", "for", "(", "let", "i", "in", "recorded", ")", "{", "if", "(", "recorded", "[", "i", "]", ")", "headers", "=", "headers", ".", "concat", "(", "header", "[", "i", "]", ")", "}", "headers", "=", "headers", ".", "join", "(", "\",\"", ")", "//Enregistrement du ficheir", "const", "data", "=", "record", ".", "data", ".", "map", "(", "d", "=>", "d", ".", "join", "(", "\",\"", ")", ")", ".", "join", "(", "\"\\r\\n\"", ")", "const", "date", "=", "new", "Date", "(", ")", "const", "file", "=", "new", "File", "(", "[", "[", "headers", ",", "data", "]", ".", "join", "(", "\"\\r\\n\"", ")", "]", ",", "`", "${", "document", ".", "querySelector", "(", "\"[name=metadata]\"", ")", ".", "value", ".", "replace", "(", "/", ";", "/", "g", ",", "\"_\"", ")", "}", "${", "(", "date", ".", "getDate", "(", ")", ")", ".", "toString", "(", ")", ".", "padStart", "(", "2", ",", "\"0\"", ")", "}", "${", "(", "1", "+", "date", ".", "getMonth", "(", ")", ")", ".", "toString", "(", ")", ".", "padStart", "(", "2", ",", "\"0\"", ")", "}", "${", "date", ".", "getFullYear", "(", ")", "}", "${", "date", ".", "getHours", "(", ")", "}", "${", "date", ".", "getMinutes", "(", ")", "}", "${", "date", ".", "getSeconds", "(", ")", "}", "`", ",", "{", "type", ":", "\"text/csv\"", "}", ")", "saveAs", "(", "file", ",", "file", ".", "name", ")", "}" ]
[ 149, 2 ]
[ 162, 3 ]
null
javascript
fr
['fr', 'fr', 'fr']
False
true
program
setupTestHelpers
()
null
/*global atob, unescape, Uint8Array, Blob
/*global atob, unescape, Uint8Array, Blob
function setupTestHelpers() { jasmine.clock().install(); this.elements = []; this.editors = []; this.createElement = function (tag, className, html, dontAppend) { var el = document.createElement(tag); el.innerHTML = html || ''; if (className) { el.className = className; } this.elements.push(el); if (!dontAppend) { document.body.appendChild(el); } return el; }; this.newMediumEditor = function (selector, options) { var editor = new MediumEditor(selector, options); this.editors.push(editor); return editor; }; this.cleanupTest = function () { this.editors.forEach(function (editor) { editor.destroy(); }); this.elements.forEach(function (element) { if (element.parentNode) { element.parentNode.removeChild(element); } }); jasmine.clock().uninstall(); delete this.createElement; delete this.createMedium; delete this.elements; delete this.editors; delete this.cleanupTest; } }
[ "function", "setupTestHelpers", "(", ")", "{", "jasmine", ".", "clock", "(", ")", ".", "install", "(", ")", ";", "this", ".", "elements", "=", "[", "]", ";", "this", ".", "editors", "=", "[", "]", ";", "this", ".", "createElement", "=", "function", "(", "tag", ",", "className", ",", "html", ",", "dontAppend", ")", "{", "var", "el", "=", "document", ".", "createElement", "(", "tag", ")", ";", "el", ".", "innerHTML", "=", "html", "||", "''", ";", "if", "(", "className", ")", "{", "el", ".", "className", "=", "className", ";", "}", "this", ".", "elements", ".", "push", "(", "el", ")", ";", "if", "(", "!", "dontAppend", ")", "{", "document", ".", "body", ".", "appendChild", "(", "el", ")", ";", "}", "return", "el", ";", "}", ";", "this", ".", "newMediumEditor", "=", "function", "(", "selector", ",", "options", ")", "{", "var", "editor", "=", "new", "MediumEditor", "(", "selector", ",", "options", ")", ";", "this", ".", "editors", ".", "push", "(", "editor", ")", ";", "return", "editor", ";", "}", ";", "this", ".", "cleanupTest", "=", "function", "(", ")", "{", "this", ".", "editors", ".", "forEach", "(", "function", "(", "editor", ")", "{", "editor", ".", "destroy", "(", ")", ";", "}", ")", ";", "this", ".", "elements", ".", "forEach", "(", "function", "(", "element", ")", "{", "if", "(", "element", ".", "parentNode", ")", "{", "element", ".", "parentNode", ".", "removeChild", "(", "element", ")", ";", "}", "}", ")", ";", "jasmine", ".", "clock", "(", ")", ".", "uninstall", "(", ")", ";", "delete", "this", ".", "createElement", ";", "delete", "this", ".", "createMedium", ";", "delete", "this", ".", "elements", ";", "delete", "this", ".", "editors", ";", "delete", "this", ".", "cleanupTest", ";", "}", "}" ]
[ 2, 0 ]
[ 44, 1 ]
null
javascript
fr
['fr', 'fr', 'fr']
True
true
program
run
(fun)
null
executando a função do objeto Passar função como parametro para executar ela
executando a função do objeto Passar função como parametro para executar ela
function run(fun) { fun(); }
[ "function", "run", "(", "fun", ")", "{", "fun", "(", ")", ";", "}" ]
[ 27, 0 ]
[ 29, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
dividir
(num, por = 2)
null
/*Função com mais um parâmetro por = 2 -> quando não definirmos nenhum valor
/*Função com mais um parâmetro por = 2 -> quando não definirmos nenhum valor
function dividir(num, por = 2){ return num / por; }
[ "function", "dividir", "(", "num", ",", "por", "=", "2", ")", "{", "return", "num", "/", "por", ";", "}" ]
[ 167, 0 ]
[ 169, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
iniciarjogo
()
null
Variavel que armazena a chamada da função setTimeout
Variavel que armazena a chamada da função setTimeout
function iniciarjogo(){ var url = window.location.search; var nivel_jogo = url.replace("?", ""); var tempo_segundos = 0; if(nivel_jogo ==1) { // 1 fácil - 120 segundos tempo_segundos = 120; } if(nivel_jogo ==2) { // 2 normal - 60 segundos tempo_segundos = 60; } if(nivel_jogo ==3) { // 3 difícil - 30 segundos tempo_segundos = 30; } //Inserir os segundos no cronômetro document.getElementById('cronometro').innerHTML = tempo_segundos; //Quantidade de Patos var qtde_patos = 40; criar_patos(qtde_patos); //Contatos de patos vivos document.getElementById('patos_vivos').innerHTML = qtde_patos; //Contatos de patos mortos document.getElementById('patos_mortos').innerHTML = 0; contagem_tempo(tempo_segundos +1); }
[ "function", "iniciarjogo", "(", ")", "{", "var", "url", "=", "window", ".", "location", ".", "search", ";", "var", "nivel_jogo", "=", "url", ".", "replace", "(", "\"?\"", ",", "\"\"", ")", ";", "var", "tempo_segundos", "=", "0", ";", "if", "(", "nivel_jogo", "==", "1", ")", "{", "// 1 fácil - 120 segundos", "tempo_segundos", "=", "120", ";", "}", "if", "(", "nivel_jogo", "==", "2", ")", "{", "// 2 normal - 60 segundos", "tempo_segundos", "=", "60", ";", "}", "if", "(", "nivel_jogo", "==", "3", ")", "{", "// 3 difícil - 30 segundos", "tempo_segundos", "=", "30", ";", "}", "//Inserir os segundos no cronômetro", "document", ".", "getElementById", "(", "'cronometro'", ")", ".", "innerHTML", "=", "tempo_segundos", ";", "//Quantidade de Patos", "var", "qtde_patos", "=", "40", ";", "criar_patos", "(", "qtde_patos", ")", ";", "//Contatos de patos vivos", "document", ".", "getElementById", "(", "'patos_vivos'", ")", ".", "innerHTML", "=", "qtde_patos", ";", "//Contatos de patos mortos", "document", ".", "getElementById", "(", "'patos_mortos'", ")", ".", "innerHTML", "=", "0", ";", "contagem_tempo", "(", "tempo_segundos", "+", "1", ")", ";", "}" ]
[ 4, 0 ]
[ 70, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
calcula
(base, expoente)
null
) Crie uma função que recebe dois parâmetros, base e expoente, e retorne a base elevada ao expoente
) Crie uma função que recebe dois parâmetros, base e expoente, e retorne a base elevada ao expoente
function calcula(base, expoente){ // forma antiga let resultado = Math.pow(base, expoente) // OU nova forma resultado = base ** expoente return resultado }
[ "function", "calcula", "(", "base", ",", "expoente", ")", "{", "// forma antiga", "let", "resultado", "=", "Math", ".", "pow", "(", "base", ",", "expoente", ")", "// OU nova forma", "resultado", "=", "base", "*", "*", "expoente", "return", "resultado", "}" ]
[ 2, 0 ]
[ 9, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
formatCurrency
(date)
null
colocar o valor para data br
colocar o valor para data br
function formatCurrency(date) { const splittedDate = date.split("-"); const month = months(splittedDate[1]); return `${month} ${splittedDate[2]} ${splittedDate[0]}`; }
[ "function", "formatCurrency", "(", "date", ")", "{", "const", "splittedDate", "=", "date", ".", "split", "(", "\"-\"", ")", ";", "const", "month", "=", "months", "(", "splittedDate", "[", "1", "]", ")", ";", "return", "`", "${", "month", "}", "${", "splittedDate", "[", "2", "]", "}", "${", "splittedDate", "[", "0", "]", "}", "`", ";", "}" ]
[ 56, 0 ]
[ 60, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
listarProduto
()
null
Lista os produtos cadastrados na tela
Lista os produtos cadastrados na tela
function listarProduto() { $.ajax({ type: "post", url: "https://rentalsystempm.000webhostapp.com/php/estoque/listarProduto.php", dataType: "json", //se der certo success: function (data) { var itemProduto = ""; $.each(data.produto, function (i, dados) { itemProduto += "<div class='row linha itemProd' data-toggle='modal' data-target='#modalProduto' data-id='" + dados.codigo + "'><div class='col-xs-3'><img class='img-responsive' src='https://rentalsystempm.000webhostapp.com/" + dados.foto + "' alt='' style='max-width: 100%; text-align: center'></div><div class='col-xs-9'><div class='row'><div class='col-xs-6'><label for=''><strong>Nome:</strong><br> " + dados.produto + "</label></div><div class='col-xs-6'><label for=''><strong>Descrição:</strong><br> " + dados.descricao + "</label></div></div><div class='row'><div class='col-xs-6'><label for=''><strong>Quantidade:</strong><br> " + dados.quantidade + "</label></div><div class='col-xs-6'><label for=''><strong>Valor:</strong><br> R$ " + dados.valor + "</label></div></div></div></div>"; }); $("#telaProd").html(itemProduto); }, //se der errado error: function (data) { navigator.notification.alert(data); } }); }
[ "function", "listarProduto", "(", ")", "{", "$", ".", "ajax", "(", "{", "type", ":", "\"post\"", ",", "url", ":", "\"https://rentalsystempm.000webhostapp.com/php/estoque/listarProduto.php\"", ",", "dataType", ":", "\"json\"", ",", "//se der certo", "success", ":", "function", "(", "data", ")", "{", "var", "itemProduto", "=", "\"\"", ";", "$", ".", "each", "(", "data", ".", "produto", ",", "function", "(", "i", ",", "dados", ")", "{", "itemProduto", "+=", "\"<div class='row linha itemProd' data-toggle='modal' data-target='#modalProduto' data-id='\"", "+", "dados", ".", "codigo", "+", "\"'><div class='col-xs-3'><img class='img-responsive' src='https://rentalsystempm.000webhostapp.com/\"", "+", "dados", ".", "foto", "+", "\"' alt='' style='max-width: 100%; text-align: center'></div><div class='col-xs-9'><div class='row'><div class='col-xs-6'><label for=''><strong>Nome:</strong><br> \"", "+", "dados", ".", "produto", "+", "\"</label></div><div class='col-xs-6'><label for=''><strong>Descrição:</strong><br> \" +", "d", "dos.d", "e", "scricao +", "\"", "/label></div></div><div class='row'><div class='col-xs-6'><label for=''><strong>Quantidade:</strong><br> \" +", "d", "dos.q", "u", "antidade +", "\"", "/label></div><div class='col-xs-6'><label for=''><strong>Valor:</strong><br> R$ \" +", "d", "dos.v", "a", "lor +", "\"", "/label></div></div></div></div>\";", "", "}", ")", ";", "$", "(", "\"#telaProd\"", ")", ".", "html", "(", "itemProduto", ")", ";", "}", ",", "//se der errado", "error", ":", "function", "(", "data", ")", "{", "navigator", ".", "notification", ".", "alert", "(", "data", ")", ";", "}", "}", ")", ";", "}" ]
[ 39, 0 ]
[ 58, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
createAliens
()
null
função para criar inimigos aleatórios
função para criar inimigos aleatórios
function createAliens() { let newAlien = document.createElement('img'); let alienSprite = aliensImg[Math.floor(Math.random() * aliensImg.length)]; //sorteio de imagens newAlien.src = alienSprite; newAlien.classList.add('alien'); newAlien.classList.add('alien-transition'); newAlien.style.left = '370px'; newAlien.style.top = `${Math.floor(Math.random() * 330) + 30}px`; playArea.appendChild(newAlien); moveAlien(newAlien); }
[ "function", "createAliens", "(", ")", "{", "let", "newAlien", "=", "document", ".", "createElement", "(", "'img'", ")", ";", "let", "alienSprite", "=", "aliensImg", "[", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "aliensImg", ".", "length", ")", "]", ";", "//sorteio de imagens", "newAlien", ".", "src", "=", "alienSprite", ";", "newAlien", ".", "classList", ".", "add", "(", "'alien'", ")", ";", "newAlien", ".", "classList", ".", "add", "(", "'alien-transition'", ")", ";", "newAlien", ".", "style", ".", "left", "=", "'370px'", ";", "newAlien", ".", "style", ".", "top", "=", "`", "${", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "330", ")", "+", "30", "}", "`", ";", "playArea", ".", "appendChild", "(", "newAlien", ")", ";", "moveAlien", "(", "newAlien", ")", ";", "}" ]
[ 85, 0 ]
[ 95, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
rand
(min = 1000, max = 2000)
null
Função de CallBack - parte 01
Função de CallBack - parte 01
function rand(min = 1000, max = 2000) { const num = Math.random() * (max - min) + min; return Math.round(num); }
[ "function", "rand", "(", "min", "=", "1000", ",", "max", "=", "2000", ")", "{", "const", "num", "=", "Math", ".", "random", "(", ")", "*", "(", "max", "-", "min", ")", "+", "min", ";", "return", "Math", ".", "round", "(", "num", ")", ";", "}" ]
[ 17, 0 ]
[ 20, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
soma2
(a,b)
null
função com retorno
função com retorno
function soma2(a,b){ return a+b }
[ "function", "soma2", "(", "a", ",", "b", ")", "{", "return", "a", "+", "b", "}" ]
[ 19, 0 ]
[ 22, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
soma
(a, b)
null
Uma função pode retornar/conter uma função
Uma função pode retornar/conter uma função
function soma(a, b) { return function (c) { console.log(a + b + c); } }
[ "function", "soma", "(", "a", ",", "b", ")", "{", "return", "function", "(", "c", ")", "{", "console", ".", "log", "(", "a", "+", "b", "+", "c", ")", ";", "}", "}" ]
[ 36, 0 ]
[ 40, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
handleNext
()
null
Se next for menor que total de página - 2 limpamos o array test e pagenumber e depois iteramos por ele criando arrays de 3 números, sempre aumentando o valor das duas ultimas casas.
Se next for menor que total de página - 2 limpamos o array test e pagenumber e depois iteramos por ele criando arrays de 3 números, sempre aumentando o valor das duas ultimas casas.
function handleNext() { if(next <= (Math.ceil((totalPages/listPerPage)))) { test.splice(0, test.length); pageNumbers.splice(0, pageNumbers.length); for (let i = next; i <= next + 2; i++) { test.push(i); setNext(i); } } }
[ "function", "handleNext", "(", ")", "{", "if", "(", "next", "<=", "(", "Math", ".", "ceil", "(", "(", "totalPages", "/", "listPerPage", ")", ")", ")", ")", "{", "test", ".", "splice", "(", "0", ",", "test", ".", "length", ")", ";", "pageNumbers", ".", "splice", "(", "0", ",", "pageNumbers", ".", "length", ")", ";", "for", "(", "let", "i", "=", "next", ";", "i", "<=", "next", "+", "2", ";", "i", "++", ")", "{", "test", ".", "push", "(", "i", ")", ";", "setNext", "(", "i", ")", ";", "}", "}", "}" ]
[ 12, 2 ]
[ 21, 3 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
statement_block
msgToast
(message)
null
/* Função de Mensagem
/* Função de Mensagem
function msgToast(message){ $.toast({ heading: message.title, text: message.text, icon: message.icon, hideAfter: message.duration, position: 'top-right', stack: false }); }
[ "function", "msgToast", "(", "message", ")", "{", "$", ".", "toast", "(", "{", "heading", ":", "message", ".", "title", ",", "text", ":", "message", ".", "text", ",", "icon", ":", "message", ".", "icon", ",", "hideAfter", ":", "message", ".", "duration", ",", "position", ":", "'top-right'", ",", "stack", ":", "false", "}", ")", ";", "}" ]
[ 118, 0 ]
[ 127, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
handleNewIncident
(e)
null
function para criação de novo Caso
function para criação de novo Caso
async function handleNewIncident(e) { e.preventDefault() const data = { title, description, value } try { await api.post('incidents', data, { headers: { Authorization: ongId } }) history.push('/profile') } catch (err) { alert('Erro ao cadastrar caso, tente novamente.') } }
[ "async", "function", "handleNewIncident", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", "const", "data", "=", "{", "title", ",", "description", ",", "value", "}", "try", "{", "await", "api", ".", "post", "(", "'incidents'", ",", "data", ",", "{", "headers", ":", "{", "Authorization", ":", "ongId", "}", "}", ")", "history", ".", "push", "(", "'/profile'", ")", "}", "catch", "(", "err", ")", "{", "alert", "(", "'Erro ao cadastrar caso, tente novamente.'", ")", "}", "}" ]
[ 20, 2 ]
[ 39, 3 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
statement_block
mult
(x, y)
null
named function expression - armazenar função nomeada em variável - ajuda em stack
named function expression - armazenar função nomeada em variável - ajuda em stack
function mult(x, y) { return x * y }
[ "function", "mult", "(", "x", ",", "y", ")", "{", "return", "x", "*", "y", "}" ]
[ 19, 13 ]
[ 21, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
variable_declarator
setup
()
null
Posição da bola no eixo x Função resposável por inicializar todas as variáveis
Posição da bola no eixo x Função resposável por inicializar todas as variáveis
function setup() { const canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); //Inicializa a posição dos jogadores, que é no meio da tela p1_y = p2_y = (h / 2) - (p_h / 2); //Inicializa os pontos dos jogadores, que é zero p1_points = 0; p2_points = 0; //Definindo o frame rate setInterval(loop, 1000 / 60); initBall(); }
[ "function", "setup", "(", ")", "{", "const", "canvas", "=", "document", ".", "getElementById", "(", "\"canvas\"", ")", ";", "ctx", "=", "canvas", ".", "getContext", "(", "\"2d\"", ")", ";", "//Inicializa a posição dos jogadores, que é no meio da tela", "p1_y", "=", "p2_y", "=", "(", "h", "/", "2", ")", "-", "(", "p_h", "/", "2", ")", ";", "//Inicializa os pontos dos jogadores, que é zero", "p1_points", "=", "0", ";", "p2_points", "=", "0", ";", "//Definindo o frame rate", "setInterval", "(", "loop", ",", "1000", "/", "60", ")", ";", "initBall", "(", ")", ";", "}" ]
[ 25, 0 ]
[ 40, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
boxTop
(idBox)
null
Função para definir a distancia da box em relação ao topo do documento HTML.
Função para definir a distancia da box em relação ao topo do documento HTML.
function boxTop(idBox) { var boxOffset = $(idBox).offset(); return boxOffset.top; }
[ "function", "boxTop", "(", "idBox", ")", "{", "var", "boxOffset", "=", "$", "(", "idBox", ")", ".", "offset", "(", ")", ";", "return", "boxOffset", ".", "top", ";", "}" ]
[ 20, 0 ]
[ 23, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
removeBlankLinesAndMarkdown
(text)
null
filtra as linhas que estiverem vazias
filtra as linhas que estiverem vazias
function removeBlankLinesAndMarkdown(text) { const allLines = text.split('\n'); const withoutBlankLinesAndMarkdown = allLines.filter(line => { if (line.trim().length === 0 || line.trim().startsWith('=')) { return false; } return true; }); return withoutBlankLinesAndMarkdown.join(' '); }
[ "function", "removeBlankLinesAndMarkdown", "(", "text", ")", "{", "const", "allLines", "=", "text", ".", "split", "(", "'\\n'", ")", ";", "const", "withoutBlankLinesAndMarkdown", "=", "allLines", ".", "filter", "(", "line", "=>", "{", "if", "(", "line", ".", "trim", "(", ")", ".", "length", "===", "0", "||", "line", ".", "trim", "(", ")", ".", "startsWith", "(", "'='", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", ")", ";", "return", "withoutBlankLinesAndMarkdown", ".", "join", "(", "' '", ")", ";", "}" ]
[ 47, 4 ]
[ 59, 5 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
statement_block
P1RoundFightGame
()
null
Round do P1, mesmo esquema do Roundo do P2...
Round do P1, mesmo esquema do Roundo do P2...
function P1RoundFightGame() { message.channel.send(`${msgauthor}, Digite **Punch** para socar e **End** para encerrar a batalha.\n Você tem **15 segundos**, após isso a batalha irá se encerrar automaticamente!`).then(() => { message.channel.awaitMessages(filter, { max: 1, time: 15000, errors: ['time'] }) .then(message => { message = message.first() if (message.content.toUpperCase() == 'PUNCH' || message.content.toUpperCase() == 'P') { let p1dmg = Math.floor(Math.random() * 101); lifep2 = lifep2 - p1dmg if (lifep2 <= 0) { message.channel.send(`${msgauthor} deu **${p1dmg}** de dano em ${men}, que agora tem **0** de vida !`) message.channel.send(`A vida de ${men} chegou a zero ! ${msgauthor} **ganhou a batalha !**`) } else { message.channel.send(`${msgauthor} deu **${p1dmg}** de dano em ${men}, que agora tem **${lifep2}** de vida !`) P2RoundFightGame(); } } else if (message.content.toUpperCase() == 'END' || message.content.toUpperCase() == 'END') { message.channel.send(`Batalha encerrada!`) } else { message.channel.send(`Resposta inválida, reniciando o round ! `) P1RoundFightGame(); } }) .catch(collected => { message.channel.send(`O tempo acabou, ${msgauthor} arregou ! Logo o **${men} é o vitorioso !**`); return }); }) }
[ "function", "P1RoundFightGame", "(", ")", "{", "message", ".", "channel", ".", "send", "(", "`", "${", "msgauthor", "}", "\\n", "t", "h", "e", "n(()", " ", "=", ">", "{", "", "message", ".", "channel", ".", "awaitMessages", "(", "filter", ",", "{", "max", ":", "1", ",", "time", ":", "15000", ",", "errors", ":", "[", "'time'", "]", "}", ")", ".", "then", "(", "message", "=>", "{", "message", "=", "message", ".", "first", "(", ")", "if", "(", "message", ".", "content", ".", "toUpperCase", "(", ")", "==", "'PUNCH'", "||", "message", ".", "content", ".", "toUpperCase", "(", ")", "==", "'P'", ")", "{", "let", "p1dmg", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "101", ")", ";", "lifep2", "=", "lifep2", "-", "p1dmg", "if", "(", "lifep2", "<=", "0", ")", "{", "message", ".", "channel", ".", "send", "(", "`", "${", "msgauthor", "}", "${", "p1dmg", "}", "${", "men", "}", "`", ")", "message", ".", "channel", ".", "send", "(", "`", "${", "men", "}", "${", "msgauthor", "}", "`", ")", "}", "else", "{", "message", ".", "channel", ".", "send", "(", "`", "${", "msgauthor", "}", "${", "p1dmg", "}", "${", "men", "}", "${", "lifep2", "}", "`", ")", "P2RoundFightGame", "(", ")", ";", "}", "}", "else", "if", "(", "message", ".", "content", ".", "toUpperCase", "(", ")", "==", "'END'", "||", "message", ".", "content", ".", "toUpperCase", "(", ")", "==", "'END'", ")", "{", "message", ".", "channel", ".", "send", "(", "`", "`", ")", "}", "else", "{", "message", ".", "channel", ".", "send", "(", "`", ")", "", "P1RoundFightGame", "(", ")", ";", "}", "}", ")", ".", "catch", "(", "collected", "=>", "{", "message", ".", "channel", ".", "send", "(", "`", "${", "msgauthor", "}", "${", "men", "}", ")", ";", "", "return", "}", ")", ";", "}", ")", "}" ]
[ 60, 4 ]
[ 95, 5 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
statement_block
handleFinishClick
()
null
função do botão de finalizar o agendamento.
função do botão de finalizar o agendamento.
async function handleFinishClick() { if ( user.id && service != null && selectedYear > 0 && selectedMonth > 0 && selectedDay > 0 && selectedHour != null ) { /* let resp = await api.setAppointment( user.id, service, selectedYear, selectedMonth, selectedDay, selectedHour ); if (resp.error == '') { setShow(false); navigation.navigate('Appointments'); } else { Alert.alert(`Erro: ${resp.error}`); } */ setShow(false); navigation.navigate('Appointments'); } else { Alert.alert('Preencha todos os dados!') } }
[ "async", "function", "handleFinishClick", "(", ")", "{", "if", "(", "user", ".", "id", "&&", "service", "!=", "null", "&&", "selectedYear", ">", "0", "&&", "selectedMonth", ">", "0", "&&", "selectedDay", ">", "0", "&&", "selectedHour", "!=", "null", ")", "{", "/* let resp = await api.setAppointment(\n user.id,\n service,\n selectedYear,\n selectedMonth,\n selectedDay,\n selectedHour\n );\n if (resp.error == '') {\n setShow(false);\n navigation.navigate('Appointments');\n \n } else {\n Alert.alert(`Erro: ${resp.error}`);\n } */", "setShow", "(", "false", ")", ";", "navigation", ".", "navigate", "(", "'Appointments'", ")", ";", "}", "else", "{", "Alert", ".", "alert", "(", "'Preencha todos os dados!'", ")", "}", "}" ]
[ 129, 4 ]
[ 159, 5 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
statement_block
log
(message)
null
emitter.emit('log', "mensagem que eu quero")
emitter.emit('log', "mensagem que eu quero")
function log(message) { emitter.emit('log', message) }
[ "function", "log", "(", "message", ")", "{", "emitter", ".", "emit", "(", "'log'", ",", "message", ")", "}" ]
[ 16, 0 ]
[ 18, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program
defineBackgroundGame
()
null
criar região do jogo
criar região do jogo
function defineBackgroundGame() { context.fillStyle = "lightgreen"; context.fillRect(0, 0, 16 * box, 16 * box); }
[ "function", "defineBackgroundGame", "(", ")", "{", "context", ".", "fillStyle", "=", "\"lightgreen\"", ";", "context", ".", "fillRect", "(", "0", ",", "0", ",", "16", "*", "box", ",", "16", "*", "box", ")", ";", "}" ]
[ 17, 0 ]
[ 20, 1 ]
null
javascript
pt
['pt', 'pt', 'pt']
True
true
program