Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
update the legend with the corresponding visual type
function updateLegend(value) { let legendContainer = document.getElementById("collapseOne"); // create a color scale let legendContent = ""; let feature = roadDevelopment.toGeoJSON().features[0]; if(value == "status") { legendContent = getLegendContent(status, feature, "status", value); } else if (value == "contractor") { legendContent = getLegendContent(contractors, feature, "contractor", value); } else if (value == "funding") { legendContent = getLegendContent(funding, feature, "funding", value); } else if (value == "developmentType") { legendContent = getLegendContent(developmentNature, feature, "nature_dvp", value); } else if (value == "maintenanceType") { legendContent = getLegendContent(maintenanceType, feature, "maint_type", value); } legendContainer.innerHTML = legendContent; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function legend(types){\n\n //color guide\n colors[c].setAlpha(20);\n fill(colors[c]);\n colors[c].setAlpha(255);\n stroke(colors[c]);\n ellipse(width-40, h,20,20);\n\n //text\n fill('black');\n noStroke();\n text(types, width-60,h+5);\n c++;\n h+=25;\n}", "function displayCol...
[ "0.6844809", "0.67578787", "0.66393644", "0.66320056", "0.6460328", "0.64330745", "0.63878405", "0.6364604", "0.62860686", "0.62677795", "0.6264101", "0.62350273", "0.6147356", "0.61272544", "0.61165845", "0.61154795", "0.61065155", "0.6074302", "0.60736334", "0.6064399", "0....
0.6059908
20
funcion para validar los registros ingresados en el formulario
function validar() { // incio de validaci�n de espacios nulos if(document.registro.nombre.value.length==0) { alert("El nombre necesario"); document.registro.nombre.focus(); return 0; } if(document.registro.apellido.value.length==0) { alert("El apellido es necesario"); document.registro.apellido.focus(); return 0; } if(document.registro.ci.value.length==0) { alert("El CI es necesario"); document.registro.ci.focus(); return 0; } if(document.registro.telfdom.value.length==0) { alert("Telfono de Domicilio es necesario"); document.registro.telfdom.focus(); return 0; } if(document.registro.celular.value.length==0) { alert("Celular es necesario"); document.registro.celular.focus(); return 0; } if(document.registro.dirdom.value.length==0) { alert("Direccion de domicilio es necesario"); document.registro.dirdom.focus(); return 0; } if(document.registro.mail.value.length==0) { alert("Mail es necesario"); document.registro.mail.focus(); return 0; } if(document.registro.usuario.value.length==0) { alert("El nombre de usuario esta vacio"); document.registro.usuario.focus(); return 0; } if(document.registro.pass.value.length==0) { alert("No coloco una contrase�a"); document.registro.pass.focus(); return 0; } if(document.registro.conpass.value.length==0) { alert("Debe validar su contrase�a"); document.registro.conpass.focus(); return 0; } var RegExPattern = /(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$/; var errorMessage = 'Password No seguro.'; if ((document.registro.pass.value.match(RegExPattern)) && (document.registro.pass.value!="")) { alert('Password Seguro'); } else { alert(errorMessage); document.registro.pass.focus(); return 0; } //Fin de validacion de espacios nulos //------------------------------------------- // Incio de validacion de tamanio if(document.registro.nombre.value.length<=3 || document.registro.nombre.value.length>=100) { alert("El nombre es muy largo o muy corto"); document.registro.nombre.focus(); return 0; } if(document.registro.apellido.value.length<=3 || document.registro.apellido.value.length>=100) { alert("El apellidoes muy largo o muy corto"); document.registro.apellido.focus(); return 0; } if(document.registro.ci.value.length<=5 || document.registro.ci.value.length>=10) { alert("El CI invalido"); document.registro.ci.focus(); return 0; } if(document.registro.telfdom.value.length<7 || document.registro.telfdom.value.length>7) { alert("Telfono de Domicilio incorrecto"); document.registro.telfdom.focus(); return 0; } if(document.registro.celular.value.length!=8) { alert("Celular es incorrecto"); document.registro.celular.focus(); return 0; } if(document.registro.dirdom.value.length<=5 || document.registro.dirdom.value.length>=200) { alert("Direccion de domicilio incorrecto"); document.registro.dirdom.focus(); return 0; } if(document.registro.mail.value.length<=10 || document.registro.mail.value.length>=100 ) { alert("El mail es incorrecto"); document.registro.mail.focus(); return 0; } if(document.registro.usuario.value.length<=5 || document.registro.usuario.value.length>=10 ) { alert("El nombre de usuario debe estar entre 6 y 10 caracteres"); document.registro.usuario.focus(); return 0; } if(document.registro.pass.value.length<=7 || document.registro.pass.value.length>=15 ) { alert("La contrase�a debe estar entre 8 y 15 caracteres"); document.registro.pass.focus(); return 0; } // fin de validacion de tamanio // -------------------------------- // incio validaciones especiales if(isNaN(document.registro.ci.value)) { alert("El carnet de indentidad tiene que ser un n�mero"); document.registro.ci.focus(); return 0; } if(isNaN(document.registro.telfdom.value)) { alert("El telefono de domicilio tiene que ser un n�mero"); document.registro.telfdom.focus(); return 0; } if(isNaN(document.registro.telfofi.value)&& document.registro.telfofi.value.length!=0) { alert("El telefono de oficina tiene que ser un n�mero"); document.registro.telfofi.focus(); return 0; } if(isNaN(document.registro.celular.value)) { alert("El celular tiene que ser un n�mero"); document.registro.celular.focus(); return 0; } if ((document.registro.mail.value.indexOf("@"))<3) { alert("Lo siento,la cuenta de correo parece err�nea. Por favor, comprueba el prefijo y el signo '@'."); document.registro.mail.focus(); return 0; } if ((document.registro.mail.value.indexOf(".com")<5)&&(document.registro.mail.value.indexOf(".org")<5)&&(document.registro.mail.value.indexOf(".gov")<5)&&(document.registro.mail.value.indexOf(".net")<5)&&(document.registro.mail.value.indexOf(".mil")<5)&&(document.registro.mail.value.indexOf(".edu")<5)) { alert("Lo siento. Pero esa cuenta de correo parece err�nea. Por favor,"+" comprueba el sufijo (que debe incluir alguna terminaci�n como: .com, .edu, .net, .org, .gov o .mil)"); document.registro.email.focus() ; return 0; } if(document.registro.pass.value !=document.registro.conpass.value ) { alert("Las contrase�as no coinciden"); document.registro.conpass.focus(); return 0; } if(document.registro.tipo.value ==0) { alert("Debes escoger que tipo de usuario eres"); document.registro.tipo.focus(); return 0; } if(document.registro.tipo.value >=3 && document.registro.ingreso.value ==0) { alert("Debes escoger el a�o que entraste a la camara"); document.registro.ingreso.focus(); return 0; } // fin validaciones especiales document.registro.submit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validarFormulario(){\n var flagValidar = true;\n var flagValidarRequisito = true;\n\n if(txtCrben_num_doc_identific.getValue() == null || txtCrben_num_doc_identific.getValue().trim().length ==0){\n txtCrben_num_doc_identific.markInvalid('Establezca el numero de documento, p...
[ "0.7780708", "0.73891914", "0.73323995", "0.7292465", "0.72768724", "0.71497834", "0.7122191", "0.71212393", "0.7090104", "0.70774513", "0.70718926", "0.6969548", "0.6958392", "0.69293386", "0.69244885", "0.6913222", "0.69116396", "0.69065845", "0.68913424", "0.6882677", "0.6...
0.72534895
5
O(1) time | O(1) space
insertKeyValuePair(key, value) { if (!(key in this.cache)) { if (this.currentSize === this.maxSize) { this.evictLeastRecent(); } else { this.currentSize++; } this.cache[key] = new DoublyLinkedListNode(key, value); } else { this.replaceKey(key, value); } this.updateMostRecent(this.cache[key]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "a (a a = 0; a < a.a; ++a) {N\n a a = a[a];N\n a (a.a == a) {N\n a a = aAaAaAa(a, a.a);N\n a (!a) a.a = aAa;N\n a a (aAa) a.a = a.a == a ? a : a.a + a;N\n }N\n }", "function example2(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n...
[ "0.58963597", "0.5773009", "0.56997454", "0.5678217", "0.5632634", "0.55526686", "0.5529421", "0.55288666", "0.55260557", "0.5502768", "0.54840946", "0.54433763", "0.5439919", "0.541413", "0.5363272", "0.5361449", "0.53528523", "0.5347562", "0.5334384", "0.5325698", "0.532474...
0.0
-1
O(1) time | O(1) space
getValueFromKey(key) { if (!(key in this.cache)) return null; this.updateMostRecent(this.cache[key]); return this.cache[key].value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "a (a a = 0; a < a.a; ++a) {N\n a a = a[a];N\n a (a.a == a) {N\n a a = aAaAaAa(a, a.a);N\n a (!a) a.a = aAa;N\n a a (aAa) a.a = a.a == a ? a : a.a + a;N\n }N\n }", "function example2(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n...
[ "0.5896532", "0.5772888", "0.56994814", "0.5679278", "0.56334513", "0.555237", "0.55305433", "0.5527666", "0.5527356", "0.55027413", "0.5485202", "0.5443168", "0.54402065", "0.54148716", "0.5362729", "0.5361359", "0.53531194", "0.5347456", "0.5335589", "0.5326401", "0.5325374...
0.0
-1
O(1) time | O(1) space
getMostRecentKey() { return this.listOfMostRecent.head.key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "a (a a = 0; a < a.a; ++a) {N\n a a = a[a];N\n a (a.a == a) {N\n a a = aAaAaAa(a, a.a);N\n a (!a) a.a = aAa;N\n a a (aAa) a.a = a.a == a ? a : a.a + a;N\n }N\n }", "function example2(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n...
[ "0.5896532", "0.5772888", "0.56994814", "0.5679278", "0.56334513", "0.555237", "0.55305433", "0.5527666", "0.5527356", "0.55027413", "0.5485202", "0.5443168", "0.54402065", "0.54148716", "0.5362729", "0.5361359", "0.53531194", "0.5347456", "0.5335589", "0.5326401", "0.5325374...
0.0
-1
optimized for a situation where an array is NEARLY sorted already. if an array is already sorted after a few iterations, no need ot keep going.
function optimized(array) { let noSwaps; for (let i = array.length; i > 0; i--) { noSwaps = true; for (let j = 0; j < i - 1; j++) { if (array[j] > array[j + 1]) { swap(array, j, j + 1); noSwaps = false; } } if (noSwaps) break; } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sort() {\n let a = this.array;\n const step = 1;\n let compares = 0;\n for (let i = 0; i < a.length; i++) {\n let tmp = a[i];\n for (var j = i; j >= step; j -= step) {\n this.store(step, i, j, tmp, compares);\n compares++;\n if (a[j - step] > tmp) {\n a[j] = a[j ...
[ "0.7239428", "0.7152367", "0.7111647", "0.7063362", "0.7019022", "0.6935939", "0.6855298", "0.6845212", "0.683609", "0.68279815", "0.67228496", "0.6708787", "0.6646946", "0.66445386", "0.6637366", "0.6598989", "0.6588099", "0.65729445", "0.65609324", "0.65296215", "0.65115845...
0.73683107
0
define the function init the variables for the data
function initData() { sensorTypes = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initData() {\n initLtr_factor();\n initBosunit();\n initHero();\n initSelect25();\n initMS();\n}", "function initValues(){\n}", "function initData(){\n dynarexDataIsland.init();\n loadFunctionTimes();\n setEventListener();\n}", "function var_init() {\n function makeCalcVars(sizeFe...
[ "0.7627249", "0.70823383", "0.7033934", "0.70273155", "0.69545424", "0.6743981", "0.66507673", "0.6636795", "0.65980947", "0.6530505", "0.6493658", "0.6476729", "0.6475092", "0.64043105", "0.63946295", "0.63946295", "0.6389219", "0.63561726", "0.63172245", "0.63138354", "0.63...
0.60564595
52
10s get last time
function getSensorLastTime(timeKey) { if(!sensorID) { console.log('The sensor key is not gotten.'); } var categoryName = categories[0]; var categoryRef = db.ref(`/${SENSORDATA_TABLE}/${categoryName}/${sensorID}/series`); categoryRef.orderByChild('timestamp').limitToLast(1).once("value", function(snapshot) { snapshot.forEach(function(childSnap) { var categoryData = childSnap.val(); console.log('---Last time at ---'); console.log(categoryData['value'][timeKey]); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currTime(){\n let timeout = new Date();\n return timeout.toString();\n}", "function getTimeSinceLastRead() {\n if (lastSync == null) {\n return \"\";\n } else {\n var date = Date.now();\n return timeDifference(date, lastSync);\n }\n}", "function gettime() {\n //r...
[ "0.694904", "0.68758506", "0.68016297", "0.6774451", "0.6730998", "0.67131805", "0.6702831", "0.6702831", "0.66859066", "0.666943", "0.66481614", "0.66260934", "0.6623832", "0.6565186", "0.65301204", "0.65212375", "0.650168", "0.64989763", "0.64751786", "0.64667743", "0.64642...
0.0
-1
get the firebase data
function getFirebaseData() { // get sensorTypes getSensorsRef.orderByChild("serialNumber").equalTo(serialNumber).once("value", function(snapshot) { var sensorData = snapshot.val(); if(sensorData) { for (var key in sensorData) { sensorID = key; sensorTypeID = sensorData[sensorID]['sensorTypeId']; sensorCustomerID = sensorData[sensorID]['customerId']; sensorZoneID = sensorData[sensorID]['zoneId']; sensorOwnName = sensorData[sensorID]['name']; } if(!sensorID) { console.log('Sensor ID does not exist'); } if(!sensorTypeID) { console.log('Sensor Type ID does not exist'); } if(sensorID && sensorTypeID) { // getSensorLastTime('Last1 sample at'); var getSensorTypeRef = db.ref(`/${SENSORTYPE_TABLE}/${sensorTypeID}`); var listenerSensorStatusRef = db.ref(`/${SENSORDEVICES_TABLE}/${sensorID}/actionStatus`); var listenerCalibrationStatusRef = db.ref(`/${SENSORDEVICES_TABLE}/${sensorID}/calibrationStatus`); var listenerSensorResponseRef = db.ref(`/${SENSORDEVICES_TABLE}/${sensorID}/resVal`); var listenerSensorPingRef = db.ref(`/${SENSORDEVICES_TABLE}/${sensorID}/pingVal`); var listenerSensorDeviceRef = db.ref(`/${SENSORCONFIGS_TABLE}/${sensorID}`); var lisnterSensorAvailaibilty = db.ref(`/${SENSORS_TABLE}/${sensorID}/availability`); lisnterSensorAvailaibilty.set('on'); lisnterSensorAvailaibilty.onDisconnect().set('off'); // Sensor availibility status lisnter lisnterSensorAvailaibilty.on('value', snapshot => { if(snapshot.val() !== 'on') { lisnterSensorAvailaibilty.set('on'); } }); getCategoryParameters('status').then((res) => { console.log('--- Category Parameters ---'); console.log(res) }).catch(function(err) { console.log(err) }); getBarometricPressure(); // sensor action response listener listenerSensorResponseRef.on('value', snapshot => { if(snapshot.val()) { var value = snapshot.val(); if(parseInt(value) !== 111) { listenerSensorResponseRef.set(111); } } }); listenerCalibrationStatusRef.on("value", function(calibrationSnapshot) { if(calibrationSnapshot.val() || calibrationSnapshot.val() === 0) { switch(parseInt(calibrationSnapshot.val())) { case 0: console.log('Status is PID calibration Start'); break; case 1: console.log('Status is PID calibration Stop'); break; case 2: console.log('Status is PID calibration Config Save'); getCalibtrationData(); break; } } }); return; // getAnalyticalParams();ANALYTICALDATA_TABLE // db.ref(`/${ANALYTICALDATA_TABLE}/${sensorID}`).set(11); // sendLocationUpdated(42.292322, -83.713272, '1301 Beal Ave, Ann Arbor, Michigan'); // get sensorTypes getSensorTypeRef.once("value", function(typesnapshot) { var value = typesnapshot.val(); var types = ['header_row_type', 'header_type']; var statusKeyArray = []; var sensortypeArray; if(value['status']['tableType'] === types[0]) { sensortypeArray = value['status']['rows']; } else { sensortypeArray = value['status']['heads']; } for(var i=0; i<sensortypeArray.length; i++) { if(sensortypeArray[i]['id']) { statusKeyArray.push(sensortypeArray[i]['id']); } } initData(sensorID, sensorTypeID); setSensorCategories(typesnapshot.val()); sendCategory({ '6ijvh1LLB4': '192.123.5.4' }, 0); return; var messageData = { 'Status3': '1', 'Power3': '2', 'Temp3 (F)': '3', 'Humidity level3 (%)': '4', 'Barometer3 (in)': '5', 'Barometer3 (mb)': '6', 'Pump status3': '7', 'Last sample at3': '8' }; var statusData_new ={}; for(var j=0; j<statusKeyArray.length; j++) { let dataKey = statusKeyArray[j]; if(messageData.hasOwnProperty(dataKey)) { statusData_new[dataKey] = messageData[dataKey]; } } initData(sensorID, sensorTypeID); // setSensorCategories(typesnapshot.val()); // sendSensorData(); },function(error){ console.log('Fail getting the sensor type: '); writeLog(error); }); //db.ref(`/${SENSORS_TABLE}/${sensorID}/availability`).set('on'); // db.ref(`/${SENSORS_TABLE}/${sensorID}/availability`).onDisconnect().set('off'); // listenerSensorStatusRef.onDisconnect().set(0); // listenerSensorStatusRef.onDisconnect().set(5); // uploadProcessData(); // getServerTime(); // uploadCSV(); // watch the sensor ping value // listenerSensorPingRef.on("value", function(ping) { // if(ping.val() && parseInt(ping.val()) === 1) { // listenerSensorPingRef.set(0); // } else { // var newPingRef = db.ref(`/${SENSORDEVICES_TABLE}/${sensorID}/`); // newPingRef.update({ // pingVal: 0 // }); // } // }); // sendProgressData(); resetProgressBar(); // listenerCalibrationStatusRef.on("value", function(calibrationSnapshot) { // if(calibrationSnapshot.val() || calibrationSnapshot.val() === 0) { // switch(parseInt(calibrationSnapshot.val())) { // case 0: // console.log('Status is PID calibration Start'); // break; // case 1: // console.log('Status is PID calibration Stop'); // break; // case 2: // console.log('Status is PID calibration Config Save'); // getCalibtrationData(); // break; // } // } // }); listenerSensorStatusRef.on("value", function(snapshot) { if(snapshot.val() || snapshot.val() === 0) { var value = snapshot.val(); switch(parseInt(value)) { case 0: console.log('Online status and None action'); break; case 1: console.log('Status is configuration'); listenerSensorStatusRef.set(0); // getConfigure(sensorID); break; case 2: console.log('Status is start'); // uploadCSV(); break; case 3: console.log('Status is stop'); break; case 4: console.log('Status is reboot'); break; case 5: console.log('Status is debug'); clearDebug().then((res) => { if(res) { var csv_file_path = './canlendar.csv'; uploadDebug(csv_file_path); } }); break; case 6: console.log('Status is shutdown'); break; default: console.log('Status is unknown'); listenerSensorStatusRef.set(0); } } }); } } else { console.log('This sensor is not existed in firebase database.'); } },function(error){ console.log('Fail getting the sensor: '); writeLog(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get() {\r\n database.ref('test/' + dev_name).on('value', function(snapshot) {\r\n var data = snapshot.val();\r\n console.log(data);\r\n console.log(data.siteName);\r\n console.log(data.developer);\r\n console.log(data.testNumber);\r\n console.log(data.lSitLangu...
[ "0.7369583", "0.7331226", "0.72101384", "0.7187341", "0.7178806", "0.7102275", "0.7030622", "0.70058393", "0.69830734", "0.6963241", "0.6925252", "0.6899609", "0.6850683", "0.6826986", "0.6820529", "0.6801981", "0.6796384", "0.6774565", "0.6745369", "0.6744054", "0.6728506", ...
0.64618367
34
send the sensor data to the firebase
function sendProgressData() { currentModalType = 0; // if(currentModalType) { var listenerSensorDeviceRef = db.ref(`/${SENSORCONFIGS_TABLE}/${sensorID}/${currentModalType}`); listenerSensorDeviceRef.update({ runNumber: 1, stepNumber: 1, runProgressPercent: 1, stepProgressPercent: 1, stepTotalTime: 10, runTotalTime: 10, stepRemainTime: 9, runRemainTime: 9, isFinished: false }); // } else { // console.log('Error: empty modal type'); // } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendToFirebase() {\n dataRef.ref().push({\n\n trainName: trainName,\n destination: destination,\n firstTime: firstTime,\n frequency: frequency,\n tMinutesTillTrain: tMinutesTillTrain,\n nextTrainTime: nextTrainTime,\n date...
[ "0.8131074", "0.8014038", "0.7109165", "0.70306826", "0.682984", "0.67779654", "0.6683725", "0.64592177", "0.6457688", "0.64486265", "0.6442165", "0.6394561", "0.6360005", "0.628713", "0.6257047", "0.6242758", "0.6227607", "0.61794275", "0.6154235", "0.6133399", "0.61258554",...
0.555503
88
update csv url field of the firebase
function updateAnalyticalDataPath(path, storageUrl, fileSize) { getServerTime(); // var sensorCsvRef = db.ref(`/${RAWDATA_TABLE}/${sensorID}`); // sensorCsvRef.push({ // timestamp: admin.database.ServerValue.TIMESTAMP, // storagePath: path, // storageUrl: storageUrl, // fileSize: fileSize, // stepType: 'Sampling', // cycleIndex: admin.database.ServerValue.TIMESTAMP // }).then((snap) => { // var key = snap.key; // var sensorCsvDataRef = db.ref(`/${RAWDATA_TABLE}/${sensorID}/${key}`); // sensorCsvDataRef.once("value", function(csvData) { // var data = csvData.val(); // console.log('---first timestamp in cycle'); // console.log(data['cycleIndex']); // console.log(new Date(data['cycleIndex']).toLocaleString()) // },function(error){ // console.log('Fail getting the csv data: '); // writeLog(error); // }); // }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateSensorCsvPath(path, storageUrl, fileSize) {\n\tgetServerTime();\n\t// var sensorCsvRef = db.ref(`/${RAWDATA_TABLE}/${sensorID}`);\n\t// sensorCsvRef.push({\n\t// \ttimestamp: admin.database.ServerValue.TIMESTAMP,\n\t// \tstoragePath: path,\n\t// \tstorageUrl: storageUrl,\n\t// \tfileSize: fileSize,\...
[ "0.64955556", "0.6200983", "0.6099137", "0.60410684", "0.5852328", "0.584925", "0.5746406", "0.57146347", "0.5561724", "0.5423229", "0.5419859", "0.5403221", "0.54012454", "0.5308625", "0.5273344", "0.52477413", "0.52220756", "0.52128977", "0.51532006", "0.5141549", "0.513218...
0.5991426
4
upload csv file to the firebase storage
function uploadCSV() { var csv_file_path = './test.csv.gz'; gServerTime = admin.database.ServerValue.TIMESTAMP; const fileMime = mime.lookup(csv_file_path); var csv_file_name = path.basename(csv_file_path); var uploadTo = path.join(SENSORSTORAGES_TABLE, sensorCustomerID, sensorZoneID, sensorID, csv_file_name); console.log("uploadto:", uploadTo); var metadata = { contentType: 'text/plain', contentEncoding: 'gzip', cacheControl: "public, max-age=300", customerId: sensorCustomerID }; bucket.upload(csv_file_path,{ destination:uploadTo, public:true, metadata: metadata }, function(err, file) { if(err) { console.log(err); return; } console.log(createPublicFileURL(uploadTo)); updateSensorCsvPath(uploadTo, createPublicFileURL(uploadTo), file['metadata']['size']); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uploadDealcsv() { }", "function createFile(){\n\n var reader = new FileReader();\n \n reader.readAsDataURL(blob)\n\n reader.onloadend = function () {\n\n var base64String = reader.result;\n\n // Remove the additional data at the front of the string\n\n ...
[ "0.70864666", "0.6412542", "0.63053954", "0.61854106", "0.6181541", "0.60704106", "0.6062957", "0.60605705", "0.6042", "0.60219145", "0.59990776", "0.5996304", "0.5991806", "0.59757465", "0.5943389", "0.5934994", "0.5931722", "0.5919915", "0.59017164", "0.5896043", "0.5882718...
0.7571525
0
upload debug file to the firebase storage
function clearDebug() { var promise = new Promise(function(resolve, reject) { db.ref(`/${DEBUG_DATA_TABLE}/${sensorID}`).once("value", function(debug) { var debugFileList = debug.val(); var promises = []; if(debugFileList) { for (key in debugFileList) { if(debugFileList[key] && debugFileList[key]['storagePath']) { promises.push(deleteStorageFile(debugFileList[key]['storagePath'])); } } Promise.all(promises) .then(function(res) { db.ref(`/${DEBUG_DATA_TABLE}/${sensorID}`).remove() .then(() => { resolve(true); }).catch(function(err) { resolve(false); }); }).catch(function(err) { resolve(false); }); } else { resolve(true); } },function(error){ console.log('Fail getting the start time: '); writeLog(error); resolve(false); }); }); return promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uploadFile(){\n\t\nvar filename = selectedFile.name;\n\nvar storageRef = firebase.storage().ref('/images/' + filename);\n\nvar uploadTask = storageRef.put(selectedFile);\n\nuploadTask.on('state_changed',function(snapshot){\n\n},function(error){\n\n},function() {\n // Handle successful uploads on complete...
[ "0.6954052", "0.67957014", "0.6752039", "0.6676497", "0.65986276", "0.6595325", "0.6595325", "0.6568596", "0.65635794", "0.65464747", "0.65114796", "0.64820457", "0.64794743", "0.6461166", "0.6458107", "0.6439833", "0.6418849", "0.6346277", "0.6343245", "0.6337678", "0.633270...
0.0
-1
get the csv file url for download
function createPublicFileURL(storageName) { return `http://storage.googleapis.com/${bucketName}/${encodeURIComponent(storageName)}`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function downloadCSVFile(){\r\n\tlet data = getTableData();\r\n\r\n\t// Build the actual content of the csv file\r\n\tlet csv = buildCSVString(data);\r\n\r\n\t// Create the file and initiate the download\r\n\tlet downloadLink = buildDownloadLink(csv);\r\n\r\n\t// Force the client (the users browser) to click our h...
[ "0.74357545", "0.7362606", "0.7142768", "0.7026361", "0.7011918", "0.6913856", "0.68556786", "0.6844354", "0.6820098", "0.68112856", "0.68098056", "0.6782969", "0.67366856", "0.66980886", "0.6695947", "0.6634617", "0.65253747", "0.65242344", "0.65109485", "0.6428795", "0.6415...
0.0
-1
update csv url field of the firebase
function updateSensorCsvPath(path, storageUrl, fileSize) { getServerTime(); // var sensorCsvRef = db.ref(`/${RAWDATA_TABLE}/${sensorID}`); // sensorCsvRef.push({ // timestamp: admin.database.ServerValue.TIMESTAMP, // storagePath: path, // storageUrl: storageUrl, // fileSize: fileSize, // stepType: 'Sampling', // cycleIndex: admin.database.ServerValue.TIMESTAMP // }).then((snap) => { // var key = snap.key; // var sensorCsvDataRef = db.ref(`/${RAWDATA_TABLE}/${sensorID}/${key}`); // sensorCsvDataRef.once("value", function(csvData) { // var data = csvData.val(); // console.log('---first timestamp in cycle'); // console.log(data['cycleIndex']); // console.log(new Date(data['cycleIndex']).toLocaleString()) // },function(error){ // console.log('Fail getting the csv data: '); // writeLog(error); // }); // }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateCSV(data) {\n if (this.anchor.href) window.URL.revokeObjectURL(this.anchor.href);\n this.csv = Papa.unparse(\n { fields: [\"name\", \"description\", \"score\"], data: data.sorted },\n paramExportCSV\n );\n const blob = new Blob([this.csv], { type: \"text/csv\" }),\n url = window.UR...
[ "0.6200983", "0.6099137", "0.60410684", "0.5991426", "0.5852328", "0.584925", "0.5746406", "0.57146347", "0.5561724", "0.5423229", "0.5419859", "0.5403221", "0.54012454", "0.5308625", "0.5273344", "0.52477413", "0.52220756", "0.52128977", "0.51532006", "0.5141549", "0.5132186...
0.64955556
0
set local variable back end data
function setSensorCategories(sensorTypeData) { if(!sensorTypeData) { writeLog('The sensorType data is not existed'); return; } for(var i=0; i<categories.length; i++) { var categoryName = categories[i]; if(sensorTypeData.hasOwnProperty(categoryName)) { sensorTypes[categoryName] = sensorTypeData[categoryName] } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setData() {}", "function setData (jsonData) { //we create a function to call later when the data is retrieved from the server in a new variable\n data = jsonData; // this is also called deserializing our JSON\n console.log(data);\n}", "set data(val) {\n this._data = val;\n }", "set(data) {\n ...
[ "0.6529307", "0.6462941", "0.64401853", "0.6342643", "0.62661034", "0.6138284", "0.6132692", "0.6114555", "0.6087379", "0.60327", "0.6028693", "0.5998975", "0.592386", "0.59053135", "0.5899487", "0.58963686", "0.58948594", "0.5870359", "0.5841717", "0.5833886", "0.58203274", ...
0.0
-1
write the error log to the log.txt
function writeLog(txt) { var dt = dateTime.create(); var log = dt.format('Y-m-d H:M:S'); log += '\n'; log += txt; log += '\n'; fs.appendFileSync('log.txt', log); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logErr(err) {\n\tlet d = new Date();\n\tlet errMsg = \"error occurred at \" + d + \": \" + err;\n\tfs.appendFileSync(\"Error_Log.txt\", errMsg, \"utf8\");\n}", "function logErr(err) {\n\tfs.appendFile('botErrors.log',err,function(err) {\n\t\tif (err) console.log(\"Error recording error: \",err);\n\t\tel...
[ "0.74946725", "0.7274442", "0.70160204", "0.69777477", "0.6939192", "0.68285364", "0.6617986", "0.638578", "0.63369715", "0.6308461", "0.6298517", "0.6282417", "0.62697256", "0.62484264", "0.6227945", "0.6227082", "0.62233835", "0.6215648", "0.6169883", "0.6116521", "0.610340...
0.66356844
6
send the sensor data to the firebase
function sendSensorData() { var basicData = []; // status basic data basicData[0] = { 'Status1': 'Normal', 'Power1': 'On', 'Voltage level1': 'Check', 'Temp1 (F)': 24.22, 'Humidity level1 (%)': 9, 'Barometer1 (in)': 100, 'Barometer1 (mb)': 8, 'Pump status1': 'Stopped', 'Last sample at1': '2017-4-17', 'bm3nVoeJ6n': '192.168.0.12' }; // vocAnalytics basic data basicData[1] = { 'Benzene1': { 'ppb1': 12 }, 'Toluene1': { 'ppb1': 11 }, 'm-xylene1': { 'ppb1': 13 }, 'O-Xylene1': { 'ppb1': 14 }, 'Mesitylene1': { 'ppb1': 15 }, 'Hexanal1': { 'ppb1': 16 }, 'Chlorobenzene1': { 'ppb1': 17 }, 'Chlorohexane1': { 'ppb1': 18 } }; // vocRaw basic data basicData[2] = { 'Raw Capacitance (pF)1': 22 }; // processedData basic data basicData[3] = { 'Compensated Capacitance1': 32 }; // debug basic data basicData[4] = { 'Debug1': 'This sensor is broken because of some errors.' }; sendCategory(basicData[0], 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendToFirebase() {\n dataRef.ref().push({\n\n trainName: trainName,\n destination: destination,\n firstTime: firstTime,\n frequency: frequency,\n tMinutesTillTrain: tMinutesTillTrain,\n nextTrainTime: nextTrainTime,\n date...
[ "0.8131074", "0.8014038", "0.7109165", "0.70306826", "0.682984", "0.67779654", "0.6683725", "0.64592177", "0.6457688", "0.64486265", "0.6442165", "0.6394561", "0.6360005", "0.628713", "0.6257047", "0.6242758", "0.6227607", "0.61794275", "0.6154235", "0.6133399", "0.61258554",...
0.555222
89
check if the input value is followed by the template value type
function checkValueType(value, valueStructure) { if(valueStructure && valueStructure.hasOwnProperty('valueType')) { var result = false; switch(valueStructure['valueType']) { case valueTypes[0]: // option if(valueStructure.hasOwnProperty('defaultValue') && valueStructure['defaultValue'].length > 0) { if(valueStructure['defaultValue'].indexOf(value) > -1) { result = true } else { result = false; writeLog(value + ' is not existed in default value.'); } } else { result = false; writeLog('Default value property is not existed.'); } return result; break; case valueTypes[1]: // number return !isNaN(parseFloat(value)) && isFinite(value); break; default: if(value) { return true; } else { return false; } } } else { writeLog('valueType property is not existed.'); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function canUseAsIs(valueType) {\n return valueType === \"string\" ||\n valueType === \"boolean\" ||\n valueType === \"number\" ||\n valueType === \"json\" ||\n valueType === \"math\" ||\n valueType === \"regexp\" ||\n value...
[ "0.66646236", "0.63535607", "0.6321838", "0.6307817", "0.6278044", "0.6241317", "0.62410027", "0.6232016", "0.62281436", "0.62145466", "0.62137264", "0.61811703", "0.6176179", "0.6176179", "0.6176179", "0.61402076", "0.6134875", "0.61177295", "0.61177295", "0.61010635", "0.60...
0.6192748
11
get the sensor data field id with the name / params name: name value: data value template: field structure return id if id is existed for the value, null if not
function getTemplateID(name, value, template) { if(template && template.length > 0) { for(var i=0; i<template.length; i++) { if(name == template[i]['id']) { var result = checkValueType(value, template[i]); if(result) { return template[i]['id']; } else { return null; } } } } else { writeLog('Template is not existed'); } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _value_id(field_name, id) {\n return 'v' + id + '_' + field_name;\n}", "getById(id) {\r\n const f = new Field(this);\r\n f.concat(`('${id}')`);\r\n return f;\r\n }", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "function ppom_get_field_met...
[ "0.7112298", "0.63188446", "0.578865", "0.5746341", "0.5712111", "0.56244546", "0.56214327", "0.55927366", "0.55540943", "0.5521438", "0.55204874", "0.5507364", "0.5503411", "0.54766935", "0.5432791", "0.5400064", "0.53646547", "0.5350519", "0.53299326", "0.53179914", "0.5293...
0.6201139
2
get primary id in the sensor type fields / params heads: params return primary key id
function getPrimaryID(heads) { if(heads && heads.length > 0) { for(var i=0; i<heads.length; i++) { if(heads[i].hasOwnProperty('primaryKey') && heads[i]['primaryKey']) { if(heads[i].hasOwnProperty('id')) { return heads[i]['id']; } else { writeLog('id is not existed.'); return null; } } else { writeLog('primaryKey is not existed.'); return null; } } } else { writeLog('head is not existed.'); return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get primaryId() {\n return this.table.primary || DEFAULT_PRIMARY_ID;\n }", "getPrimaryKey ({ collections }, tableName) {\n let definition = collections[tableName].definition\n\n if (!definition._pk) {\n let pk = _.findKey(definition, (attr, name) => {\n return attr.primaryKey === true...
[ "0.652257", "0.61104065", "0.588628", "0.5831376", "0.57848424", "0.57285625", "0.57283175", "0.5716863", "0.56924194", "0.5642424", "0.56300706", "0.56197673", "0.55843383", "0.55720556", "0.5563781", "0.5560487", "0.550579", "0.55011284", "0.5499653", "0.5486495", "0.548538...
0.6066068
2
change the name keys to id ones / params data: the data should be sent to sensorData's category template: sensor category's template structure type: true if heads property is existed, false if not
function changeRowFieldKeys(data, template, type) { var changedData = {}; if(type) { // heads is existed var primaryKeyID = getPrimaryID(template['heads']); if(!primaryKeyID) { return; } for (rowKey in data ) { // rows var rowData = {}; for (headKey in data[rowKey] ) { // rows var headId = getTemplateID(headKey, data[rowKey][headKey], template['heads']); if(headId) { rowData[headId] = data[rowKey][headKey]; } } rowData[primaryKeyID] = 'primaryKey'; var rowId = getTemplateID(rowKey, data[rowKey], template['rows']); if(rowId) { changedData[rowId] = rowData; } } } else { for (key in data ) { var id = getTemplateID(key, data[key], template['rows']); if(id) { changedData[id] = data[key]; } } } return changedData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dataTreatment(){\n\tconsole.log(\"New data. Weeeeee!\");\n\tvar name, status, data;\n\tObject.keys(tefDevicesData).forEach(function (key){\n\t\tconsole.log(key);\n\t\tconsole.log(JSON.stringify(tefDevicesData[key].deviceInfo));\n\t\tif(tefDevicesData[key].deviceInfo.deviceType == \"MultiSensor\"){\n\t\t\t...
[ "0.58599806", "0.56088215", "0.5419447", "0.54137087", "0.53683937", "0.5241774", "0.5184227", "0.51700693", "0.51630425", "0.5091002", "0.508536", "0.50320077", "0.5016878", "0.5005023", "0.4994154", "0.49790815", "0.4972774", "0.49632025", "0.49584347", "0.49310747", "0.492...
0.47533998
41
change the name to the id / params data: basic data of the sensor template: sensor field template return the data which is changed the name field to the id one
function changeHeadFieldKeys(data, template) { var primaryKeyID = getPrimaryID(template); if(!primaryKeyID) { return; } var changedData = {}; for (key in data ) { var id = getTemplateID(key, data[key], template); if(id) { changedData[id] = data[key]; } } changedData[primaryKeyID] = 'primaryKey'; return changedData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_name_and_id(element,value){\n input_value = element.value;\n element.value = input_value.replace(/ #.*$/,'');\n $(element.id.replace(/_names$/,'_ids')).value +=\n input_value.replace(/^.*#/,'') + ', ';\n}", "function changeNameDataStream(elem)\n{\n var id=elem.id;\n id=id.replace(/ |i...
[ "0.60910296", "0.59155345", "0.5852306", "0.5798364", "0.57469755", "0.5726523", "0.5657402", "0.55777043", "0.5547351", "0.55222934", "0.55207384", "0.5493622", "0.54585975", "0.54528886", "0.54476315", "0.5445073", "0.54248184", "0.541874", "0.5409754", "0.5393969", "0.5375...
0.49569097
89
get real data to send to the firebase with the basic sensor data / params value: basic data of the sensor categoryTemplate: category template return real data to send to the firebase
function getSendValue(value, categoryTemplate) { var result; if(categoryTemplate.hasOwnProperty('tableType')) { if(categoryTemplate['tableType'] === tableTypes[0]) { //row-header type if(categoryTemplate.hasOwnProperty('heads') && categoryTemplate['heads']) { result = changeRowFieldKeys(value, categoryTemplate, true); } else { result = changeRowFieldKeys(value, categoryTemplate, false); } } else { // header type result = changeHeadFieldKeys(value, categoryTemplate['heads']); } } else { writeLog('The tableType property is not existed.'); result = null; } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFirebaseData() {\n\t// get sensorTypes\n\tgetSensorsRef.orderByChild(\"serialNumber\").equalTo(serialNumber).once(\"value\", function(snapshot) {\n\t\tvar sensorData = snapshot.val();\n\n\t\tif(sensorData) {\n\t\t\tfor (var key in sensorData) {\n\t\t\t\tsensorID = key;\n\t\t\t\tsensorTypeID = sensorDat...
[ "0.67253244", "0.6094705", "0.57290685", "0.56892425", "0.5666443", "0.56220806", "0.5612104", "0.55743307", "0.5509902", "0.5482769", "0.54600304", "0.54118687", "0.5401676", "0.5397469", "0.538797", "0.53821826", "0.5338335", "0.5332391", "0.52497154", "0.52444077", "0.5241...
0.0
-1
send real category data to the firebase for saving / params basicData: basic data which sensor get through device categoryID: 0: status, 1: vocAnalytics, 2: vocRaw, 3: processedData, 4: debug
function sendCategory(basicData, categoryID) { var categoryName = categories[categoryID]; var sendValue; if(sensorTypes.hasOwnProperty(categoryName)) { var categoryTemplate = sensorTypes[categoryName]; sendValue = getSendValue(basicData, categoryTemplate); } else { writeLog(`${categoryName} property is not existed`); return; } // uploadCSV(); if(sendValue) { var sendData = { "timestamp": admin.database.ServerValue.TIMESTAMP, "value": sendValue }; ref = db.ref(`/${SENSORDATA_TABLE}`); var dataRef = ref.child(`${categoryName}/${sensorID}/series`); var newPostRef = dataRef.push(); newPostRef.set(sendData); var recentRef = ref.child(`${categoryName}/${sensorID}/recent`); recentRef.update(sendData); console.log(`The category-${categoryName} is sent successfully.`); } else { console.log(`The category-${categoryName} is empty!`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendSensorData() {\n\tvar basicData = [];\n\n\t// status basic data\n\tbasicData[0] = {\n\t\t'Status1': 'Normal',\n\t\t'Power1': 'On',\n\t\t'Voltage level1': 'Check',\n\t\t'Temp1 (F)': 24.22,\n\t\t'Humidity level1 (%)': 9,\n\t\t'Barometer1 (in)': 100,\n\t\t'Barometer1 (mb)': 8,\n\t\t'Pump status1': 'Stopp...
[ "0.6150161", "0.58594114", "0.56845653", "0.5572353", "0.549958", "0.5381906", "0.53794605", "0.5341962", "0.5333886", "0.5318851", "0.5255085", "0.52343285", "0.52248764", "0.52011836", "0.5167374", "0.5159126", "0.51271594", "0.50965166", "0.50887674", "0.50605184", "0.5036...
0.7311873
0
fade nonhighlighted nodes and links
function fade(opacity) { return d => { node.style('stroke-opacity', function (o) { var thisOpacity = isConnected(d, o) ? 1 : opacity; this.setAttribute('fill-opacity', thisOpacity); return thisOpacity; }); link.style('stroke-opacity', o => (o.source === d || o.target === d ? 1 : opacity)) .filter(function(d){ return d.weight == 0; }) .remove(); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fadeUnConnected(g){\n\t\t\t\tvar thisLink = links2.selectAll(\".link\");\n\t\t\t\tthisLink.filter(function(d){ return d.source !==g && d.target !== g; })\n\t\t\t\t\t.transition()\n\t\t\t\t\t\t.duration(500)\n\t\t\t\t\t\t.style(\"opacity\", 0.05);\n\t\t\t}", "function fadeUnConnected(g){\n\t\t\t\tvar thi...
[ "0.64721197", "0.6463635", "0.6288334", "0.6250026", "0.6235494", "0.6147643", "0.60578954", "0.6047325", "0.60018104", "0.5989762", "0.5983014", "0.5927616", "0.59060484", "0.59059536", "0.5889064", "0.5888175", "0.5862085", "0.58412284", "0.5824847", "0.5813348", "0.5805343...
0.61331725
6
zoom in out functions
function zoom_actions(){ g.attr("transform", d3.event.transform) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "zoomOut () {}", "zoomIn () {}", "zoomOut() {\n this.zoom *= 0.8;\n }", "zoomIn() {\n this.zoom *= 1.25;\n }", "zoomIn(x, y){ return this.zoom(x, y, this.Scale.current + this.Scale.factor) }", "function zoomIn(){\n $(this).off('click', zoomIn);\n $(this).off('mouseove...
[ "0.8740835", "0.856025", "0.81357926", "0.7685426", "0.7612931", "0.75694984", "0.75477034", "0.7458413", "0.72341055", "0.7209767", "0.7186903", "0.71830237", "0.7181311", "0.713424", "0.7111423", "0.7104495", "0.71041876", "0.70899653", "0.7075139", "0.70396197", "0.7012457...
0.69235027
27
The path function take a node of the json as input, and return x and y coordinates of the line to draw for this node.
function path(d) { return d3.line()(dimensions.map(function(p) { return [x(p), y[p](d[p])]; })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getLinePath() {\n const graph = this.graph;\n const width = graph.getWidth();\n const height = graph.getHeight();\n const tl = graph.getPoint({\n x: 0,\n y: 0\n });\n const br = graph.getPoint({\n x: width,\n y: height\n });\n const cell = this.cell;\n const flooX = ...
[ "0.6866219", "0.66087294", "0.6524561", "0.65123963", "0.65123963", "0.6508384", "0.6508384", "0.647139", "0.6462794", "0.6457866", "0.6457866", "0.6456872", "0.6424157", "0.6406251", "0.63971204", "0.6367203", "0.6367203", "0.6358994", "0.6358994", "0.6345159", "0.6345043", ...
0.6480197
7
function that describes how mouseover works
function mouseover(d, position) { svg.classed("active", true); if (position < yCounter.source && position >= 0) { name = "source"; } else { name = "target"; } if (typeof d === "string") { projection.classed("inactive", function(p) { return p[name] !== d; }); projection.filter(function(p) { return p[name] === d; }).each(moveToFront); ordinal_labels.classed("inactive", function(p) { return p[name] !== d; }); ordinal_labels.filter(function(p) { return p[name] === d;}).each(moveToFront); } else { projection.classed("inactive", function(p) { return p !== d; }); projection.filter(function(p) { return p === d; }).each(moveToFront); ordinal_labels.classed("inactive", function(p) { return p !== d.name; }); ordinal_labels.filter(function(p) { return p === d.name; }).each(moveToFront); tooltip .style("opacity", 1); d3.select(this) .style("opacity", 1); tooltip .html("The association between <br>'" + d.source + "' and '" + d.target + "' is: " + "<b>" + d.weight + "</b>") .style("left", (d3.event.pageX) + "px") .style("top", (d3.event.pageY) + "px"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "e_mouseOver(e)\n\t{\n\n\t}", "function hovering() {\n\n}", "function mouseOver() {\n setMouseOver(true);\n }", "function mouseOver(x, y) {\r\n\t//debugOut(\"mouse over, x=\"+x+\" y=\"+y);\r\n\t\r\n\t//*** Your Code Here\r\n}", "hover() {}", "onMouseOver_() {\n if (this.isOpenable_()) {\n this...
[ "0.7900731", "0.76834774", "0.7630776", "0.7537821", "0.74414265", "0.7351", "0.71657175", "0.71283406", "0.711282", "0.70777303", "0.70719236", "0.7059272", "0.70587045", "0.6999024", "0.6993641", "0.6982314", "0.69688404", "0.6967834", "0.6950893", "0.6949161", "0.6924601",...
0.64164275
84
====================== BARCHART BELOW ======================
function barchart (source1) { var svg = d3.select('svg#barchart') var margin = {top: 20, right: 20, bottom: 150, left: 70}, width = +svg.attr("width") - margin.left - margin.right, height = +svg.attr("height") - margin.top - margin.bottom; var x0 = d3.scaleBand() .rangeRound([0, width]) .paddingInner(0.2); var x1 = d3.scaleBand() .padding(0.1); var y = d3.scaleLinear() .rangeRound([(height / 1.75), 0]); var z = d3.scaleOrdinal() .range(["#37A3D6", "#FF9400", "#ff0000"]); var g = svg.append ("g") .attr ("class", "everything") d3.csv (source1, function(d, i, columns) { for (var i = 1, n = columns.length; i < n; ++i) d[columns[i]] = +d[columns[i]]; return d; }, function(error, data) { if (error) throw error; var g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")"); // create a tooltip var tooltip = d3.select ("body") .append ("div") .attr ("class", "tooltip") .style("pointer-events", "none") .style ("opacity", 0); /*var tooltip = d3.select("body") .append("div") .style("opacity", 0) .attr("class", "tooltip") .style("background-color", "white") .style("border", "solid") .style("border-width", "2px") .style("border-radius", "5px") .style("padding", "5px") .style("position", "absolute") .style("pointer-events", "none") .style("width", "200px")*/ // Three functions that change the tooltip when user hover / move / leave a cell var mouseover = function(d) { tooltip .style("opacity", 1) d3.select(this) .style("stroke", "black") .style("opacity", 1) } var mousemove = function(d) { tooltip .html("The <b>" + d.key + "</b> algorithm yields an average probability of <b>" + d.value + "</b> for '" + d.state + "'") .style("left", (d3.event.pageX) + "px") .style("top", (d3.event.pageY) + "px") } var mouseleave = function(d) { tooltip .style("opacity", 0) d3.select(this) .style("stroke", "none") .style("opacity", 0.8) } var keys = data.columns.slice(1); x0.domain(data.map(function(d) { return d.State; })); x1.domain(keys).rangeRound([0, x0.bandwidth()]); y.domain([ (Math.floor(d3.min(data, function(d) { return d3.max(keys, function(key) { return d[key]; }); }) / 10)), (Math.ceil(d3.max(data, function(d) { return d3.max(keys, function(key) { return d[key]; }); }) / 10)*0.99) ]); var legend = g.append("g") .attr("class", "legend") .selectAll("g") .data(keys.slice()) .enter() .append("g") .attr("transform", function(d, i) { return "translate(" + i * (width / keys.length) + ", 0)"; }); legend.append("rect") .attr("x", 0) .attr("width", 20) .attr("height", 20) .attr("fill", z); legend.append("text") .attr("x", 25) .attr("y", 9.5) .attr("dy", "0.32em") .text(function(d) { return d; }); // add the Y gridlines g.append("g") .attr("class", "grid") .attr("transform", "translate(0," + (height / 7) + ")") .call(d3.axisLeft(y) .tickSize(-width) .tickFormat("") .ticks(6) ); var barG = g.append("g") .selectAll("g") .data(data) .enter() .append("g") .attr("transform", function(d) { return "translate(" + x0(d.State) + ",0)";}); barG.selectAll(".bars-container-middle") .data(function(d) { return keys.map(function(key) { return {key: key, value: d[key], state: d.State};}); }) .enter() .append("rect") .attr("class", function(d) { if (d.value > 75) return 'bars-container-middle clinically-significant-pulsing-rect'; else return 'bars-container-middle'; }) .attr("transform", "translate(0," + (height / 7) + ")") .attr("x", function(d) { return x1(d.key); }) .attr("y", function(d) { return 0; }) .attr("width", x1.bandwidth()) .transition() .delay(function (d,i){ return 750;}) // this is to do left then right bars .duration(250) .attr('height', function( d ) { return ((height / 1.75));});; barG.selectAll(".bars") .data(function(d) { return keys.map(function(key) { return {key: key, value: d[key], state: d.State};}); }) .enter() .append("rect") .attr("class", "bars") .attr("transform", "translate(0," + (height / 7) + ")") .attr("x", function(d) { return x1(d.key); }) .attr("width", x1.bandwidth()) .attr("fill", function(d) { return z(d.key); }) .attr("y", (height / 2)) .on("mouseover", mouseover) .on("mousemove", mousemove) .on("mouseleave", mouseleave) .transition() .delay(function (d,i){ return i * 250;}) // this is to do left then right bars .duration(250) .attr("y", function(d) { return y(d.value); }) .attr('height', function( d ) { return ((height / 1.75)) - y( d.value );}) g.append("g") .attr("class", "x-axis axis") .attr("transform", "translate(0," + (height / 1.4) + ")") .call(d3.axisBottom(x0)) .selectAll("text") .style("text-anchor", "end") .attr("dx", "-.8em") .attr("dy", ".15em") .attr("transform", "rotate(-65)") .text(function (d) { if(d.length > 60) { return d.substring(0,14)+'...'; } else { return d; } }); g.append("g") .attr("class", "y-axis axis") .attr("transform", "translate(0," + (height / 7) + ")") .call(d3.axisLeft(y).ticks(6)); // text label for the x axis g.append("text") .attr("transform", "translate(" + (width/2) + " ," + (height + margin.top + 65) + ")") .style("text-anchor", "middle") .text("Cause of Death"); // text label for the y axis g.append("text") .attr("transform", "rotate(-90)") .attr("y", 0 - margin.left) .attr("x",0 - (height / 2)) .attr("dy", "1em") .style("text-anchor", "middle") .text("Average Probability"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected internal function m252() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "private public function m246() {}", "transient final protected i...
[ "0.6381113", "0.6319148", "0.582954", "0.58024925", "0.57582873", "0.574122", "0.56599015", "0.5562609", "0.5556702", "0.554421", "0.5539058", "0.547501", "0.54433435", "0.53509057", "0.53109825", "0.525467", "0.5243442", "0.52173907", "0.52173907", "0.52173907", "0.52173907"...
0.0
-1
Handle the data returned by LoginServlet
function handleSearchResult(resultDataString) { console.log("handle search response"); console.log(resultDataString) resultDataJson = resultDataString; //resultDataJson = JSON.parse(resultDataString); // Don't need this, jQuery does this for you. console.log(resultDataJson); // If login success, redirect to index.html page if (resultDataJson["status"] === "success") { console.log("success") let getString = "movieList.html"; getString = handleGStr(resultDataJson["movie_title"], "movie_title=", getString); getString = handleGStr(resultDataJson["movie_year"], "movie_year=", getString); getString = handleGStr(resultDataJson["director"], "director=", getString); getString = handleGStr(resultDataJson["star_name"], "star_name=", getString); getString = handleGStr("yes", "s=", getString); console.log("string=" + getString+"&s=yes"); window.location.replace(getString); } // If login fail, display error message on <div> with id "login_error_message" else { console.log("show error message"); alert(resultDataJson["message"]); jQuery("#login_error_message").text(resultDataJson["message"]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleLoginResponse(_event) {\n let xhr = _event.target;\n if (xhr.readyState == XMLHttpRequest.DONE) {\n if (xhr.response == \"Login information correct\") {\n console.log(\"Login completed\");\n loadUserPictureOverview();\n }\n ...
[ "0.67710036", "0.67273486", "0.6600515", "0.64485276", "0.64425325", "0.6409441", "0.6351647", "0.63399774", "0.6322016", "0.63172656", "0.6249665", "0.62154037", "0.6174559", "0.6160772", "0.61531883", "0.6114646", "0.6065337", "0.6039461", "0.60302144", "0.6011082", "0.5968...
0.5720616
58
Submit the form content with POST method
function submitForm(formSubmitEvent) { console.log("submit search form"); // Important: disable the default action of submitting the form // which will cause the page to refresh // see jQuery reference for details: https://api.jquery.com/submit/ formSubmitEvent.preventDefault(); jQuery.get( "api/search", // Serialize the login form to the data sent by POST request jQuery("#search_form").serialize(), (resultDataString) => handleSearchResult(resultDataString)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formPOST(){\n\n\tthis.submit();\n\n}", "function form_submit()\n {\n /* Get reply form */\n var form = submit_btn.form;\n\n /* The fields we need when do a post */\n var fields = [\"followup\", \"rootid\", \"subject\", \"upfilerename\",\n \"username\", \"passwd\...
[ "0.7653703", "0.7393026", "0.7342635", "0.7323739", "0.7233916", "0.68513834", "0.67519915", "0.6732171", "0.6680481", "0.66108173", "0.6606948", "0.6594353", "0.6571123", "0.6550397", "0.65277034", "0.65268403", "0.65211535", "0.648921", "0.64862275", "0.6483011", "0.6475371...
0.0
-1
This is used for he alt text for images
function addIntroInputSpecial(container, message, data) { // Create the title const pageIntroInput_Title = document.createElement('p'); pageIntroInput_Title.classList.add('html-gen-instruction'); pageIntroInput_Title.innerText = message; // Create the input field const pageIntroInput_Field = document.createElement('textarea'); pageIntroInput_Field.setAttribute('data-input', data); pageIntroInput_Field.type = "text"; // This EventListener changes the color of the input field as soon as text is entered pageIntroInput_Field.addEventListener('change', highlightGlobalInputField); pageIntroInput_Field.classList.add('html-gen-input'); // Update the html container container.appendChild(pageIntroInput_Title); container.appendChild(pageIntroInput_Field); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SetAlternateTextOnImages(element) {\n if ($(element).attr('src').length > 0) { //don't show this on the empty license image when we don't know the license yet\n var nameWithoutQueryString = $(element).attr('src').split(\"?\")[0];\n $(element).attr('alt', 'This picture, ' + nameWithoutQuer...
[ "0.7390866", "0.733183", "0.7169982", "0.7002705", "0.69919634", "0.67775106", "0.6728552", "0.6690848", "0.6550307", "0.6443136", "0.631858", "0.629241", "0.6258762", "0.6129235", "0.6115246", "0.6110541", "0.6041363", "0.60365975", "0.6028647", "0.6022253", "0.59946907", ...
0.0
-1
====== Add Resources Button (btnSectionAddInput) ======
function addResourcesInput(e) { e.preventDefault(); // Variables let pageElementContainer; let resourcesCount; let parentArray; /* This is the parentArray */ let pageResourcesInput_div; let pageResourcesInput_btn; let pageResourcesInput_input; let pageResourcesInput_textarea; let pageResourcesInput_preview; let htmlElementList_container = []; /* Array contains the whole input compound */ let htmlElementData; let htmlElementData_2; // Conditions if(e.target.dataset.btn === "btn--add-resources-material") { pageElementContainer = formAddResourcesMaterialContainer; resourcesCount = `M${resourcesMaterialCount}:`; parentArray = resourcesMaterialElementArray; } else if (e.target.dataset.btn === "btn--add-resources-video") { pageElementContainer = formAddResourcesVideoContainer; resourcesCount = `V${resourcesVideoCount}:`; parentArray = resourcesVideoElementArray; } else if (e.target.dataset.btn === "btn--add-resources-credits") { pageElementContainer = formAddResourcesCreditsContainer; resourcesCount = `C${resourcesCreditsCount}:`; parentArray = resourcesCreditsElementArray; } // const btnResourcesVideoAddInput = document.querySelector('[data-btn="btn--add-resources-video"]'); // Create Input Fields /*====== Create the container "form--resources-item" ======*/ const pageResourcesInput = document.createElement('div'); pageResourcesInput.classList.add('form--resources-item'); /*====== EXTRA-MATERIAL: ======*/ if (e.target.dataset.btn !== "btn--add-resources-credits") { /*====== (1) URL: - Create the url input // For the credits it is the credit input ======*/ pageResourcesInput_div = addSectionInput_Form_Elements('div', '', '', pageResourcesInput, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageResourcesInput_div, `${resourcesCount} La url que lleva al material es:`, '', '', ''); htmlElementData = Math.random(); pageResourcesInput_input = addSectionInput_Form_Elements('input', 'html-gen-input', '', pageResourcesInput_div, '', 'data-input', htmlElementData, 'text'); pageResourcesInput_input.spellcheck = false; // This EventListener changes the color of the input field as soon as text is entered pageResourcesInput_input.addEventListener('change', highlightGlobalInputField); // Upload element to array: updateSectionElement_childContainer('url', htmlElementData, '', htmlElementList_container, '') /*====== (2) TEXTAREA: - Create the textarea for the link text ======*/ pageResourcesInput_div = addSectionInput_Form_Elements('div', 'd-flex', 'jc-space', pageResourcesInput, '', '', '', ''); // Textarea htmlElementData = Math.random(); pageResourcesInput_textarea = addSectionInput_Form_Elements('textarea', 'input--text-area-resources', '', pageResourcesInput_div, '1) Ingresa tu texto aquí. 2) Después elige la parte que debe servir como enlace y da click en el button para confirmar tu selección.', 'data-input', htmlElementData, 'text'); pageResourcesInput_textarea.spellcheck = false; // Upload element to array: updateSectionElement_childContainer('a', htmlElementData, '', htmlElementList_container) // Button htmlElementData_2 = Math.random(); pageResourcesInput_btn = addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element-from-textarea', pageResourcesInput_div, '<i class="fas fa-link"></i>', 'data-btn', htmlElementData_2, 'text'); pageResourcesInput_btn.addEventListener('click', getSelectedLink); // This EventListener changes the color of the input field as soon as text is entered // pageResourcesInput_btn.addEventListener('change', highlightGlobalInputField); // Upload element to array: updateSectionElement_childContainer('btnSelectLink', htmlElementData_2, '', htmlElementList_container, '') /*====== (3) SELECTED LINK PREVIEW: - Create the preview box to display selection ======*/ pageResourcesInput_div = addSectionInput_Form_Elements('div', 'form__selection', 'textarea-preview', pageResourcesInput, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', 'textarea-preview__title', pageResourcesInput_div, `Como enlace se usara la parte:`, '', '', ''); // Preview box htmlElementData = Math.random(); pageResourcesInput_preview = addSectionInput_Form_Elements('p', 'textarea-preview__text', '', pageResourcesInput_div, '', 'data-output', htmlElementData, ''); updateSectionElement_childContainer('preview', htmlElementData, '', htmlElementList_container, []) } else if (e.target.dataset.btn === "btn--add-resources-credits") { /*====== CREDITS: ======*/ /*====== (1) CREDIT: - Create the credit input ======*/ pageResourcesInput_div = addSectionInput_Form_Elements('div', '', '', pageResourcesInput, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageResourcesInput_div, `${resourcesCount} El código del crédito es:`, '', '', ''); htmlElementData = Math.random(); pageResourcesInput_input = addSectionInput_Form_Elements('input', 'html-gen-input', '', pageResourcesInput_div, '', 'data-input', htmlElementData, 'text'); pageResourcesInput_input.spellcheck = false; pageResourcesInput_input.placeholder = "El código debe empezar directamente (sin espacios)."; // This EventListener changes the color of the input field as soon as text is entered pageResourcesInput_input.addEventListener('change', highlightGlobalInputField); // Upload element to array: // updateSectionElement_childContainer('credit', htmlElementData, '', htmlElementList_container, '') /*====== (2) NUMBER: - Select the position where we split it ======*/ pageResourcesInput_div = addSectionInput_Form_Elements('div', '', '', pageResourcesInput, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageResourcesInput_div, `¿En que posición quieres agregar el atributo (target="_blank")?`, '', '', ''); htmlElementData_2 = Math.random(); pageResourcesInput_input = addSectionInput_Form_Elements('input', 'html-gen-input', 'html-gen-input-filled', pageResourcesInput_div, '', 'data-input', htmlElementData_2, 'text'); pageResourcesInput_input.spellcheck = false; pageResourcesInput_input.type = "number"; pageResourcesInput_input.value = "3"; pageResourcesInput_input.placeholder = "Solo se acepataran números. Un 0 significa que no quieres agregar el atributo."; // This EventListener changes the color of the input field as soon as text is entered pageResourcesInput_input.addEventListener('change', highlightGlobalInputField); // Upload element to array with information of both: // (1) htmlElementData = credit (2) htmlElementData_2 = position where we splice updateSectionElement_childContainer('credit', htmlElementData, htmlElementData_2, htmlElementList_container, '') } // {/* <div class="form__selection textarea-preview"> // // <p class="html-gen-instruction textarea-preview__title">Como enlace se usara la parte:</p> // // <p class="textarea-preview__text" data-output="">.......</p> // // </div> */} // Iterate the counter if(e.target.dataset.btn === "btn--add-resources-material") { resourcesMaterialCount++; } else if(e.target.dataset.btn === "btn--add-resources-video") { resourcesVideoCount++; } else if(e.target.dataset.btn === "btn--add-resources-credits") { resourcesCreditsCount++; } // Upload our container to the html preview pageElementContainer.appendChild(pageResourcesInput); parentArray.push(htmlElementList_container); console.log(parentArray); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createSectionBtn(sectionObj) {\n let sectionButton = document.createElement('button');\n sectionButton.classList.add('btn', 'small-btn');\n sectionButton.id = 'section-button';\n\n if (addedSections.includes(sectionObj.sectionCode)) {\n sectionButton.textContent = '- Remove Section';\n ...
[ "0.61515176", "0.5984071", "0.5982989", "0.58160377", "0.5681092", "0.5628834", "0.5593539", "0.5527611", "0.55188936", "0.5512511", "0.5500401", "0.54797333", "0.5472116", "0.5465272", "0.54596215", "0.5441044", "0.53911656", "0.53874403", "0.53769636", "0.5351203", "0.53338...
0.6169565
0
================== // RESOURCES ================== /================== CHECKPOINT ==================
function createDocumentCheckpoint(e) { e.preventDefault(); /* ===Checkpoint=== */ // Create Section const pageSection = createSection('chapter', 'chapter-new', 'Video & PDF Button'); // Add checkpoint if approved createCheckpointItem(pageSection, e.target); // Create Section End createSectionHtmlEnd(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check(){\r\n\t// tracking disabilitato\r\n\t//requires(\"/tracking.js\");\r\n\t\r\n\t// funzione legacy\r\n\t_check();\r\n}", "function check_and_report() {\n \n }", "function checkDataFiles() {\n // TODO set up later\n}", "function test_candu_graphs_datastore_vsphere6() {}", "function ...
[ "0.6006143", "0.5980961", "0.5767887", "0.57399726", "0.57138187", "0.56900847", "0.56799746", "0.56073636", "0.55503327", "0.55005807", "0.5477785", "0.5424383", "0.5418436", "0.5404519", "0.5401336", "0.5386635", "0.5386605", "0.53749275", "0.5343018", "0.5315565", "0.53150...
0.0
-1
================== // CHECKPOINT ================== /================== CHAPTERS (= sections) ================== /====== Add Section Button (btnSectionAddInput) ======
function addSectionInput(e) { e.preventDefault(); addSectionInput_Form(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static addSection(p) {\n if (! p || ! (p.type || p.section)) {\n return;\n }\n\n if (p.index === undefined || p.index < 0 || p.index > this._sections.length) {\n return;\n }\n\n var newSectionJSON = p.section || {\n type: p.type\n };\n\n var newSection = app.ui.SectionFactory.cr...
[ "0.684539", "0.6675268", "0.66204333", "0.6491095", "0.64136976", "0.63515544", "0.63297945", "0.6324345", "0.6294935", "0.6271143", "0.62312275", "0.62222517", "0.62208134", "0.6213673", "0.62024385", "0.6195399", "0.6138216", "0.61038053", "0.60946465", "0.6093237", "0.6067...
0.7059298
0
====== CHAPTER: CREATE INPUT FORM Create the new sectionInputForm ======
function addSectionInput_Form() { /*====== Variables ======*/ let pageSectionInput_placeholder; let pageSectionInput_placeholderVideoDiv; let pageSectionInput_placeholderSelect; let pageSectionInput_placeholderSelect_div; let pageSectionInput_placeholderSelect_div_2; let htmlElementData; let htmlElementData_2; let htmlElementData_option; let htmlElementData_submitBtn; let htmlElementData_listIndex = 1; let htmlElementMessage; let htmlElementList_container = []; let htmlElementChapter_Object = {}; // Subsections let pageSectionInput_subsection_placeholder; let pageSectionInput_subsection_placeholderSelect; let pageSectionInput_subsection_placeholderSelect_div; let pageSectionInput_subsection_placeholderSelect_div_2; let pageSectionInput_subChapterNr = 1; let pageSectionInput_subsection_toggleBtn; /*====== Create the container "html-gen-box" ======*/ const pageSectionInput = document.createElement('div'); pageSectionInput.classList.add('html-gen-box'); /*====== (1) GENERAL: - Create a div container ======*/ const pageSectionInput_titleDiv = addSectionInput_Form_Elements('div', 'd-flex', 'jc-space', pageSectionInput, '', '', '', ''); // Create a title inside the div container addSectionInput_Form_Elements('h3', 'html-gen-subtitle', '', pageSectionInput_titleDiv, `Capítulo ${pageSectionInput_chapterNr}`, '', '', ''); pageSectionInput_chapterNr++; // Create a button inside the div container const pageSectionInput_toggleBtn = addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-general-toggle', pageSectionInput_titleDiv, '<i class="fas fa-edit"></i>', '', '', ''); pageSectionInput_toggleBtn.addEventListener('click', () => { pageSectionInput_form.classList.toggle('hidden-html-gen'); pageSectionInput_subsectionContainer.classList.toggle('hidden-html-gen'); }); /*====== (2) SECTIONS: - Create the container "form" ======*/ const pageSectionInput_form = addSectionInput_Form_Elements('form', 'html-gen-form', 'hidden-html-gen', pageSectionInput, '', '', '', ''); // Create the input [title] field pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'Elige un título para el capítulo:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '', 'data-input', htmlElementData, 'text').addEventListener('change', highlightGlobalInputField); updateSectionElement_childContainer('h2', htmlElementData, '', htmlElementList_container, '') // Create the input [chapter number] field htmlElementData = Math.random(); if(inputAutomaticNumbering.value === "yes") { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', 'hidden-html-gen', '', pageSectionInput_form, '', 'data-form', htmlElementData, ''); } else { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', 'data-form', htmlElementData, ''); } updateSectionElement_childContainer('chapter-nr-form', htmlElementData, '', htmlElementList_container, '') addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'Número del capítulo (1, 2, 3 etc.):', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '(ej. 1)', 'data-input', htmlElementData, 'text').addEventListener('change', highlightGlobalInputField); updateSectionElement_childContainer('chapter-nr', htmlElementData, '', htmlElementList_container, '') // Create the input [has video] select option pageSectionInput_placeholder = addSectionInput_Form_Elements('div', 'form__selection', 'd-flex', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'El capítulo tiene vídeo:', '', '', ''); htmlElementData = Math.random(); pageSectionInput_placeholderSelect = addSectionInput_Form_Elements('select', 'select-box', 'select-box--small', pageSectionInput_placeholder, '', 'data-input', htmlElementData, '') updateSectionElement_childContainer('has-video', htmlElementData, '', htmlElementList_container, '') addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'Sí', '', '', 'yes'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'No', '', '', 'no'); // Create a <div> for the video settings pageSectionInput_placeholderVideoDiv = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); pageSectionInput_placeholderSelect.addEventListener('click', (e) => { if(e.target.value === "yes") { pageSectionInput_placeholderVideoDiv.classList.remove("hidden-html-gen"); } else if(e.target.value === "no") { pageSectionInput_placeholderVideoDiv.classList.add("hidden-html-gen"); } }); // Create the input [video number] field // pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', '', '', ''); htmlElementData = Math.random(); if(inputAutomaticNumbering.value === "yes") { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', 'hidden-html-gen', '', pageSectionInput_placeholderVideoDiv, '', 'data-form', htmlElementData, ''); } else { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', 'data-form', htmlElementData, ''); } updateSectionElement_childContainer('video-nr-form', htmlElementData, '', htmlElementList_container, '') addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'Número del vídeo (01, 02, 03 etc.):', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '(ej. 01)', 'data-input', htmlElementData, 'text').addEventListener('change', highlightGlobalInputField); updateSectionElement_childContainer('video-nr', htmlElementData, '', htmlElementList_container, '') // Create the input [video url] field pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'La url del vídeo es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '', 'data-input', htmlElementData, 'text').addEventListener('change', highlightGlobalInputField); updateSectionElement_childContainer('video-url', htmlElementData, '', htmlElementList_container, '') // Create the input [add text] select option pageSectionInput_placeholder = addSectionInput_Form_Elements('div', 'form__selection', 'form__selection--add-elements', pageSectionInput_form, '', '', '', 'd-flex'); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'Agrega elemento:', '', ''); htmlElementData = Math.random(); pageSectionInput_placeholderSelect = addSectionInput_Form_Elements('select', 'select-box', 'select-box--small', pageSectionInput_placeholder, '', 'data-input', htmlElementData, ''); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'p (Texto)', '', '', 'p'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'Observa:', '', '', 'observa'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'img (Imagen)', '', '', 'img'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'ul (Lista)', '', '', 'ul'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'Learnbox (Regla)', '', '', 'learnbox'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_placeholderSelect, 'Quote (Tip)', '', '', 'quote'); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element', pageSectionInput_placeholder, '<i class="fas fa-plus-circle"></i>', '', '', '').addEventListener('click', (e) => { e.preventDefault(); switch(pageSectionInput_placeholderSelect.value) { // case "ul": // // htmlElement = "p"; // htmlElementMessage = "Si la lista tiene un título, escríbalo aquí:"; // htmlElementData = Math.random(); // htmlElementMessage_2 = "Agrega un punto de la lista:"; // htmlElementData_2 = Math.random(); // /*=== Saving our changes into an array ===*/ // updateIntroElementArray("ul", htmlElementData, "", htmlElementData_Array) // // htmlElementClass = "main-text"; // break; case "p": pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'Escribe el parágrafo:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('p', htmlElementData, '', htmlElementList_container, '') break; case "observa": pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'Escribe qué vas a observar:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '(ej. "Observa:", "Ejemplo:" etc.)', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('observa', htmlElementData, '', htmlElementList_container, '') break; case "img": pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'La url de la imagen es:', '', '', ''); htmlElementData = Math.random(); let pageSectionInput_placeholderSelect_image = addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '(Nota: Esta url sirve solo para la prevista.)', 'data-input', htmlElementData, 'text', '', '', 'for-image'); if(inputAutomaticImgNaming.value === "yes") { pageSectionInput_placeholderSelect_image.classList.add('html-gen-input-filled'); } addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'Describe la imagen:', '', '', ''); htmlElementData_2 = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '', 'data-input', htmlElementData_2, 'text'); // Upload element to array: updateSectionElement_childContainer('img', htmlElementData, htmlElementData_2, htmlElementList_container, '') break; case "ul": // const index = item.findIndex(x => x.type === "h2"); /* The ul is the most difficult item of the options. Save all the points into an array and add it to the <ul> object. */ let htmlElementList_optionsContainer = []; let htmlElementData_listIndex_options = htmlElementData_listIndex; pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, `L${htmlElementData_listIndex}: Si la lista tiene un título, escríbalo aquí:`, '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '', 'data-input', htmlElementData,'text'); pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', 'form__selection', 'form__selection--add-list-items', pageSectionInput_form, '', '', '', 'd-flex'); // let testElement = document.querySelector(`[data-form="${testId}"]`); // console.log(testElement); // pageSectionInput_placeholderSelect_div.setAttribute('data-form', testId); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, `Agrega un punto de la lista:`, '', '', ''); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element', pageSectionInput_placeholderSelect_div, '<i class="fas fa-plus-circle"></i>', 'data-btn', '').addEventListener('click', (e) => { e.preventDefault(); // const newTest = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', ''); // let testId = Math.random(); // newTest.setAttribute('data-form', testId); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div_2, `L${htmlElementData_listIndex_options}: Escribe el punto:`, '', '', ''); htmlElementData_option = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_placeholderSelect_div_2, '', 'data-input', htmlElementData_option, 'text'); htmlElementList_optionsContainer.push(htmlElementData_option); // /* UPDATE => */ updateSectionElement_childContainer('li', htmlElementData_option, '', htmlElementList_optionsContainer, '', ''); }); htmlElementData_2 = Math.random(); pageSectionInput_placeholderSelect_div_2 = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', 'data-form', htmlElementData, ''); /* UPDATE => */ updateSectionElement_childContainer('ul', htmlElementData, htmlElementData_2, htmlElementList_container, htmlElementList_optionsContainer, htmlElementData_listIndex); htmlElementData_listIndex++; break; case "learnbox": pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); // addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'El learnbox tiene el título:', '', '', ''); // htmlElementData = Math.random(); // addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '(ej. "Regla", "Definición" etc.)', 'data-input', htmlElementData, 'text'); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'La regla es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('learnbox', htmlElementData, '', htmlElementList_container, '') break; case "quote": pageSectionInput_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'El tip es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); updateSectionElement_childContainer('quote', htmlElementData, '', htmlElementList_container, '') break; } }); /*====== (3) SUBSECTIONS: - Create the container "form" ======*/ const pageSectionInput_subsectionContainer = addSectionInput_Form_Elements('div', 'hidden-html-gen', '', pageSectionInput, '', '', '', ''); pageSectionInput_subsection_placeholder = addSectionInput_Form_Elements('div', 'd-flex', 'jc-start', pageSectionInput_subsectionContainer, '', '', '', ''); addSectionInput_Form_Elements('h3', 'html-gen-subtitle', 'html-gen-subtitle--more', pageSectionInput_subsection_placeholder, `Subcapítulos`, '', '', ''); pageSectionInput_subsection_toggleBtn = addSectionInput_Form_Elements('button', 'html-gen-btn', 'html-gen-btn-inside', pageSectionInput_subsection_placeholder, `<i class="fas fa-pen"></i>`, '', '', ''); pageSectionInput_subsection_placeholder = addSectionInput_Form_Elements('div', 'form__selection', 'form__selection--add-list-items', pageSectionInput_subsectionContainer, '', '', '', 'd-flex'); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholder, `Agrega subsección:`, '', '', ''); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element', pageSectionInput_subsection_placeholder, `<i class="fas fa-plus-circle"></i>`, '', '', '').addEventListener('click', () => { // This is a list index let htmlElementData_subsection_listIndex = 1; // All the following input fields should be added to this following <div>: let htmlElementList_containerSubsection = []; const pageSectionInput_subsection_form = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsectionContainer, '', '', '', ''); addSectionInput_Form_Elements('h3', 'html-gen-subtitle', 'html-gen-subtitle--more', pageSectionInput_subsection_form, `Subcapítulo ${pageSectionInput_subChapterNr}`, '', '', ''); // Save the subchapter-nr: /*UPDATE => */ updateSectionElement_childContainer('subchapter-nr', pageSectionInput_subChapterNr, '', htmlElementList_containerSubsection, ''); // Toggle Button pageSectionInput_subsection_toggleBtn.addEventListener('click', () => { pageSectionInput_subsection_form.classList.toggle('hidden-html-gen'); }); // Create the input [title] field pageSectionInput_subsection_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholder, 'Elige un título para el subcapítulo:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_subsection_placeholder, '', 'data-input', htmlElementData, 'text'); /*UPDATE => */ updateSectionElement_childContainer('subchapter-title', htmlElementData, '', htmlElementList_containerSubsection, '') // Create the [has-video] selection pageSectionInput_subsection_placeholder = addSectionInput_Form_Elements('div', 'form__selection', 'd-flex', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholder, 'El capítulo tiene vídeo:', '', '', ''); htmlElementData = Math.random(); pageSectionInput_subsection_placeholderSelect = addSectionInput_Form_Elements('select', 'select-box', 'select-box--small', pageSectionInput_subsection_placeholder, '', 'data-input', htmlElementData, '') pageSectionInput_subsection_placeholderSelect.classList.add('as-center'); /*UPDATE => */ updateSectionElement_childContainer('has-video', htmlElementData, '', htmlElementList_containerSubsection, '') addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'Sí', '', '', 'yes'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'No', '', '', 'no'); // Create a <div> for the video settings htmlElementData = Math.random(); pageSectionInput_placeholderVideoDiv = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', 'data-form', htmlElementData, ''); pageSectionInput_subsection_placeholderSelect.addEventListener('click', (e) => { if(e.target.value === "yes") { pageSectionInput_placeholderVideoDiv.classList.remove("hidden-html-gen"); } else if(e.target.value === "no") { pageSectionInput_placeholderVideoDiv.classList.add("hidden-html-gen"); } }); // Create the input [video number] field // pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', '', '', ''); htmlElementData = Math.random(); if(inputAutomaticNumbering.value === "yes") { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', 'hidden-html-gen', '', pageSectionInput_placeholderVideoDiv, '', 'data-form', htmlElementData, ''); } else { pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', 'data-form', htmlElementData, ''); } /*UPDATE => */ updateSectionElement_childContainer('video-nr-form', htmlElementData, '', htmlElementList_containerSubsection, '') addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'Número del vídeo (01, 02, 03 etc.):', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '(ej. 01)', 'data-input', htmlElementData, 'text'); /*UPDATE => */ updateSectionElement_childContainer('video-nr', htmlElementData, '', htmlElementList_containerSubsection, '') // Create the input [video url] field pageSectionInput_placeholder = addSectionInput_Form_Elements('div', '', '', pageSectionInput_placeholderVideoDiv, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholder, 'La url del vídeo es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholder, '', 'data-input', htmlElementData, 'text'); /*UPDATE => */ updateSectionElement_childContainer('video-url', htmlElementData, '', htmlElementList_containerSubsection, '') /*UPDATE => */ updateSectionElement_childContainer('subsection', '', '', htmlElementList_container, htmlElementList_containerSubsection) console.log(htmlElementList_containerSubsection); console.log(htmlElementList_container); // =============== COPIED TEXT FROM ABOVE =============== // Create the input [add text] select option pageSectionInput_subsection_placeholder = addSectionInput_Form_Elements('div', 'form__selection', 'form__selection--add-elements', pageSectionInput_subsection_form, '', '', '', 'd-flex'); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholder, 'Agrega elemento:', '', ''); htmlElementData = Math.random(); pageSectionInput_subsection_placeholderSelect = addSectionInput_Form_Elements('select', 'select-box', 'select-box--small', pageSectionInput_subsection_placeholder, '', 'data-input', htmlElementData, ''); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'p (Texto)', '', '', 'p'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'Observa:', '', '', 'observa'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'img (Imagen)', '', '', 'img'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'ul (Lista)', '', '', 'ul'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'Learnbox (Regla)', '', '', 'learnbox'); addSectionInput_Form_Elements('option', 'select-box__option', '', pageSectionInput_subsection_placeholderSelect, 'Quote (Tip)', '', '', 'quote'); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element', pageSectionInput_subsection_placeholder, '<i class="fas fa-plus-circle"></i>', '', '', '').addEventListener('click', (e) => { e.preventDefault(); //console.log(e.target.parentNode.children[1].value) // switch(pageSectionInput_subsection_placeholderSelect.value) { switch(e.target.parentNode.children[1].value) { case "p": pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'Escribe el parágrafo:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('p', htmlElementData, '', htmlElementList_container, '') break; case "observa": pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'Escribe qué vas a observar:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '(ej. "Observa:", "Ejemplo:" etc.)', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('observa', htmlElementData, '', htmlElementList_container, '') break; case "img": pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'La url de la imagen es:', '', '', ''); htmlElementData = Math.random(); let pageSectionInput_subsection_placeholderSelect_image = addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '(Nota: Esta url sirve solo para la prevista.)', 'data-input', htmlElementData, 'text', '', '', 'for-image'); if(inputAutomaticImgNaming.value === "yes") { pageSectionInput_subsection_placeholderSelect_image.classList.add('html-gen-input-filled'); } addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'Describe la imagen:', '', '', ''); htmlElementData_2 = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '', 'data-input', htmlElementData_2, 'text'); // Upload element to array: updateSectionElement_childContainer('img', htmlElementData, htmlElementData_2, htmlElementList_container, '') break; case "ul": // const index = item.findIndex(x => x.type === "h2"); /* The ul is the most difficult item of the options. Save all the points into an array and add it to the <ul> object. */ let htmlElementList_optionsContainer = []; let htmlElementData_subsection_listIndex_options = htmlElementData_subsection_listIndex; pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, `L${htmlElementData_subsection_listIndex}: Si la lista tiene un título, escríbalo aquí:`, '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '', 'data-input', htmlElementData,'text'); pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', 'form__selection', 'form__selection--add-list-items', pageSectionInput_subsection_form, '', '', '', 'd-flex'); // let testElement = document.querySelector(`[data-form="${testId}"]`); // console.log(testElement); // pageSectionInput_placeholderSelect_div.setAttribute('data-form', testId); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, `Agrega un punto de la lista:`, '', '', ''); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-add-element', pageSectionInput_subsection_placeholderSelect_div, '<i class="fas fa-plus-circle"></i>', 'data-btn', '').addEventListener('click', (e) => { e.preventDefault(); // const newTest = addSectionInput_Form_Elements('div', '', '', pageSectionInput_form, '', '', ''); // let testId = Math.random(); // newTest.setAttribute('data-form', testId); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div_2, `L${htmlElementData_subsection_listIndex_options}: Escribe el punto:`, '', '', ''); htmlElementData_option = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div_2, '', 'data-input', htmlElementData_option, 'text'); htmlElementList_optionsContainer.push(htmlElementData_option); // /* UPDATE => */ updateSectionElement_childContainer('li', htmlElementData_option, '', htmlElementList_optionsContainer, '', ''); }); htmlElementData_2 = Math.random(); pageSectionInput_subsection_placeholderSelect_div_2 = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', 'data-form', htmlElementData, ''); /* UPDATE => */ updateSectionElement_childContainer('ul', htmlElementData, htmlElementData_2, htmlElementList_container, htmlElementList_optionsContainer, htmlElementData_listIndex); htmlElementData_subsection_listIndex++; break; case "learnbox": pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); // addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_placeholderSelect_div, 'El learnbox tiene el título:', '', '', ''); // htmlElementData = Math.random(); // addSectionInput_Form_Elements('input', 'html-gen-input', '', pageSectionInput_placeholderSelect_div, '(ej. "Regla", "Definición" etc.)', 'data-input', htmlElementData, 'text'); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'La regla es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); // Upload element to array: updateSectionElement_childContainer('learnbox', htmlElementData, '', htmlElementList_container, '') break; case "quote": pageSectionInput_subsection_placeholderSelect_div = addSectionInput_Form_Elements('div', '', '', pageSectionInput_subsection_form, '', '', '', ''); addSectionInput_Form_Elements('p', 'html-gen-instruction', '', pageSectionInput_subsection_placeholderSelect_div, 'El tip es:', '', '', ''); htmlElementData = Math.random(); addSectionInput_Form_Elements('textarea', 'html-gen-input', '', pageSectionInput_subsection_placeholderSelect_div, '', 'data-input', htmlElementData, 'text'); updateSectionElement_childContainer('quote', htmlElementData, '', htmlElementList_container, '') break; } }); // =============== COPIED TEXT FROM ABOVE =============== // Last step: CHANGE THE SUBCHAPTER-NR pageSectionInput_subChapterNr++; }); /*====== (4) Create the container "button" ======*/ const pageSectionInput_btnDiv = addSectionInput_Form_Elements('div', 'html-gen-btn-container', 'd-flex', pageSectionInput, '', '', '', 'jc-center'); // Create the submit button htmlElementData_submitBtn = Math.random(); addSectionInput_Form_Elements('button', 'html-gen-btn', 'btn-submit-general', pageSectionInput_btnDiv, 'Agrega capítulo', 'data-btn', htmlElementData_submitBtn, '').addEventListener('click', createDocumentSection); /*====== Upload the container to the placeholder in the html file ======*/ formAddSectionsContainer.appendChild(pageSectionInput); htmlElementChapter_Object.id = htmlElementData_submitBtn; htmlElementChapter_Object.array = htmlElementList_container; sectionElementArray.push(htmlElementChapter_Object); // console.log(htmlElementChapter_Object.id); // console.log(htmlElementChapter_Object.array); // console.log(htmlElementChapter_Object); // console.log(sectionElementArray); // console.log(htmlElementList_container[0].id); // const htmlElementList_containerValue = document.querySelector(`[data-input="${htmlElementList_container[0].id}"]`); // console.log(htmlElementList_containerValue.value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addSectionInput(e) {\n e.preventDefault();\n addSectionInput_Form();\n}", "createInputSection() {\n let parent = document.getElementById('comparison-selector-container');\n\n // Clear previously created inputs\n this.clearChildNodes(parent);\n\n // Create container div\...
[ "0.69045293", "0.6752145", "0.6415196", "0.6393667", "0.63496727", "0.6184246", "0.60982364", "0.6044911", "0.60437036", "0.60068965", "0.599793", "0.59699637", "0.5963251", "0.59578687", "0.5926604", "0.5900194", "0.58871967", "0.58635306", "0.58173585", "0.58000726", "0.580...
0.679895
1
====== CHAPTER: UPDATE ARRAY DOCUMENT Create the preview document ======
function updateSectionElement_childContainer(type, id, id_2, parentArray, itemList, index) { let htmlElementObject = {}; htmlElementObject.type = type; htmlElementObject.id = id; if(id_2 !== "") { htmlElementObject.id_2 = id_2; } if(itemList !== "") { htmlElementObject.array = itemList; } if(index !== "") { htmlElementObject.index = index; } parentArray.push(htmlElementObject); return parentArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePreview() {\n\n // no preview desired? => abort\n if ( !my.preview ) return;\n\n // (re)render preview\n my.target.start( self.getValue(), instance => $.setContent( self.element.querySelector( '#preview' ), instance.root ) );\n\n }", "function updatePrevi...
[ "0.5932888", "0.5932888", "0.59118485", "0.57431036", "0.57216215", "0.56745946", "0.56731665", "0.5649476", "0.5649476", "0.5602968", "0.55923116", "0.5578746", "0.5557654", "0.5526242", "0.55107284", "0.5478513", "0.5477225", "0.5476786", "0.5430544", "0.5429182", "0.539898...
0.0
-1
====== CHAPTER: PREVIEW DOCUMENT Create the preview document ======
function createDocumentSection(e) { /*====== (1) Select the target button ======*/ // Iterate through the array for(let i=0; i<sectionElementArray.length; i++) { // Select only the childArray that belongs to the button clicked if(sectionElementArray[i].id === Number(e.target.dataset.btn)) { // Create a new section [Remember: createSection (className_1, className_2, commentTitle)] // To number it we save the index of our selected array const internalChapterIndex = (sectionElementArray.indexOf(sectionElementArray[i]) + 1); console.log(internalChapterIndex); const pageSection = createSection('chapter', 'chapter-new', `Chapter 0${internalChapterIndex}`); // Save the corresponding ElementList in a new variable const sectionElementList = sectionElementArray[i].array; // Create the video button createSectionVideoBtn(sectionElementList, pageSection); // Check this variable against the possible cases sectionElementList.forEach(item => { let inputField; let inputField_array; let inputField_subsectionNr; switch(item.type) { case "p": inputField = document.querySelector(`[data-input="${item.id}"]`); createSingleElement('p', 'main-text', inputField); break; case "img": inputField = document.querySelector(`[data-input="${item.id}"]`); inputField_Alt = document.querySelector(`[data-input="${item.id_2}"]`); createImage(inputField, 'img-diagram', inputField_Alt); break; // case "ul": // inputField = document.querySelector(`[data-input="${item.id}"]`); // createSingleElement('ul', 'main-list', inputField, item.array); // console.log(item.id); // console.log(item.array); // break; case "ul": // <!--=======List=======--> // <ul class="main-text main-list"> // <li class="list-dot">tustro colegio?</li> // <li class="list-dot">lancos tiene la caja?</li> // </ul><!--=======/List=======--> inputField = document.querySelector(`[data-input="${item.id}"]`); createSingleElement('ul', 'main-list', inputField, item.array); console.log(item.id); console.log(item.array); break; case "learnbox": inputField = document.querySelector(`[data-input="${item.id}"]`); createSingleElement('div', 'chapter-box', inputField); break; case "observa": inputField = document.querySelector(`[data-input="${item.id}"]`); createSingleElement('p', 'example', inputField); break; // Create the subsections case "subsection": /* <!--***********Subsection 01 (Flex with Video)***********--> <div> <!--=======Section-Title & Video Button=======--> <div class="flex-video"> <div class="flex-video-title"> <p class="main-text section-nr">A. Primer tipo de problema:</p> </div> <div class="flex-video-btn"> <a class="test-button shadow-btn" href="https://www.youtube.com/watch?v=07Ul-mr4UCM" target="_blank">Vídeo 03</a> </div> </div> <!--=======/Section-Title & Video Button=======--></div> */ inputField_array = item.array; console.log(inputField_array) // Now loop again through the subsection array inputField_array.forEach(itemOfSubsection => { switch(itemOfSubsection.type) { case "subchapter-nr": switch(`${itemOfSubsection.id}`) { case "1": inputField_subsectionNr = 'A'; break; case "2": inputField_subsectionNr = 'B'; break; case "3": inputField_subsectionNr = 'C'; break; case "4": inputField_subsectionNr = 'D'; break; case "5": inputField_subsectionNr = 'E'; break; case "6": inputField_subsectionNr = 'F'; break; case "7": inputField_subsectionNr = 'G'; break; case "8": inputField_subsectionNr = 'H'; break; case "9": inputField_subsectionNr = 'I'; break; case "10": inputField_subsectionNr = 'J'; break; }; console.log(inputField_subsectionNr); break; case "has-video": const createSubSectionVideoBtn_hasVideo = document.querySelector(`[data-input="${itemOfSubsection.id}"]`).value; console.log(createSubSectionVideoBtn_hasVideo); createSubSectionVideoBtn(createSubSectionVideoBtn_hasVideo, inputField_subsectionNr, inputField_array, pageSection); } }) // inputField = document.querySelector(`[data-input="${item.id}"]`); // createSingleElement('p', 'example', inputField); break; } }) // Create the subsections console.log(sectionElementList); // Create the html closing createSectionHtmlEnd(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generatePreview() {\n var ifrm = document.getElementById('preview');\n ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;\n ifrm.document.open();\n ...
[ "0.72694975", "0.6625103", "0.65303606", "0.65136933", "0.64782584", "0.6453377", "0.63728195", "0.6287253", "0.625652", "0.62471247", "0.62458646", "0.6163928", "0.61367613", "0.6122549", "0.6073048", "0.6050958", "0.60490686", "0.6039482", "0.6025857", "0.6022846", "0.60228...
0.0
-1
====== CHAPTER: VIDEO BUTTON Create the title / video buttons ======
function createSectionVideoBtn(item, parent) { // const index = item.findIndex(x => x.type === "h2"); // Create the div container const createSectionVideoBtn_onlyTitle = addSectionInput_Form_Elements('div', '', '', '', '', '', '', '') const createSectionVideoBtn_divContainer = addSectionInput_Form_Elements('div', 'flex-video', '', '', '', '', '', '') for(let i=0; i<item.length; i++) { if(item[i].type === "has-video") { const createSectionVideoBtn_hasVideo = document.querySelector(`[data-input="${item[i].id}"]`).value; if(createSectionVideoBtn_hasVideo === "yes"){ /* Code if positive */ for(let i=0; i<item.length; i++) { switch(item[i].type) { case "h2": // Get the chapter number const createSectionVideoBtn_chapterNrIndex = item.findIndex(x => x.type === "chapter-nr"); const createSectionVideoBtn_chapterNrId = document.querySelector(`[data-input="${item[createSectionVideoBtn_chapterNrIndex].id}"]`) const createSectionVideoBtn_chapterNr = createSectionVideoBtn_chapterNrId.value; // Create the title container const createSectionVideoBtn_div_title = addSectionInput_Form_Elements('div', 'flex-video-title', '', createSectionVideoBtn_divContainer, '', '', '', ''); const createSectionVideoBtn_div_titleMessage = document.querySelector(`[data-input="${item[i].id}"]`).value; let chapterNr; if(inputAutomaticNumbering.value === "yes") { chapterNr = `${chapterCount}`; } else { chapterNr = createSectionVideoBtn_chapterNr; } addSectionInput_Form_Elements('h2', 'section-title', '', createSectionVideoBtn_div_title, createSectionVideoBtn_div_titleMessage, '', '', `<span class="chapter__number">(${chapterNr})</span>`); // UPLOAD HTML COMMENTS - this uploads the title part: createSectionComments('div','flex-video','','','1','newLine','','Title & Video Button', ''); createSectionComments('div','flex-video-title','','','2','newLine','','', ''); createSectionComments('h2','section-title','', '','3','','','', ''); createSectionComments('span','chapter__number','', `(${chapterNr})`,'','','','', 'closing'); createSectionComments('h2','','', createSectionVideoBtn_div_titleMessage,'','newLine','','', 'only'); createSectionComments('div','','', '','2','newLine','','', 'only'); chapterCount++; // This is the selector for the value: // console.log(document.querySelector(`[data-input="${item[i].id}"]`).value); break; // case "video-url": // createSectionVideoBtn_div_videoUrl = document.querySelector(`[data-input="${item[i].id}"]`).value; // console.log(createSectionVideoBtn_div_videoUrl); // break; case "has-video": const createSectionVideoBtn_div_video = addSectionInput_Form_Elements('div', 'flex-video-btn', '', createSectionVideoBtn_divContainer, '', '', '', ''); // for(let i=0; i<item.length; i++) { // if(item[i].type === "video-nr") { // createSectionVideoBtn_videoNr = document.querySelector(`[data-input="${item[i].id}"]`).value; // } // const createSectionVideoBtn_videoNrId = item.findIndex(x => x.type === "video-nr"); const createSectionVideoBtn_videoNrIndex = item.findIndex(x => x.type === "video-nr"); const createSectionVideoBtn_videoNrId = document.querySelector(`[data-input="${item[createSectionVideoBtn_videoNrIndex].id}"]`) const createSectionVideoBtn_videoNr = createSectionVideoBtn_videoNrId.value; for(let i=0; i<item.length; i++) { if(item[i].type === "video-url") { const createSectionVideoBtn_videoUrl = document.querySelector(`[data-input="${item[i].id}"]`).value; let sectionVideoNr; if(inputAutomaticNumbering.value === "yes") { sectionVideoNr = `0${videoCount}`; } else { sectionVideoNr = createSectionVideoBtn_videoNr; } addSectionInput_Form_Elements('a', 'test-button', 'shadow-btn', createSectionVideoBtn_div_video, `Vídeo ${sectionVideoNr}`, '', '', '', createSectionVideoBtn_videoUrl); // UPLOAD HTML COMMENTS - this uploads the button part: createSectionComments('div','flex-video-btn','','','2','newLine','','', ''); createSectionComments('a','test-button','shadow-btn', `Vídeo ${sectionVideoNr}`,'3','newLine', createSectionVideoBtn_videoUrl,'', 'closing'); createSectionComments('div','','', '','2','newLine','','', 'only'); createSectionComments('div','','', '','1','newLine','','', 'only'); videoCount++; } } break; } } // Upload the div container parent.appendChild(createSectionVideoBtn_divContainer); } else if(createSectionVideoBtn_hasVideo === "no"){ /* Code if negative */ console.log("i'm a lonely title") for(let i=0; i<item.length; i++) { switch(item[i].type) { case "h2": // Get the chapter number const createSectionVideoBtn_chapterNrIndex = item.findIndex(x => x.type === "chapter-nr"); const createSectionVideoBtn_chapterNrId = document.querySelector(`[data-input="${item[createSectionVideoBtn_chapterNrIndex].id}"]`) const createSectionVideoBtn_chapterNr = createSectionVideoBtn_chapterNrId.value; // Create the title container const createSectionVideoBtn_div_titleMessage = document.querySelector(`[data-input="${item[i].id}"]`).value; let chapterNr; if(inputAutomaticNumbering.value === "yes") { chapterNr = `${chapterCount}`; } else { chapterNr = createSectionVideoBtn_chapterNr; } addSectionInput_Form_Elements('h2', 'section-title', '', createSectionVideoBtn_onlyTitle, createSectionVideoBtn_div_titleMessage, '', '', `<span class="chapter__number">(${chapterNr})</span>`); // UPLOAD HTML COMMENTS - this uploads the title part: createSectionComments('','','','','1','','','Title', 'onlyComment'); createSectionComments('h2','section-title','', '','1','','','', ''); createSectionComments('span','chapter__number','', `(${chapterNr})`,'','','','', 'closing'); createSectionComments('h2','','', createSectionVideoBtn_div_titleMessage,'','newLine','','', 'only'); break; } } // Upload the only title container parent.appendChild(createSectionVideoBtn_onlyTitle); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pag_toggleVideo(button) {\n if (button.title == \"Disable video\") {\n button.title = \"Enable video\";\n document.getElementById(button.id + \"_image\").src =\n pag_context + \"/images/cameraDisabled.png\";\n document.pag_venueClientController.enableVideo(0);\n } els...
[ "0.7030031", "0.6686174", "0.6575529", "0.6512143", "0.64665926", "0.6463262", "0.6440032", "0.64327735", "0.64175314", "0.6400385", "0.6396046", "0.6366315", "0.63555634", "0.6354107", "0.6353496", "0.6299062", "0.6263051", "0.6247203", "0.622928", "0.62277365", "0.6215605",...
0.63528216
15
====== SUBCHAPTER: VIDEO BUTTON Create the title / video buttons ======
function createSubSectionVideoBtn(hasVideo, subchapterNr, item, parent) { console.log(hasVideo); console.log(item); console.log(parent); // Create the div container const createSectionVideoBtn_onlyTitle = addSectionInput_Form_Elements('div', '', '', '', '', '', '', '') const createSectionVideoBtn_divContainer = addSectionInput_Form_Elements('div', 'flex-video', '', '', '', '', '', '') if(hasVideo === "yes"){ /* Code if positive */ for(let i=0; i<item.length; i++) { switch(item[i].type) { case "subchapter-title": // Create the title container const createSectionVideoBtn_div_title = addSectionInput_Form_Elements('div', 'flex-video-title', '', createSectionVideoBtn_divContainer, '', '', '', ''); const createSectionVideoBtn_div_titleMessage = document.querySelector(`[data-input="${item[i].id}"]`).value; addSectionInput_Form_Elements('p', 'main-text', 'section-nr', createSectionVideoBtn_div_title, `${subchapterNr}. ${createSectionVideoBtn_div_titleMessage}`, '', '', ''); // UPLOAD HTML COMMENTS - this uploads the title part: createSectionComments('','','','','1','','',``, 'onlySpace'); createSectionComments('','','','','1','','',`Subsection ${subchapterNr}`, 'onlyCommentStars'); createSectionComments('div','flex-video','','','1','newLine','','Title & Video Button', ''); createSectionComments('div','flex-video-title','','','2','newLine','','', ''); createSectionComments('p','main-text','section-nr', `${subchapterNr}. ${createSectionVideoBtn_div_titleMessage}`,'3','newLine','','', 'closing'); createSectionComments('div','','', '','2','newLine','','', 'only'); // This is the selector for the value: // console.log(document.querySelector(`[data-input="${item[i].id}"]`).value); break; case "has-video": const createSectionVideoBtn_div_video = addSectionInput_Form_Elements('div', 'flex-video-btn', '', createSectionVideoBtn_divContainer, '', '', '', ''); // for(let i=0; i<item.length; i++) { // if(item[i].type === "video-nr") { // createSectionVideoBtn_videoNr = document.querySelector(`[data-input="${item[i].id}"]`).value; // } // const createSectionVideoBtn_videoNrId = item.findIndex(x => x.type === "video-nr"); const createSectionVideoBtn_videoNrIndex = item.findIndex(x => x.type === "video-nr"); const createSectionVideoBtn_videoNrId = document.querySelector(`[data-input="${item[createSectionVideoBtn_videoNrIndex].id}"]`) const createSectionVideoBtn_videoNr = createSectionVideoBtn_videoNrId.value; for(let i=0; i<item.length; i++) { if(item[i].type === "video-url") { const createSectionVideoBtn_videoUrl = document.querySelector(`[data-input="${item[i].id}"]`).value; let sectionVideoNr; if(inputAutomaticNumbering.value === "yes") { sectionVideoNr = `0${videoCount}`; } else { sectionVideoNr = createSectionVideoBtn_videoNr; } addSectionInput_Form_Elements('a', 'test-button', 'shadow-btn', createSectionVideoBtn_div_video, `Vídeo ${sectionVideoNr}`, '', '', '', createSectionVideoBtn_videoUrl); // UPLOAD HTML COMMENTS - this uploads the button part: createSectionComments('div','flex-video-btn','','','2','newLine','','', ''); createSectionComments('a','test-button','shadow-btn', `Vídeo ${sectionVideoNr}`,'3','newLine', createSectionVideoBtn_videoUrl,'', 'closing'); createSectionComments('div','','', '','2','newLine','','', 'only'); createSectionComments('div','','', '','1','newLine','','', 'only'); videoCount++; } } break; } } // Upload the div container parent.appendChild(createSectionVideoBtn_divContainer); } else if(hasVideo === "no"){ /* Code if negative */ for(let i=0; i<item.length; i++) { switch(item[i].type) { case "subchapter-title": // Create the title container const createSectionVideoBtn_div_titleMessage = document.querySelector(`[data-input="${item[i].id}"]`).value; addSectionInput_Form_Elements('p', 'main-text', 'section-nr', createSectionVideoBtn_onlyTitle, `${subchapterNr}. ${createSectionVideoBtn_div_titleMessage}`, '', '', ''); // UPLOAD HTML COMMENTS - this uploads the title part: createSectionComments('','','','','1','','',``, 'onlySpace'); createSectionComments('','','','','1','','',`Subsection ${subchapterNr}`, 'onlyCommentStars'); createSectionComments('p','main-text','section-nr', `${subchapterNr}. ${createSectionVideoBtn_div_titleMessage}`,'1','newLine','','', 'closing'); break; } } // Upload the only title container parent.appendChild(createSectionVideoBtn_onlyTitle); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pag_toggleVideo(button) {\n if (button.title == \"Disable video\") {\n button.title = \"Enable video\";\n document.getElementById(button.id + \"_image\").src =\n pag_context + \"/images/cameraDisabled.png\";\n document.pag_venueClientController.enableVideo(0);\n } els...
[ "0.7044198", "0.6627726", "0.6602982", "0.6485188", "0.64760214", "0.64340895", "0.64287096", "0.6383377", "0.63576704", "0.6311185", "0.6309588", "0.63059455", "0.62988013", "0.6285153", "0.6267263", "0.62659246", "0.62458557", "0.6236562", "0.62324536", "0.62196213", "0.620...
0.5939206
49
TODO: use getSessionStore or something like that...
function getMiddleware(sessionStore) { middleware.getMiddleware(options, function(err, _middleware, _restRouter) { if (err) fsm.fire("error", err); else { var mirror = null, deferCompletion = false, tlsOptions; //stash the rest interface cache.setItem("feather-rest-router", _restRouter); cache.setItem("feather-rest", _restRouter.rest); //defer final server setup until SSL/mirroring is sorted out below var completeServerSetup = function() { //create the underlying Connect server instance var server = Connect(); _.each(_middleware, function(ware) { server.use(ware); }); // configure session path ignores if (options.connect.session.ignorePaths && server.session) { var si = options.connect.session.ignorePaths.length-1; while (si >= 0) { server.session.ignore.push(options.connect.session.ignorePaths[si]); si -= 1; } } //start listening var port = options.port; if (options.ssl && options.ssl.enabled && options.ssl.port) port = options.ssl.port; if (options.ssl && options.ssl.enabled) { server.httpServer = https.createServer(tlsOptions, server).listen(port); } else { server.httpServer = http.createServer(server).listen(port); } // now that ports have been bound we can change the process user and group if (options.daemon.runAsDaemon == true && options.daemon.runAsUser) { console.debug('setting process and group ids (eval whether this should happen for clustered workers or just group leader - then remove debug log statement)...'); if (process.env['USER'] === 'root') { if (options.daemon.runAsGroup) { process.setgid(options.daemon.runAsGroup); } process.setuid(options.daemon.runAsUser); } } server.sessionStore = sessionStore; fsm.fire("complete", server, mirror); }; //use ssl? if (options.ssl && options.ssl.enabled) { if (options.ssl.routes && (!options.ssl.port || options.ssl.port == options.port)) { throw new Error("When explicit SSL routes are defined, you must also specify a value for ssl.port which must be different from the top level (non-SSL) port."); } tlsOptions = { // This is the default secureProtocol used by Node.js, but it might be // sane to specify this by default as it's required if you want to // remove supported protocols from the list. This protocol supports: // // - SSLv2, SSLv3, TLSv1, TLSv1.1 and TLSv1.2 // secureProtocol: 'SSLv23_method', key: fs.readFileSync(options.ssl.key), cert: fs.readFileSync(options.ssl.cert) }; // disable SSLv2 and SSLv3 by default to prevent POODLE exploit // There is a bit of a debate on when this will appear in node core // and whether it will be on or off by default. https://github.com/joyent/node/pull/8551 // This current solution will work until the Node community decides. if (!options.ssl.allowSSLv23) { // Supply `SSL_OP_NO_SSLv3` and `SSL_OP_NO_SSLv2` constant as secureOption to disable SSLv2 and SSLv3 // from the list of supported protocols that SSLv23_method supports. tlsOptions.secureOptions = constants.SSL_OP_NO_SSLv3|constants.SSL_OP_NO_SSLv2; } if (options.ssl.ca) { tlsOptions.ca = []; _.each(options.ssl.ca, function(ca) { var certs = fs.readFileSync(ca); tlsOptions.ca.push(certs); }); } _middleware.unshift(tlsOptions); if (options.ssl.useRedirectServer && !options.ssl.routes) { //ssl is configured as "strict, always on" - i.e. no explicit ssl routes are defined, //therefore, the 'mirror' server on the redirect port need only be a 'throw-away' shim that redirects all requests to SSL var redirectServer = Connect( function(req, res, next) { //do the redirect res.statusCode = 302; var host = options.host; var port = options.ssl.clientRedirectPort || options.ssl.port; //if ssl port is non-standard (443), make sure it gets included in the redirect url host += port === 443 ? "" : ":" + port; res.setHeader("Location", "https://" + host + req.url); res.end(); } ); redirectServer.listen(options.ssl.redirectServerPort); } else if (options.ssl.routes) { //ssl is defined as only _enforced_ for a subset of routes (all routes MAY still use https, but the configured routes MUST use it), //therefore we must create a full mirror server that has logic to force-redirect to ssl for specific routes deferCompletion = true; //indicate final server setup needs to be deferred //get another copy of the middleware stack for the mirror (cannot use shared stack as each server needs its own) middleware.getMiddleware(options, function(err, __middleware, __rest) { //stash the mirror's rest interface cache.setItem("feather-rest-mirror", __rest); //add the SSL route enforcement middleware module at the top of the new stack __middleware.unshift(connectRouter(function(app) { _.each(options.ssl.routes, function(route) { //redirect all http verbs _.each(connectRouter.methods, function(verb) { (app[verb])(new RegExp(route), function(req, res, next) { //do the redirect res.statusCode = 302; var host = options.host; var port = options.ssl.clientRedirectPort || options.ssl.port; //if ssl port is non-standard (443), make sure it gets included in the redirect url host += port === 443 ? "" : ":" + port; res.setHeader("Location", "https://" + host + req.url); res.end(); }); }); }); })); //spin up mirror and complete server setup mirror = Connect(); _.each(__middleware, function(ware) { mirror.use(ware); }); mirror.httpServer = http.createServer(mirror).listen(options.port); completeServerSetup(); }); } } if (!deferCompletion) completeServerSetup(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mySession(){\n var session_login = Session.get(\"mySession\");\n // var session_signup = Session.get('mySession_signup');\n return session_login;\n }", "function getSession( create ) {\n return thymol.objects.thHttpSessionObject;\n }", "async loadSession() {\n if (this.store) {\n await th...
[ "0.6470277", "0.6103705", "0.594887", "0.58961445", "0.58931047", "0.58674145", "0.5840454", "0.5738767", "0.5733041", "0.5727246", "0.5720452", "0.57064104", "0.5704931", "0.5679015", "0.5675578", "0.5674", "0.566869", "0.5655638", "0.5636275", "0.562035", "0.55997974", "0...
0.0
-1
RenderSelection creates a Select component given an array arr
function RenderSelection(props) { const dispArr = [<option >{""}</option>]; if (props.arr) { props.arr.forEach(element => { dispArr.push(<option >{element}</option>); }); } return ( dispArr ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createSelectionOptionsHTML(iArray) {\n var iName = iArray.name;\n var iType = iArray.type;\n var aValues = iArray.value;\n var iOptions = '';\n for (j = 0; j < aValues.length; j++) {\n var iValue = aValues[j];\n var iId = iValue.replace(/\\s+/g, '-').toLowerCase();\n var selOptHTML = \"<div ...
[ "0.659263", "0.62627894", "0.60606015", "0.59335935", "0.5924121", "0.59004354", "0.5900317", "0.589553", "0.5889414", "0.5870788", "0.5870788", "0.5870788", "0.5870788", "0.5870788", "0.585881", "0.58531046", "0.5839282", "0.58385795", "0.58381045", "0.5809644", "0.580901", ...
0.8101828
0
DetailsPage is the page generated for each clothing item
function DetailsPage(props) { activeFilters.length = 0; let id = useParams().id.substring(1); let clothing = ClosetDB[id]; let navigate = useNavigate(); // deleteClothing removes clothing from ClosetDB function deleteClothing(clothing, ClosetDB) { let ind = ClosetDB.indexOf(clothing); ClosetDB.splice(ind, 1); localStorage["ClosetDB"] = JSON.stringify(ClosetDB); navigate(`/`); } // displays description only if it exists function Description(props) { if (clothing.desc) { return (<div> <SubHeading> <div> Description</div></SubHeading> <Desc> {clothing.desc} </Desc></div> ); } else { return (<div></div>); } } // DisplaySeasons creates a text header with clothing's seasons function DisplaySeasons(props) { let dispArr = []; clothing.season.forEach(element => { dispArr.push(<StyledP> {element} </StyledP>); }); return ( <SeasonsStyle>{dispArr}</SeasonsStyle> ); } // DissplayTags displays the tags of the clothing function DisplayTags(props) { let dispArr = []; clothing.tags.forEach(element => { dispArr.push(<div> - {element} </div>); }); return ( <div>{dispArr}</div> ); } const [addedTag, setAddedTag] = useState(""); const onAddChange = (event) => { setAddedTag(event.target.value); }; // handleTagAdd allows user to add tag to clothing const handleTagAdd = (e) => { if (addedTag !== "") { ClosetDB[id].tags.push(addedTag) localStorage["ClosetDB"] = JSON.stringify(ClosetDB); setAddedTag(""); } } const [deletedTag, setDeletedTag] = useState(""); const onDeleteChange = (event) => { setDeletedTag(event.target.value); }; // handleTagDelete allows user to remove tag from clothing const handleTagDelete = (e) => { if (deletedTag !== "") { let ind = clothing.tags.indexOf(deletedTag); ClosetDB[id].tags.splice(ind, 1); localStorage["ClosetDB"] = JSON.stringify(ClosetDB); setDeletedTag(""); } } if (!clothing) { return ( <h2>Sorry, this page doesn't exist!</h2> ) } return ( <Div> <Title> {clothing.colour} {clothing.brand} {clothing.name} </Title> <StyledP> {clothing.type} </StyledP> <DisplaySeasons /> <Main> <ClothesImg src={clothing.img} /> <Right> <DeleteButton onClick={() => { deleteClothing(clothing, ClosetDB); }}> Delete</DeleteButton > <DescAndTag> <Description /> <SubHeading> Tags </SubHeading> <DisplayTags /> </DescAndTag> <Horizontal> <TagHandling> <div> <button onClick={e => { handleTagDelete(e) }}>Delete A Tag</button> <br /> <select value={deletedTag} onChange={onDeleteChange} style={{ width: 200 }}> <RenderSelection arr={clothing.tags}></RenderSelection> </select> </div> </TagHandling> <TagHandling> <div> <button onClick={e => { handleTagAdd(e) }}>Add A Tag</button> <br /> <select value={addedTag} onChange={onAddChange} style={{ width: 200 }}> <RenderSelection arr={FiltersDB.UserTags.filter(item => !(clothing.tags.includes(item)))}></RenderSelection> </select> </div> </TagHandling> </Horizontal> </Right> </Main> </Div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detailPage(ind){\n displayDetails(formatDetails('detail', json.list[ind]));\n // console.log(json.list[ind]);\n document.getElementById(\"homepage\").style.display = \"none\";\n document.getElementById(\"detailpage\").style.display = \"block\";\n }", "handleViewDetailsClic...
[ "0.656899", "0.63847", "0.63666564", "0.62744665", "0.6134881", "0.613347", "0.61262035", "0.61240995", "0.60585266", "0.6035354", "0.59905654", "0.59826094", "0.594085", "0.59289724", "0.5923339", "0.5894293", "0.58759314", "0.58621573", "0.5855452", "0.58514845", "0.5817518...
0.0
-1
deleteClothing removes clothing from ClosetDB
function deleteClothing(clothing, ClosetDB) { let ind = ClosetDB.indexOf(clothing); ClosetDB.splice(ind, 1); localStorage["ClosetDB"] = JSON.stringify(ClosetDB); navigate(`/`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function delete_boat(boat_id) {\r\n const b_key = datastore.key( ['BOAT', parseInt(boat_id, 10)] ); // Create key for ds entity deletion\r\n return datastore.delete(b_key); // Delete entity and return to calling function\r\n}", "deleteParkingLot() {\n defaultLot = new ParkingLot();\n this.db.deletePark...
[ "0.67016727", "0.6574279", "0.6337014", "0.6334918", "0.6304349", "0.6188155", "0.61814106", "0.615381", "0.60686404", "0.60654056", "0.6049928", "0.60272", "0.597376", "0.5956154", "0.59381294", "0.5932484", "0.59261155", "0.5917295", "0.59017223", "0.58892655", "0.58804387"...
0.8289048
0
displays description only if it exists
function Description(props) { if (clothing.desc) { return (<div> <SubHeading> <div> Description</div></SubHeading> <Desc> {clothing.desc} </Desc></div> ); } else { return (<div></div>); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function descriptionCheck() {\n\t\tlet desc;\n\t\tif (detail.description === null) {\n\t\t\treturn desc = \"No description given\"\n\t\t}\n\t\telse {\n\t\t\treturn desc = detail.description\n\t\t}\n\t}", "get htmlDescription(){\n var desc = \"\";\n if(Object.keys(this.inventory).length == 0){\n ...
[ "0.74242973", "0.7020388", "0.68571", "0.68403506", "0.6806286", "0.67357403", "0.6687903", "0.6650576", "0.6593087", "0.65739936", "0.6567982", "0.6550931", "0.6548413", "0.6540536", "0.6516731", "0.65066946", "0.6473206", "0.6453821", "0.6452282", "0.6440731", "0.6401727", ...
0.69429874
2
DisplaySeasons creates a text header with clothing's seasons
function DisplaySeasons(props) { let dispArr = []; clothing.season.forEach(element => { dispArr.push(<StyledP> {element} </StyledP>); }); return ( <SeasonsStyle>{dispArr}</SeasonsStyle> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeSeason() {\n var seasonAndEpisodePatterns = {\n '<b>Season $1</b> ': /s(\\d\\d)/gi,\n '<b>- Episode $1</b>': /e(\\d\\d)/gi\n };\n $.each(seasonAndEpisodePatterns, function(title, pattern) {\n $('.detLink').html(function () {\n return $(this).html().replace(pattern, tit...
[ "0.65058976", "0.639503", "0.63459", "0.60600764", "0.59568006", "0.5956248", "0.5945106", "0.58626944", "0.5842519", "0.58201265", "0.5816618", "0.5754641", "0.57181066", "0.5663577", "0.5640662", "0.56046265", "0.5558184", "0.55490917", "0.55246556", "0.5521943", "0.5517592...
0.78691864
0
DissplayTags displays the tags of the clothing
function DisplayTags(props) { let dispArr = []; clothing.tags.forEach(element => { dispArr.push(<div> - {element} </div>); }); return ( <div>{dispArr}</div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showTags(){\n sendChatMessage(\"List of Monopoly tags:\")\n for (let i = 1; i <= tags.length; i++){\n sendChatMessage( i + \") \" + tags[i-1]);\n }\n sendChatMessage(\"Use '/Choosing a b ... c' to select 8 different tags by numbering with a space between each for the game\");\n sendC...
[ "0.6811759", "0.6173175", "0.6126559", "0.6047491", "0.59985465", "0.5988941", "0.5971849", "0.59337354", "0.5905808", "0.5840282", "0.5839712", "0.5765891", "0.5751437", "0.57374495", "0.57249826", "0.56922734", "0.5640375", "0.56150013", "0.5611888", "0.55318004", "0.552387...
0.6698717
1
Load Data after Rendering
async componentDidMount() { //this.getData(); //this.readTokenFile(); /*const fileTokenExists = await FileSystem.fileExists('tokenFile.txt'); const fileUsernameExists = await FileSystem.fileExists('usernameFile.txt'); // Check token if file exists if (fileTokenExists == true && fileUsernameExists == true) { this.checkToken(); }*/ // Get Screen Height to Make it Fixed const dim = Dimensions.get('screen'); const fixedHeight = dim.height; if (fixedHeight > 0 && fixedHeight <= 534) { var fixedMarginTopFinal = 20; var fixedHeightImageFinal = 50; var fixedWidthImageFinal = 50; } else { var fixedMarginTopFinal = 40; var fixedHeightImageFinal = 150; var fixedWidthImageFinal = 150; } this.setState({ fixedMarginTop: fixedMarginTopFinal, // Set Margin Top fixedHeightImage: fixedWidthImageFinal, // Set Height Image fixedWidthImage: fixedWidthImageFinal // Set Width Image }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadAndRenderItems() {\n pageData().then(render)\n }", "function loadData()\n\t{\n\t\tloadMaterials(false);\n\t\tloadLabors(false);\n\t}", "function pageOnLoad(){\n render(datasetInit);\n render(convertedDataSet1992);\n }", "loadingData() {}", "loadingData() {}", "loadData() {\n\n ...
[ "0.74283266", "0.7368466", "0.7259046", "0.7210738", "0.7210738", "0.70401883", "0.70042527", "0.6996597", "0.6911261", "0.6871026", "0.68636525", "0.6845565", "0.6738485", "0.6726093", "0.6726093", "0.67246616", "0.67246616", "0.66970146", "0.6650073", "0.66465193", "0.66219...
0.0
-1
Read Enter Key Username
handleKeyDownUsername(e) { if(e.nativeEvent.key == "Enter"){ this.searchAction(this.state.usernameValue); this.usernameTxt._root.clear(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValueofInput () {\n\tif (username) {\n\tconsole.log(username.value);\n\t}\n}", "function getUserInput(){\r\n return readlineSync.question(\"Enter a string: \");\r\n}", "function getUserInput(){\r\n return readlineSync.question(\"Enter a string: \");\r\n}", "onEnterUsername(event) {\n if(...
[ "0.65602446", "0.65282106", "0.65282106", "0.64790386", "0.63736254", "0.6351759", "0.6308939", "0.6287816", "0.6284378", "0.6277394", "0.6273681", "0.6250484", "0.62237597", "0.620929", "0.61972815", "0.617282", "0.61306405", "0.6126538", "0.6117789", "0.60772204", "0.605572...
0.6632783
0
Read Enter Key Password
handleKeyDownPassword(e) { if(e.nativeEvent.key == "Enter"){ this.searchAction(this.state.passwordValue); this.passwordTxt._root.clear(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPassword() {\n \tvar stdin = process.openStdin(),\n \ttty = require('tty');\n\n process.stdout.write('Enter password for user ' + database.getUser() + ' on database ' + database.getName() +': ');\n\tprocess.stdin.resume();\n\tprocess.stdin.setEncoding('utf8');\n\tprocess.stdin.setRawMode(true);\n...
[ "0.73056316", "0.6844472", "0.67568403", "0.67139196", "0.6564776", "0.6212989", "0.6198199", "0.6186538", "0.6186538", "0.6180022", "0.61696315", "0.6155062", "0.61450195", "0.6119228", "0.6110306", "0.6079403", "0.6074256", "0.60456294", "0.6045219", "0.5978885", "0.5970216...
0.621309
5
Read Enter Key Email
handleKeyDownEmail(e) { if(e.nativeEvent.key == "Enter"){ this.searchAction(this.state.emailValue); this.emailTxt._root.clear(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inputAndFormatEmail() {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n\n return new Promise(resolve => rl.question('Enter Email ', result => {\n rl.close();\n if (i.test(String(result).toLowerCase()) !== true) {\n ...
[ "0.67172056", "0.6630009", "0.65018606", "0.6409968", "0.62416387", "0.6176467", "0.61661625", "0.61213547", "0.6090835", "0.6084272", "0.60608596", "0.6057965", "0.60089934", "0.59855336", "0.59855336", "0.59659547", "0.5962773", "0.5948721", "0.59259546", "0.59060663", "0.5...
0.6587599
2
Read Enter Key Name
handleKeyDownName(e) { if(e.nativeEvent.key == "Enter"){ this.searchAction(this.state.nameValue); this.nameTxt._root.clear(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function alphaValLeader(input){\r\n\tvar key;\r\n\tdocument.getElementById ? key = input.keyCode: key = input.which;\r\n\tif(event.keyCode == 13){\r\n\t\tgetNames();\r\n\t}\r\n\treturn ((key > 64 && key < 91) || (key > 96 && key < 123) || key == 8 || key == 39 || key == 16 || key == 13);\r\n}", "function keyEven...
[ "0.66981643", "0.6576925", "0.65707976", "0.6504789", "0.6497165", "0.635459", "0.6256701", "0.6179799", "0.6178177", "0.60860544", "0.606891", "0.60607797", "0.6019297", "0.6019297", "0.601188", "0.6008862", "0.60068524", "0.6004755", "0.59893584", "0.59797263", "0.59717095"...
0.6452183
5
setup is a custom p5 js function that runs once at the program's start and does not repeat Sets up the board of mines
function setup() { canvas = createCanvas((boardWidth > headerWidth) ? boardWidth : headerWidth, boardHeight + headerHeight); canvas.parent('game-canvas'); // createBoard(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {\n createCanvas(w * 20 + 1, w * 20 + 1); // forms the width and height of the board\n // need to + 1 to draw the right and bottom borders\n\n // calculates number of rows and columns and then round down to nearest whole number\n cols = floor(width/w);\n rows = floor(height/w);\n g...
[ "0.7435956", "0.74009925", "0.7384601", "0.7364882", "0.73255813", "0.7303141", "0.72271854", "0.71498543", "0.7117607", "0.7085156", "0.70801204", "0.70575255", "0.70354056", "0.7021808", "0.7020382", "0.70192343", "0.69515944", "0.6942775", "0.69154537", "0.6915251", "0.691...
0.6907346
22
draw is a custom p5 js function that loops continually throughout the program's operation Loop through board and show each square
function draw() { background("#616363"); // Show each square on the board if (board.length > 0) { for (let i = 0; i < numSquaresY; i++) { for (let j = 0; j < numSquaresX; j++) { board[i][j].show(); } } } // Tell them if they are waiting for the game to be over if (!canPlay) { app.status = 'Please wait for the game to be over or the host to start the game.'; } // Checks if the player has won/lost if (checkWin() && !endMessageShown) { sendGameOver(); endMessageShown = true; } else if (!playerAlive && !endMessageShown) { app.showModal('You\'ve died!', 'You can still win, so stick around to the end!', false, '', 'Exit'); endMessageShown = true; } // Check if time is up if (time <= 0 && !endMessageShown) { sendGameOver(); endTimer(); } // Displays number of remaining mines and the time textSize(50); textAlign(LEFT, BASELINE); fill(255, 0, 0); text(startingMines - numPlacedFlags, 50, headerHeight - 5); text(time, width - 100, headerHeight - 5); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBoard() {\n for (r = 0; r < ROW; r++) {\n for (c = 0; c < COL; c++) {\n drawSquare(c, r, board[r][c])\n }\n }\n}", "function draw() {\n draw_board(board_width,board_height,board_color)\n draw_snake();\n draw_fruit();\n // console.log(\"drawing\")\n}", "function draw() {\n ...
[ "0.7616947", "0.76169395", "0.7568221", "0.7537031", "0.7520177", "0.7515482", "0.74913687", "0.7448359", "0.74303985", "0.7426878", "0.7424094", "0.7420753", "0.74113995", "0.73947674", "0.73568946", "0.7325002", "0.73219836", "0.73172474", "0.7311586", "0.730818", "0.728885...
0.6905078
72
Custom p5 js event handler Activates whenever mouse is pressed
function mousePressed() { if (!playerAlive || !canPlay) return; // First, check if mouse is within bounds of board if (mouseX <= width && mouseY <= height && mouseY > headerHeight) { // Use x and y of mouse to determine which square the mouse is over const i = floor((mouseY - headerHeight) / yIncrement); const j = floor(mouseX / xIncrement); // Select correct square from array const clickedSquare = board[i][j]; // Left click = click the square if (mouseButton == LEFT) { // if (firstClick) // setMines(j, i); clickedSquare.click(true, true, playerColor); sendExplore(i, j); // Right click = flag the square } else if (mouseButton == RIGHT) { clickedSquare.flag(playerColor, true); sendFlag(i, j); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mousePressed() {\n setup();\n}", "function mousePressed() {\n session.mousePressed();\n}", "mousePressed() {\n console.log(\"Mouse pressed\");\n }", "function mousePressed() {\n init();\n}", "function mousePressed(){\n microBitConnect();\n}", "mouseDown(pt) {}", "mouseDown(pt) {}",...
[ "0.77239054", "0.74989104", "0.7441446", "0.7326641", "0.723226", "0.7154282", "0.7154282", "0.71199894", "0.7108824", "0.7105023", "0.70724374", "0.7045109", "0.7045109", "0.7043787", "0.70354265", "0.7031752", "0.7031752", "0.7031752", "0.70146346", "0.6992251", "0.6985535"...
0.0
-1
Custom p5 js event handler that activates every key press
function keyPressed() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function keyPressed() {\n if (handler.active === handler.nameplate) {\n doorbell.keyPressed();\n }\n}", "function keyPressed() {\r\n if (keyCode === LEFT_ARROW) {\r\n frequency--;\r\n } else if (keyCode === RIGHT_ARROW) {\r\n frequency++;\r\n }\r\n if (keyCode === UP_ARROW) {\r\n ...
[ "0.71484", "0.71059424", "0.6977575", "0.6976591", "0.6882622", "0.68797284", "0.6859301", "0.6834797", "0.68067217", "0.6782437", "0.6779487", "0.6727583", "0.6706894", "0.6697696", "0.66961855", "0.66839486", "0.66710466", "0.66608125", "0.6651052", "0.664674", "0.66404754"...
0.71925807
0
Checks if the player has won
function checkWin() { // Determines if the # of placed flags equals the # of mines const allFlags = numPlacedFlags == startingMines; // Checks if all flags are correctly placed const correctFlags = checkFlagPosition(); // Only returns true if both conditions are met return allFlags && correctFlags; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "gameWon() {\n if (this._gameBoard[0] == this._currentPlayer && this._gameBoard[1] == this._currentPlayer && this._gameBoard[2] == this._currentPlayer ||\n this._gameBoard[3] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer ||\n ...
[ "0.79777163", "0.7847542", "0.7788344", "0.77680796", "0.76788986", "0.7623595", "0.75950915", "0.7553094", "0.7510986", "0.74658155", "0.7443476", "0.7422849", "0.7420163", "0.74158764", "0.7373188", "0.73712415", "0.73648494", "0.73590755", "0.73555624", "0.73295516", "0.73...
0.0
-1
Checks if all the placed flags are in the correct position
function checkFlagPosition() { let allFlagsCorrect = true; for (let f of placedFlags) { if (!f.isMine) allFlagsCorrect = false; } return allFlagsCorrect; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWin() {\n // Determines if the # of placed flags equals the # of mines\n const allFlags = numPlacedFlags == startingMines;\n \n // Checks if all flags are correctly placed\n const correctFlags = checkFlagPosition();\n \n // Only returns true if both conditions are met\n return allFlags && cor...
[ "0.67097384", "0.64419746", "0.6046095", "0.5998293", "0.5940007", "0.59223366", "0.5839868", "0.58076334", "0.57603747", "0.5708147", "0.56361777", "0.56070423", "0.5593708", "0.5577682", "0.55776316", "0.5562248", "0.5556368", "0.5554933", "0.5542699", "0.5527718", "0.54929...
0.8231262
0
Set the board full of empty squares, then fills it with mines and calculates number of adjacent mines for each square DEPRECATED: now runs on server side and is sent to clients
function createBoard() { for (let i = 0; i < numSquaresY; i++) { board[i] = []; for (let j = 0; j < numSquaresX; j++) { board[i][j] = new Square(i, j, j * xIncrement, i * yIncrement + headerHeight); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMinesNegsCount(board) {\r\n for (var i = 0; i < board.length; i++) {\r\n for (var j = 0; j < board.length; j++) {\r\n TypeCell(board, { i, j });\r\n }\r\n }\r\n}", "function setMinesNegsCount(board, size) {\r\n //Go through every cell in board\r\n for (var i = 0; i < ...
[ "0.7290767", "0.7002049", "0.6991127", "0.6898256", "0.68904793", "0.6834781", "0.6833484", "0.68145996", "0.66528267", "0.6645856", "0.6621724", "0.66188717", "0.661589", "0.65957445", "0.6501545", "0.64830965", "0.64797825", "0.6476917", "0.64655405", "0.64254886", "0.64216...
0.0
-1
Randomly places startingMines of mines throughout the board
function setMines(safeCol, safeRow) { let numMines = startingMines; while (numMines > 0) { const i = floor(random(0, numSquaresY)); const j = floor(random(0, numSquaresX)); if (!board[i][j].isMine && (Math.abs(i - safeRow) > 1 || Math.abs(j - safeCol) > 1)) { board[i][j].isMine = true; numMines--; } } findMines(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMinesRandomly() {\n for (var i = 0; i < gLevel.MINES; i++) {\n var rowIdx = getRandomInt(0, gLevel.SIZE)\n var colIdx = getRandomInt(0, gLevel.SIZE)\n while (gBoard[rowIdx][colIdx].cellContent === gMINE) {\n rowIdx = getRandomInt(0, gLevel.SIZE)\n colIdx = ...
[ "0.7937025", "0.79208857", "0.77272934", "0.7640107", "0.7630548", "0.7573545", "0.75205743", "0.73481464", "0.73442847", "0.7281276", "0.72670513", "0.7196272", "0.7168084", "0.7057791", "0.69224465", "0.69030493", "0.68441194", "0.6565589", "0.65560067", "0.65527093", "0.64...
0.70519125
14
Increments through each square and calculates adjacent mines for that square
function findMines() { for (let i = 0; i < numSquaresY; i++) { for (let j = 0; j < numSquaresX; j++) { board[i][j].calculateAdjacentMines(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "findMines(theBoard) {\n\n let temp = theBoard;\n let { rows, cols } = this.props;\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n\n if (!(theBoard[i][j].mine)) {\n let numMines = 0;\n\n /* Get all surroun...
[ "0.6570356", "0.6545155", "0.6536113", "0.64364564", "0.6378975", "0.6352977", "0.6302723", "0.62325346", "0.6214023", "0.62066543", "0.61676764", "0.6109179", "0.6105069", "0.6098718", "0.6096255", "0.60902715", "0.6047183", "0.60423595", "0.601417", "0.5988298", "0.59772414...
0.8023538
0
Resets the board and starts a new game
function restart() { firstClick = true; playerAlive = true; placedFlags = []; numPlacedFlags = 0; time = 0; createBoard(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "restart() {\n $('#player_turn').text('Red')\n const $board = $(this.selector)\n $board.empty()\n this.drop_btn()\n this.create_board()\n this.turn = 0\n this.game_over = false\n }", "resetBoard() {\n this._gameBoard = [\"\", \"\", \"\", \"\", \"\", \"\",...
[ "0.8116651", "0.8045361", "0.8020583", "0.7972164", "0.7943568", "0.7920208", "0.78832644", "0.7751233", "0.7748226", "0.7679367", "0.7649068", "0.7646948", "0.764611", "0.76359594", "0.76223063", "0.76167274", "0.7604488", "0.7601441", "0.75882137", "0.75737494", "0.75656426...
0.7347249
40
Adds a flag to the array of placed flags
function addToFlagArray(square) { placedFlags.push(square); numPlacedFlags++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addFlags(...flags) {\n this._flags += flags.join(\"\");\n return this;\n }", "function addToGameFlags() {\n for (var i in arguments) {\n gameFlags[arguments[i]] = 0;\n }\n}", "function addFlag(square) {\n\tif (isGameOver) return\n\tif (!square.classList.contains('checked') && (fla...
[ "0.65278375", "0.63456285", "0.63123393", "0.6307574", "0.6225049", "0.620358", "0.59234077", "0.58868843", "0.5716865", "0.56722814", "0.56292766", "0.56120086", "0.5523932", "0.5498425", "0.5488483", "0.548808", "0.54533195", "0.5405662", "0.53280616", "0.5312588", "0.53110...
0.78123444
0
Removes a flag from the array of placed flags
function removeFromFlagArray(square) { const index = placedFlags.indexOf(square); const temp = placedFlags[placedFlags.length - 1]; placedFlags[placedFlags.length - 1] = placedFlags[index]; placedFlags[index] = temp; placedFlags.pop(); numPlacedFlags--; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove_fa(array,element){\n\tif(in_array(array,element)){\n\t\tindex=array.indexOf(element);\n\t\tarray.splice(index,1);\n\t};\n}", "function removeAll(arr, item){\n\t var idx = indexOf(arr, item);\n\t while (idx !== -1) {\n\t arr.splice(idx, 1);\n\t idx = indexOf(arr...
[ "0.6227363", "0.62143165", "0.6148545", "0.6129008", "0.6041205", "0.6013068", "0.600987", "0.5993333", "0.5973438", "0.5959864", "0.59533346", "0.5914137", "0.5901114", "0.5891785", "0.58885777", "0.58862203", "0.58766466", "0.5857681", "0.5851878", "0.5849251", "0.5845769",...
0.79972786
0
Sets the number of squares on the board based on predetermined dimensions
function setNumSquaresFromDimensions() { while (numSquaresX * xIncrement + xIncrement < boardWidth) { numSquaresX++; } while (numSquaresY * yIncrement + yIncrement < boardHeight) { numSquaresY++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setDimensionsFromNumSquares() {\n boardWidth = numSquaresX * xIncrement;\n headerWidth = boardWidth;\n boardHeight = numSquaresY * yIncrement;\n}", "setBoardSize() {\n let self = this;\n //self.board.style.height = (window.innerHeight / 3).toString() + 'px'; // make the board a t...
[ "0.82619894", "0.7056775", "0.68646586", "0.6774022", "0.6727721", "0.66786075", "0.6555077", "0.6543035", "0.6490164", "0.64472973", "0.6383913", "0.63693917", "0.6327771", "0.6298214", "0.62788504", "0.6257066", "0.62321454", "0.6228867", "0.6212523", "0.62029713", "0.61937...
0.837506
0
Sets the board's dimensions based on the number of squares
function setDimensionsFromNumSquares() { boardWidth = numSquaresX * xIncrement; headerWidth = boardWidth; boardHeight = numSquaresY * yIncrement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNumSquaresFromDimensions() {\n while (numSquaresX * xIncrement + xIncrement < boardWidth) {\n numSquaresX++;\n }\n\n while (numSquaresY * yIncrement + yIncrement < boardHeight) {\n numSquaresY++;\n }\n}", "setBoardSize() {\n let self = this;\n //self.board.style.height ...
[ "0.8098505", "0.7319389", "0.713623", "0.7066674", "0.6605652", "0.6603924", "0.65408087", "0.6526596", "0.65141934", "0.648414", "0.6463833", "0.6463452", "0.6457743", "0.6455644", "0.64383805", "0.63941884", "0.63844496", "0.63823795", "0.6366949", "0.63591516", "0.6336055"...
0.83702224
0
Check if the item have COLLECTION as type, if yes then delete the related collection.
function checkIfCollectionType (currentUser, item, callback) { if (item.type === itemTypes.COLLECTION.id) { collectionController.deleteOne(currentUser, item._content, function (apiResponse) { callback(apiResponse.err) }) } else { callback(null) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteRelatedItem (currentUser, collection) {\n m.Item.findOne({type: itemTypes.COLLECTION.id, _content: collection._id}, function (err, item) {\n if (err) return logger.error(err)\n itemController.deleteOne(currentUser, item._id, function (apiResponse) {\n if (apiResponse.err) return logger.e...
[ "0.6374547", "0.592844", "0.58616513", "0.5835144", "0.56913376", "0.5626858", "0.5605843", "0.55807817", "0.55284876", "0.55245167", "0.55165416", "0.5490132", "0.54833084", "0.5472602", "0.5456929", "0.54117346", "0.5401252", "0.53950244", "0.5372424", "0.53453475", "0.5308...
0.7407335
0
Retrieve the customSort object related to collection that contain the item passed as parameter. Then remove the itemId from the list of ids.
function removeItemFromCustomSort (item, callback) { m.CustomSort.findOne({ _collection: item._collection._id, type: sortTypes.COLLECTION_ITEMS.id}, function (err, customSort) { if (err) { logger.error(err); return callback(new m.ApiResponse(err, 500)) } m.CustomSort.update({ _id: customSort._id}, { $pull: { ids: item._id } }, function (err, result) { if (err) { logger.error(err); return callback(new m.ApiResponse(err, 500)) } return callback(new m.ApiResponse(null, 200, item)) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeCollectionFromCustomSort (collection, callback) {\n m.CustomSort.findOne({ _user: collection._author, type: sortTypes.MY_COLLECTIONS.id }, function (err, customSort) {\n if (err) { logger.error(err); return callback(err) }\n if (!customSort) { return callback('cannot find custom sort object')...
[ "0.6564934", "0.57416856", "0.5475968", "0.52999145", "0.52674973", "0.52338076", "0.52291197", "0.51804495", "0.5113155", "0.50587624", "0.50009894", "0.49809724", "0.49781585", "0.49508515", "0.48999837", "0.48943004", "0.4856813", "0.48471615", "0.4835957", "0.4807384", "0...
0.75573653
0
this is the fuction used takes table and an array of data to insert it to the table on first row
function addTR(table, arrayOfData){ //takes the first row of the table var row =table.tBodies[0].insertRow(0); //looping through the data and creating as many TD and give them the data for(var i=0;i<arrayOfData.length;i++){ row.insertCell(i).innerHTML=arrayOfData[i]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendTableData(id, data){\r\n\r\nlet newRow = id.insertRow();\r\n//Check column doesn't contain the data\r\nfor(let i=0; i<id.rows.item(0).cells.length; i++){\r\n let cell = newRow.insertCell();\r\n if(i < data.length){\r\n cell.innerHTML = data[i];\r\n }\r\n}\r\n\r\n}", "function insert_row(data...
[ "0.7304542", "0.71667063", "0.6845734", "0.6790393", "0.67376804", "0.642409", "0.6419678", "0.63993084", "0.63490736", "0.63490736", "0.6332599", "0.6322987", "0.63211286", "0.62730056", "0.62636775", "0.62299836", "0.6211849", "0.6207672", "0.6199761", "0.6188078", "0.61738...
0.748347
0
add fills table header with columns
function addTHead(table,arraOfTH){ var thead=table.tHead; var tr= (thead.rows[0]==null) ?thead:thead.rows[0]; for(var i=0;i<arraOfTH.length;i++){ var th=document.createElement('th'); th.innerHTML=arraOfTH[i]; tr.appendChild(th); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_thead() {\n var schema = _store.active_columns();\n var total = _store.active_rows()['total'];\n var html = [ '<tr>' ];\n\n // create header\n schema.forEach( function ( column ) {\n html.push( '<td class=\"', column['key'], ' ' );\n html.pus...
[ "0.80529493", "0.8039932", "0.7907033", "0.784353", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757275", "0.7757106", "0.77427566", "0.7712226", "0.7695105", ...
0.0
-1
check if local storage works. credit:
_storageAvailable(type) { try { var storage = window[type], x = "__storage_test__"; storage.setItem(x, x); storage.removeItem(x); return true; } catch (e) { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_local_storage() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API\n try {\n var x = '__storage_test__';\n localStorage.setItem(x, x);\n localStorage.removeItem(x);\n return true;\n }\n catch(e) {\n return false;\n }\n}", "function...
[ "0.8279508", "0.8032114", "0.8019687", "0.79965174", "0.7953574", "0.79154116", "0.78474224", "0.7727356", "0.77119994", "0.7710773", "0.7695221", "0.76913124", "0.7684622", "0.76257455", "0.76067466", "0.7582542", "0.7577238", "0.7577238", "0.7577238", "0.7577238", "0.757723...
0.732457
45
save to local storage (c/o
_saveToLocalStorage(storage, propObj) { try { window.localStorage.setItem(storage, propObj); return true; } catch (e) { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function save() {\n storage.write(filename, data);\n }", "function save() {\n localStorage && localStorage.setItem(key, Y.JSON.stringify(data));\n }", "function save() {\n\tvar save = {\n\t\t// Player attributes\n\t\texp: exp,\n\t\tlevel: level,\n\t\tbaseDamage: baseDamage,\n\t\ttotalDama...
[ "0.79766726", "0.74885976", "0.73818505", "0.7330338", "0.7314046", "0.72483444", "0.72036916", "0.71722233", "0.71394837", "0.71346784", "0.7072415", "0.7064598", "0.7045574", "0.70189506", "0.70107234", "0.6984989", "0.6953859", "0.69454914", "0.6914145", "0.69053835", "0.6...
0.0
-1
When editing a recipe this function updates the state for that recipe
updateIngredient(oldIngredient, newIngredient, id) { const newState = { ...this.state }; // todo - some sort of check for same name ingredient newState.recipes.forEach(rcp => { if (rcp.id === id) { rcp.ingredients.forEach(ing => { if (ing.food == oldIngredient.food) { ing.food = newIngredient.food; ing.quantity = newIngredient.quantity; } }); } }); this.setState(newState); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleEdit(recipe: string, props: State & WrappedActionProps) {\n props.setForm('Recipe', recipe)\n props.setForm('Ingredients', pack(props.recipes.get(recipe)))\n props.selectRecipe(recipe)\n props.setModal('Edit_Recipe_Modal')\n}", "function changeRecipeState(e) {\n currentRecipe = this.value\n...
[ "0.72105944", "0.7167812", "0.6996779", "0.69058675", "0.68800443", "0.677932", "0.67392164", "0.6737884", "0.64739877", "0.64136034", "0.64100045", "0.6341273", "0.6325174", "0.6280927", "0.6232152", "0.62188536", "0.62004733", "0.618711", "0.6168094", "0.61627597", "0.61399...
0.65337527
8
When deleting an ingredient from a recipe this function updates the state for that recipe
removeIngredient(oldIngredient, id) { const newState = { ...this.state }; newState.recipes.forEach(s => { if (s.id === id) { const newList = s.ingredients.filter(x => { return x.food != oldIngredient; }); s.ingredients = newList; } }); this.setState(newState); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteIngredient(){\n\n\t\t//Run provided deletion callback method\n\t\tthis.props.deleteCallback().then(res => {\n\n\t\t\t//Force React to update the DOM\n\t\t\tthis.forceUpdate();\n\n\t\t\t//Update self details and id\n\t\t\tthis.setState({id:undefined});\n\n\t\t\t//Tell parent to reset ingredient data member\n\...
[ "0.74878824", "0.7294148", "0.7183334", "0.6801565", "0.6775093", "0.6762271", "0.66746944", "0.66661406", "0.66495174", "0.6644643", "0.66256756", "0.66227263", "0.66163003", "0.6571866", "0.6525576", "0.65070397", "0.63767374", "0.63442284", "0.6283856", "0.6267545", "0.624...
0.75860596
0
Insert a statement after the last import statement in a file
function insertStatement(tree, path, statement) { const contents = tree.read(path).toString(); const sourceFile = typescript_1.createSourceFile(path, contents, typescript_1.ScriptTarget.ESNext); const importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration); const index = importStatements.length > 0 ? importStatements[importStatements.length - 1].getEnd() : 0; if (importStatements.length > 0) { statement = '\n' + statement; } const newContents = devkit_1.applyChangesToString(contents, [ { type: devkit_1.ChangeType.Insert, index, text: statement, }, ]); tree.write(path, newContents); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "exitImport_stmt(ctx) {\n\t}", "ImportDeclaration(path) {\n if (path.node.source.value === \"hnt\") {\n path.remove();\n }\n }", "ImportDeclaration(path) {\n path.remove()\n }", "function replaceImportFile(func) {\n _importFile = func;\n }", "exit(path, state) {\n...
[ "0.57498085", "0.5445813", "0.5435876", "0.54107136", "0.5400193", "0.5396563", "0.5340112", "0.51629573", "0.5018603", "0.5016165", "0.5014406", "0.49837893", "0.49730054", "0.4968474", "0.48873466", "0.48494098", "0.482223", "0.48151866", "0.48032254", "0.4797368", "0.47915...
0.62878895
0
Underlying "class" for the sandblaster API.
function SandBlaster() { var sb = this; if (!(sb instanceof SandBlaster)) { return new SandBlaster(); } sb._initialState = sb.detect(); sb._unsandboxState = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Bart(apiKey){\n this.key = apiKey;\n }", "constructor(options) {\n let {\n url,\n username,\n password,\n request: reqOptions\n } = options;\n\n // Beginning of SNOW initiation.\n this.url = url;\n this.table = 'sc_req_it...
[ "0.59992474", "0.5974518", "0.58819854", "0.5867607", "0.5863035", "0.5855803", "0.58419496", "0.58418566", "0.58263224", "0.5799635", "0.5746047", "0.56776416", "0.56518674", "0.5606809", "0.5606809", "0.5606809", "0.5598412", "0.55068874", "0.5502866", "0.5496597", "0.54965...
0.5955401
2
Google Maps API Lazy Load SDStudio ;)
function google_maps_init() { 'use strict' var markerElement = document.getElementById('marker') var mapElement = document.getElementById('map') var addressName = mapElement.getAttribute('data-name') var roemerberg = {lat: + mapElement.getAttribute("data-lat"), lng: + mapElement.getAttribute("data-lng")} var map = new google.maps.Map(mapElement, { zoom: 12, center: roemerberg, markers: [], }) var contentString = '<div class="balon_content">'+ '<div>'+ '</div>'+ '<p id="firstHeading" class="firstHeading">Shipping address</p>'+ '<div id="bodyContent">'+ '<p><b>' + addressName + '</b></p>'+ '</div>'+ '</div>'; var infowindow = new google.maps.InfoWindow({ content: contentString }); var marker = new google.maps.Marker({ position: roemerberg, map: map, title: "Shipping address", }) infowindow.open(map, marker); marker.addListener('click', function() { infowindow.open(map, marker); }); map.markers.push(marker); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function asyncGoogleMaps() { }", "function getGoogleMap() {\n $.ajax({\n url: scriptsUrls.google,\n dataType: \"script\",\n cache: true\n });\n }", "function loadGoogleMapsApi() {\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.s...
[ "0.74558383", "0.7455039", "0.7436106", "0.73416924", "0.7244953", "0.7244953", "0.7243318", "0.72198075", "0.72171235", "0.72171235", "0.72171235", "0.72171235", "0.72171235", "0.72171235", "0.7062968", "0.70566386", "0.7046472", "0.69967514", "0.69550455", "0.6952001", "0.6...
0.0
-1
tag() returns a regular expression that matches opening and closing tags for a given element and captures the inner value
function tag(element) { return new RegExp('\<' + element + '\>(.*(?=\<))\<\/' + element + '\>') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTag(tag)\n{\n var group = tag.substring(1,5);\n var element = tag.substring(5,9);\n var tagIndex = (\"(\"+group+\",\"+element+\")\").toUpperCase();\n var attr = dict.TAG_DICT[tagIndex];\n return attr;\n}", "function getTag(text, tag){\n console.log(tmpString);\n var tmpString = t...
[ "0.6373034", "0.63209033", "0.627086", "0.627086", "0.627086", "0.627086", "0.6241184", "0.6169761", "0.61546564", "0.6081518", "0.6007218", "0.60038495", "0.5971917", "0.59563935", "0.59563935", "0.59563935", "0.59563935", "0.59505445", "0.5898067", "0.5866712", "0.58064014"...
0.74912524
0
The function which uses the library
function CreditCardTest() { return ( <div className="credit-card-test-page-main"> <CreditCard submitbuttontext="Submit card" onsubmitfunc={myHandlerFunction} expiryMinMonth="2021-10" /> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _____SHARED_functions_____(){}", "function FunctionUtils() {}", "function fnMyLibraryAFunction (){}", "function Utils() {}", "function Utils() {}", "function Library() {\n \n}", "function Utils(){}", "function miFuncion (){}", "function Kutility() {\n\n}", "function Kutility() {\n\n}", ...
[ "0.71731234", "0.6879161", "0.68015325", "0.66272897", "0.66272897", "0.6520636", "0.6345353", "0.62999266", "0.62967545", "0.62967545", "0.6289808", "0.6289808", "0.6289808", "0.619836", "0.611206", "0.61108273", "0.6093304", "0.60837555", "0.6073061", "0.6059931", "0.604513...
0.0
-1
From Jake Archibald's Promises and Back:
function getJSON(url) { // Return a new promise. return new Promise(function (resolve, reject) { // Do the usual XHR stuff var req = new XMLHttpRequest(); req.open('GET', url); req.onload = function () { // This is called even on 404 etc // so check the status if (req.status == 200) { // Resolve the promise with the response text resolve(req.response); } else { // Otherwise reject with the status text // which will hopefully be a meaningful error reject(Error(req.statusText)); } }; // Handle network errors req.onerror = function () { reject(Error("Network Error")); }; // Make the request req.send(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tProm() {\n\n\tvar res = null;\n\tvar ref = null;\n\n\treturn new Promise(function(resolve, reject) {\n\t\tconsole.log('created promise');\n\n\t});\n/*\n\treturn {\n\t\tp: prom,\n\t\tres: \n\t\trej\n\t}\n*/\n}", "function Pt(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{c(i.next(e)...
[ "0.68691665", "0.6765235", "0.66159683", "0.6513045", "0.64969414", "0.648491", "0.64805967", "0.64021456", "0.63989365", "0.6339789", "0.6335627", "0.6307503", "0.62995535", "0.6269389", "0.6255654", "0.62244487", "0.621197", "0.6211211", "0.62008023", "0.61902857", "0.61879...
0.0
-1
Get Functions & Endpoints
function getAsset(namespace, type, id, bnc) { logger.debug('getAsset() called for ' + namespace + '.' + type + '#' + id); return new Promise((resolve, reject) => { return bnc.getAssetRegistry(namespace + '.' + type).then((reg) => { return reg.resolve(id).then((asset) => { resolve(asset); }); }).catch((error) => { logger.error(error.message); reject(error); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getEndpoints(options) {\n\n let _this = this,\n allEndpoints = [],\n foundEndpoints = [];\n\n // Get all functions\n for (let i = 0; i < Object.keys(_this.project.components).length; i++) {\n let component = _this.project.components[Object.keys(_this.project.components)[i]];\n ...
[ "0.6553928", "0.6212035", "0.6201798", "0.6198967", "0.61803555", "0.61412215", "0.6096782", "0.6061468", "0.60095716", "0.5993346", "0.5959917", "0.5883957", "0.5870194", "0.58664745", "0.58593404", "0.5851849", "0.5761588", "0.5684973", "0.564662", "0.55888844", "0.5556586"...
0.0
-1
Get All Functions & Endpoints
function getAllAssets(namespace, type, bnc) { logger.debug('getAllAssets() called for ' + namespace + '.' + type); return new Promise((resolve, reject) => { return bnc.getAssetRegistry(namespace + '.' + type).then((reg) => { return reg.getAll().then((assets) => { resolve(assets); }); }).catch((error) => { logger.error(error.message); reject(error); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get endpoints() {\n return this.getListAttribute('endpoints');\n }", "debugEndpointProvider() {\n console.log(this.epProvider.getEndPointByName('allData'));\n console.log(this.epProvider.buildEndPointWithQueryStringFromObject({\n limit: 10,\n sort: 'title',\n page: 1,\n filter...
[ "0.6247843", "0.62157714", "0.620934", "0.62003523", "0.61965287", "0.61634547", "0.61581004", "0.61393577", "0.61212915", "0.6031217", "0.60293996", "0.6017612", "0.6009168", "0.5996992", "0.5972838", "0.59194744", "0.5888725", "0.5884453", "0.58590466", "0.584638", "0.58453...
0.0
-1
Transaction Functions & Endpoints
function invokeTransaction(namespace, type, attributes, bnc) { logger.debug('issueTransaction() called with ' + namespace + ' ' + type + ' ' + JSON.stringify(attributes)); return new Promise((resolve, reject) => { // Make the transaction let newTransaction; try { newTransaction = factory.newTransaction(namespace, type); } catch (error) { logger.error(error.message); reject(error); } Object.keys(attributes).forEach((key) => { if(Array.isArray(attributes[key])) { if(attributes[key].length && typeof(attributes[key]) === 'object') { newTransaction[key] = []; attributes[key].forEach((element) => { let relationship = factory.newRelationship(element.namespace, element.type, element.id); newTransaction[key].push(relationship); }); } else { newTransaction[key] = attributes[key]; } logger.debug('Adding array to ' + key); } else if(typeof(attributes[key]) === 'object') { let relationship = factory.newRelationship(attributes[key].namespace, attributes[key].type, attributes[key].id); newTransaction[key] = relationship; logger.debug('Adding attribute ' + key + ' with relationship to ' + attributes[key].namespace + '.' + attributes[key].type + '#' + attributes[key].id + ' to new ' + type); } else if(typeof(attributes[key]) === 'string' && attributes[key].search(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z/i) === 0) { newTransaction[key] = new Date(attributes[key]); logger.debug('Adding attribute ' + key + ' with date value ' + attributes[key] + ' to new ' + type); } else { newTransaction[key] = attributes[key]; logger.debug('Adding attribute ' + key + ' with value ' + attributes[key] + ' to new ' + type); } }); // Submit the transaction logger.debug('Submitting new ' + type + ' transaction'); return bnc.submitTransaction(newTransaction).then(() => { logger.debug('Successfully issued ' + type + ' with ' + JSON.stringify(attributes)); resolve(); }).catch((error) => { logger.error(error.message); reject(error); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addTransaction (params){\r\n return Api().post('/savetransaction', params)\r\n }", "updateTransaction(params) {\r\n return Api().post('/updatetransactions', params)\r\n }", "async beginTransaction() {\n }", "async commitTransaction() {\n }", "transaction(fun, transaction) {\n const tx = { tran...
[ "0.75842655", "0.6957644", "0.692672", "0.68134457", "0.67845535", "0.67488223", "0.6694327", "0.6569967", "0.6535634", "0.6472047", "0.64671695", "0.63918954", "0.6371662", "0.63378984", "0.6264461", "0.62123245", "0.6194666", "0.6194666", "0.6189879", "0.6189155", "0.618732...
0.0
-1
Go through the identities on disk and create them
function createExistingIdentities() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createUsers() {\n const arr = []\n for (let index = 0; index < 1000; index++) {\n arr.push(createUser())\n\n }\n fs.writeFileSync('outfile.json', JSON.stringify(arr));\n}", "async function loadNamedIdentitiesLoop(network, mnemonic, index, identities) {\n // 65536 is a ridiculously huge number\...
[ "0.57908195", "0.53885585", "0.5196281", "0.51878726", "0.5183912", "0.51186883", "0.5116837", "0.50109106", "0.49492383", "0.49316004", "0.49165505", "0.49131098", "0.49110845", "0.49059105", "0.4875471", "0.48588488", "0.48509565", "0.48446295", "0.48162803", "0.48139626", ...
0.6769487
0
this method created to modify all the status for property exchange
function invokeStatusUpdateTransaction(namespace, type, attributes, bnc) { logger.debug('issueTransaction() called with ' + namespace + ' ' + type + ' ' + JSON.stringify(attributes)); return new Promise((resolve, reject) => { // Make the transaction let newTransaction; try { newTransaction = factory.newTransaction(namespace, type); } catch (error) { logger.error(error.message); reject(error); } Object.keys(attributes).forEach((key) => { if(Array.isArray(attributes[key])) { if(attributes[key].length && typeof(attributes[key]) === 'object') { newTransaction[key] = []; attributes[key].forEach((element) => { let relationship = factory.newRelationship(element.namespace, element.type, element.id); newTransaction[key].push(relationship); }); } else { newTransaction[key] = attributes[key]; } logger.debug('Adding array to ' + key); } else if(typeof(attributes[key]) === 'object') { let relationship = factory.newRelationship(attributes[key].namespace, attributes[key].type, attributes[key].id); newTransaction[key] = relationship; logger.debug('Adding attribute ' + key + ' with relationship to ' + attributes[key].namespace + '.' + attributes[key].type + '#' + attributes[key].id + ' to new ' + type); } else if(typeof(attributes[key]) === 'string' && attributes[key].search(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z/i) === 0) { newTransaction[key] = new Date(attributes[key]); logger.debug('Adding attribute ' + key + ' with date value ' + attributes[key] + ' to new ' + type); } else { logger.debug('attributes[key] for new transaction ' +attributes[key]); newTransaction[key] = attributes[key]; logger.debug('Adding attribute ' + key + ' with value ' + attributes[key] + ' to new ' + type); } }); // Submit the transaction logger.debug('Submitting new ' + type + ' transaction'); return bnc.submitTransaction(newTransaction).then(() => { logger.debug('Successfully issued ' + type + ' with ' + JSON.stringify(attributes)); resolve(); }).catch((error) => { logger.error(error.message); reject(error); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setAdjustmentSendingStatus(state, status) {\n state.adjustmentSendingStatus = status\n }", "static updatePropertystatus(req, res) {\n const foundWholeObject = propertyModal.find(p => p.id === parseInt(req.params.id));\n\n if (foundWholeObject.status === 'sold') {\n return res.status(400).json({ st...
[ "0.645068", "0.63247085", "0.6152161", "0.6142811", "0.61101353", "0.6056782", "0.60121006", "0.5980454", "0.5891916", "0.5844624", "0.58329356", "0.58304614", "0.5828732", "0.5807989", "0.5793348", "0.5719028", "0.5719028", "0.5719028", "0.5719028", "0.5719028", "0.5719028",...
0.0
-1
12/15/2017 Darkness Falls Short program to practice separation of javascript files for a bigger project. Working towards implementation of guidedTour. This contains the functions for creating the spotlight effect. Helper Functions for darkness falls function to convert number to pixel format Used by darkness falls for shadow div sizing
function toPixels(number){ var pixels = number.toString() + "px"; return pixels; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function darknessFalls(elem){\n\tvar boundingRect = elem.getBoundingClientRect();\n\tvar pageWidth = document.body.scrollWidth;\n\tvar pageHeight = document.body.scrollHeight;\n\t//create four quadrants to cover all of screen except spotlight\n//quadrant1: top strip\n\tconsole.log(\"made it to canvas creation\");\...
[ "0.7004481", "0.67819273", "0.6443416", "0.6321085", "0.62827474", "0.61705536", "0.6156187", "0.6067532", "0.6063697", "0.60627997", "0.60422397", "0.60148436", "0.60102344", "0.59887767", "0.59790695", "0.59719425", "0.5923671", "0.588864", "0.5861929", "0.5843033", "0.5831...
0.0
-1
function to add to pixel formatted number used by darkness falls in case of screenoffset
function addPixels(number,add){ number= number.slice(0,-2); number= Number(number) + add; number= number.toString(); number= number + "px"; return number; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function px(n) { return n+'px' }", "function appendUnit(apples) {\n if(apples.toString().indexOf(\"px\") < -1 && apples.toString().indexOf(\"%\") < -1) {\n return apples += \"px\";\n }\n }", "function px(x) {return (x|0) + 'px';}", "function incdec(v, how){return parseInt(v) + how...
[ "0.64722687", "0.5857545", "0.5851679", "0.58470184", "0.577423", "0.5744548", "0.5579283", "0.5577664", "0.5575239", "0.55452794", "0.5531612", "0.5528015", "0.5501127", "0.55000985", "0.5487947", "0.545991", "0.545991", "0.5443519", "0.54329395", "0.5428263", "0.5425348", ...
0.6566971
1
function to get true screen size/multibrowser approach important for program portability
function getScreenSize(){ var body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); return height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getScreenSize() {\n var width = getScreenWidth();\n var height = getScreenHeight();\n\n //Check for Mobile\n if (width < 800) {\n return \"Mobile\";\n }\n //Check for Desktop Normal\n if (width > 799) {\n return \"Desktop\";\n }\n}", "function getMaxScreenSize() {\n...
[ "0.8087762", "0.7425163", "0.7416517", "0.73424226", "0.72929513", "0.72711504", "0.72708356", "0.7260872", "0.72569036", "0.72102934", "0.72102934", "0.7192307", "0.71286947", "0.7100182", "0.7098015", "0.7017668", "0.70071596", "0.69883543", "0.696531", "0.69609994", "0.695...
0.72079057
11
The Buffer constructor returns instances of `Uint8Array` that have their prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, so the returned instances will have all the node `Buffer` methods and the `Uint8Array` methods. Square bracket notation works as expected it returns a single octet. The `Uint8Array` prototype remains unmodified.
function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "toB...
[ "0.7353416", "0.7353416", "0.7353416", "0.7353416", "0.6973993", "0.6893469", "0.6893469", "0.68475807", "0.68475807", "0.68475807", "0.68475807", "0.68475807", "0.68475807", "0.68475807", "0.6837346", "0.6837346", "0.6837346", "0.6837346", "0.6837346", "0.6837346", "0.683734...
0.0
-1
Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, OR the last index of `val` in `buffer` at offset <= `byteOffset`. Arguments: buffer a Buffer to search val a string, Buffer, or number byteOffset an index into `buffer`; will be clamped to an int32 encoding an optional encoding, relevant is val is a string dir true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match\n if(buffer.length===0)return -1;// Normalize byteOffset\n if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byte...
[ "0.82827944", "0.82551014", "0.82551014", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8248611", "0.82462674", "0.82445997", "0.82445997", "0.8228133", "0.8220099", "0.8218732", "0.8218732", "0.8218732", "0.8218732...
0.0
-1
Need to make sure that buffer isn't trying to write out of bounds.
function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "ensure(n) {\n let minsize = this.pos + n;\n if (minsize > this.capacity) {\n let cap = this.capacity * 2;\n w...
[ "0.66712785", "0.66712785", "0.6632945", "0.65210676", "0.63827264", "0.62754023", "0.62562263", "0.62335545", "0.62335545", "0.61056054", "0.6035937", "0.6017502", "0.59810936", "0.5959609", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.595...
0.0
-1
Removes all keyvalue entries from the hash.
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", ...
[ "0.67331547", "0.66229314", "0.65130246", "0.6456053", "0.62131137", "0.6201214", "0.6139392", "0.61100906", "0.6029288", "0.5966744", "0.59360605", "0.59072584", "0.59072584", "0.59072584", "0.59040016", "0.5900616", "0.5900616", "0.5900616", "0.58648694", "0.58648694", "0.5...
0.0
-1
Removes all keyvalue entries from the list cache.
function listCacheClear() { this.__data__ = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t this.size = 0;\n\t\t}", "function listCacheClear() ...
[ "0.73586595", "0.73586595", "0.73586595", "0.73586595", "0.7318183", "0.7265705", "0.7265705", "0.72641057", "0.72572887", "0.72572887", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", ...
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemo...
[ "0.7589402", "0.70686156", "0.673569", "0.6651485", "0.6528891", "0.6266802", "0.6257602", "0.6257602", "0.6257602", "0.6170819", "0.6170819", "0.6170819", "0.616584", "0.6152476", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0...
0.0
-1
Removes all keyvalue entries from the stack.
function stackClear() { this.__data__ = new ListCache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear () {\n this._dict = {}\n this._stack = [this._dict]\n }", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear() {\n\t this.__...
[ "0.63577217", "0.63291264", "0.63291264", "0.63291264", "0.62734073", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006"...
0.0
-1
Removes all keyvalue entries from the hash.
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", ...
[ "0.67331547", "0.66229314", "0.65130246", "0.6456053", "0.62131137", "0.6201214", "0.6139392", "0.61100906", "0.6029288", "0.5966744", "0.59360605", "0.59072584", "0.59072584", "0.59072584", "0.59040016", "0.5900616", "0.5900616", "0.5900616", "0.58648694", "0.58648694", "0.5...
0.0
-1
Removes all keyvalue entries from the list cache.
function listCacheClear() { this.__data__ = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t this.size = 0;\n\t\t}", "function listCacheClear() ...
[ "0.73586595", "0.73586595", "0.73586595", "0.73586595", "0.7318183", "0.7265705", "0.7265705", "0.72641057", "0.72572887", "0.72572887", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", "0.72368693", ...
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemo...
[ "0.7589402", "0.70686156", "0.673569", "0.6651485", "0.6528891", "0.6266802", "0.6257602", "0.6257602", "0.6257602", "0.6170819", "0.6170819", "0.6170819", "0.616584", "0.6152476", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0.6147431", "0...
0.0
-1
Removes all keyvalue entries from the stack.
function stackClear() { this.__data__ = new ListCache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear () {\n this._dict = {}\n this._stack = [this._dict]\n }", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear() {\n\t this.__...
[ "0.63577217", "0.63291264", "0.63291264", "0.63291264", "0.62734073", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62274295", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006", "0.62171006"...
0.0
-1